forsyth@minster.UUCP (forsyth) (03/05/86)
These changes to the Bourne shell allow ${99} as well as ${9} or $9. $99 works as before (it's ${9}9). Values beyond $#, including silly ones, produce the empty string. Your line numbers will probably not agree with the diff output below, but the declaration of idb is easy to find. (The format of source code in a System V shell will also differ.) Possible application: eval last=\"\${$#}\" diff /usr/src/cmd/sh/macro.c macro.c 12a15,16 > #define MAXARG 10000 > 67c71 < CHAR idb[2]; --- > CHAR idb[12]; 81c85,103 < THEN dolg=1; c='1'; --- > THEN dolg=1; c=1; > ELIF bra > THEN > INT i=0, val=0; > WHILE digit(c) > DO IF i < sizeof(idb)-1 > THEN idb[i++]=c; > FI > c -= '0'; > IF val < MAXARG/10 > THEN val=val*10 + c; > FI > c=readc() > OD > idb[i]=0; > peekc = c|MARK; > c=val; > ELSE > c -= '0'; 83,84c105 < c -= '0';