Check C identifiers for uniqueness

steven at boring.UUCP steven at boring.UUCP
Tue Jul 2 03:49:30 AEST 1985


Someone complained that the two scripts that I submitted checked for the 7
limit for externals, and the 8 limit for internals, but not for the 6
character case-independent limit for externals.
Here is a script to check that. Beware that it uses 'grep -i' to grep case
independently, but on some systems a different flag is used. Change this if
necessary.

Steven Pemberton, CWI, Amsterdam; steven at mcvax.

------------------ CUT HERE -----------------------
: This is a shar archive. Extract with sh, not csh.
: The rest of this file will extract:
: 6limit
echo x - 6limit
sed -e 's/^X//' <<'Bye-Bye' >6limit
X: Check externals differ over first 7 chars
Xcase $# in
X1) ;;
X*) echo Usage: $0 executable-file ; exit 1;;
Xesac
X
Xtrap 'rm -f /tmp/lim1.$$ /tmp/lim2.$$; exit 1' 1 2 15
Xnm -g $1 | sed "s/^............//" >/tmp/lim1.$$
Xsed "s/^\(......\).*/\1/" </tmp/lim1.$$ | tr A-Z a-z | sort | uniq -d | sed "s/.*/grep -i \"^&\" \/tmp\/lim1.$$/" > /tmp/lim2.$$
Xif test -s /tmp/lim2.$$
Xthen
X	echo The following externals don\'t differ in the first 6 characters:
X	sh /tmp/lim2.$$
Xelse
X	echo All externals differ in the first 7 characters
Xfi
Xrm -f /tmp/lim1.$$ /tmp/lim2.$$
Bye-Bye



More information about the Comp.sources.unix mailing list