You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4 KiB

On-device build support.
diff -uNr dash-0.5.10.2/src/mktokens dash-0.5.10.2.mod/src/mktokens
--- dash-0.5.10.2/src/mktokens 2014-09-28 11:19:32.000000000 +0300
+++ dash-0.5.10.2.mod/src/mktokens 2019-08-16 03:05:06.422193420 +0300
@@ -37,7 +37,7 @@
# token marks the end of a list. The third column is the name to print in
# error messages.
-cat > /tmp/ka$$ <<\!
+cat > ${TMPDIR:-/tmp}/ka$$ <<\!
TEOF 1 end of file
TNL 0 newline
TSEMI 0 ";"
@@ -68,28 +68,28 @@
TBEGIN 0 "{"
TEND 1 "}"
!
-nl=`wc -l /tmp/ka$$`
+nl=`wc -l ${TMPDIR:-/tmp}/ka$$`
exec > token.h
-awk '{print "#define " $1 " " NR-1}' /tmp/ka$$
+awk '{print "#define " $1 " " NR-1}' ${TMPDIR:-/tmp}/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:-/tmp}/ka$$
echo '};
static const char *const tokname[] = {'
sed -e 's/"/\\"/g' \
-e 's/[^ ]*[ ][ ]*[^ ]*[ ][ ]*\(.*\)/ "\1",/' \
- /tmp/ka$$
+ ${TMPDIR:-/tmp}/ka$$
echo '};
'
-sed 's/"//g' /tmp/ka$$ | awk '
-/TNOT/{print "#define KWDOFFSET " NR-1; print "";
+sed 's/"//g' ${TMPDIR:-/tmp}/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:-/tmp}/ka$$