@@ -6,7 +6,7 @@ COMMON_CPPFLAGS = \
-DBSD=1 -DSHELL
AM_CFLAGS = $(COMMON_CFLAGS)
-AM_CPPFLAGS = $(COMMON_CPPFLAGS)
+AM_CPPFLAGS = $(COMMON_CPPFLAGS) -DSYSCONFDIR=$(sysconfdir)
AM_CFLAGS_FOR_BUILD = -g -O2 $(COMMON_CFLAGS)
AM_CPPFLAGS_FOR_BUILD = $(COMMON_CPPFLAGS)
@@ -148,7 +148,7 @@ main(int argc, char **argv)
login = procargs(argc, argv);
if (login) {
state = 1;
- read_profile("/etc/profile");
+ read_profile(SYSCONFDIR "/profile");
state1:
state = 2;
read_profile("$HOME/.profile");
@@ -37,7 +37,8 @@
# token marks the end of a list. The third column is the name to print in
# error messages.
-cat > /tmp/ka$$ <<\!
+TMPDIR=${TMPDIR:-/tmp}
+cat > $TMPDIR/ka$$ <<\!
TEOF 1 end of file
TNL 0 newline
TSEMI 0 ";"
@@ -68,28 +69,27 @@ TWHILE 0 "while"
TBEGIN 0 "{"
TEND 1 "}"
!
-nl=`wc -l /tmp/ka$$`
+nl=`wc -l $TMPDIR/ka$$`
exec > token.h
-awk '{print "#define " $1 " " NR-1}' /tmp/ka$$
-
+awk '{print "#define " $1 " " NR-1}' $TMPDIR/ka$$
exec > token_vars.h
echo '
/* Array indicating which tokens mark the end of a list */
static const char tokendlist[] = {'
-awk '{print "\t" $2 ","}' /tmp/ka$$
+awk '{print "\t" $2 ","}' $TMPDIR/ka$$
echo '};
static const char *const tokname[] = {'
sed -e 's/"/\\"/g' \
-e 's/[^ ]*[ ][ ]*[^ ]*[ ][ ]*\(.*\)/ "\1",/' \
- /tmp/ka$$
+ $TMPDIR/ka$$
echo '};
'
-sed 's/"//g' /tmp/ka$$ | awk '
+sed 's/"//g' $TMPDIR/ka$$ | awk '
/TNOT/{print "#define KWDOFFSET " NR-1; print "";
print "static const char *const parsekwd[] = {"}
/TNOT/,/neverfound/{if (last) print " \"" last "\","; last = $3}
END{print " \"" last "\"\n};"}'
-rm /tmp/ka$$
+rm $TMPDIR/ka$$
@@ -29,6 +29,7 @@
#include <limits.h>
#include <signal.h>
#include <sys/types.h>
+#include <string.h>
#ifndef SSIZE_MAX
#define SSIZE_MAX ((ssize_t)((size_t)-1 >> 1))