Mercurial > hg > toybox
comparison scripts/make.sh @ 293:6baa13382880
Sort was including the trailing comma and getting the order wrong.
(Specifically, it was comparing "sh," with "sha1sum," and putting sha1sum first
in generated/newtoys.h so the binary search wasn't finding sha1sum. Alas, you
can't feed separate beginning and ending delimiters to "sort -t". The fix is
to copy the appropriate field out with sed, duplicate it at the start of the
string where it's easy to compare, and then remove it again with a second
sed after the sort.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 12 May 2008 01:23:19 -0500 |
parents | 4b4a6979d228 |
children | dfbfbaeb69c9 |
comparison
equal
deleted
inserted
replaced
292:b4077be6c746 | 293:6baa13382880 |
---|---|
20 do | 20 do |
21 sed -n -e '1,/^config [A-Z]/s/^USE_/&/p' $i || exit 1 | 21 sed -n -e '1,/^config [A-Z]/s/^USE_/&/p' $i || exit 1 |
22 done | 22 done |
23 } | 23 } |
24 echo "NEWTOY(toybox, NULL, 0)" > generated/newtoys.h | 24 echo "NEWTOY(toybox, NULL, 0)" > generated/newtoys.h |
25 newtoys | sort -t '(' -k3,3 >> generated/newtoys.h | 25 newtoys | sed 's/\(.*TOY(\)\([^,]*\),\(.*\)/\2 \1\2,\3/' | sort -k 1,1 \ |
26 | sed 's/[^ ]* //' >> generated/newtoys.h | |
26 | 27 |
27 # Extract global structure definitions from toys/*.c | 28 # Extract global structure definitions from toys/*.c |
28 | 29 |
29 function getglobals() | 30 function getglobals() |
30 { | 31 { |