diff options
author | ceastha <none@none> | 2005-10-04 20:57:27 -0700 |
---|---|---|
committer | ceastha <none@none> | 2005-10-04 20:57:27 -0700 |
commit | cb4658fbb85e4290093c4fea0eb396a7d98de1fb (patch) | |
tree | 20ef4412dd7a449f5c1af3d26d8b72c2e235b4db /usr/src/cmd/awk/lib.c | |
parent | 45a9d96181a0a0ac4f9f1f7c59834d5d4047d482 (diff) | |
download | illumos-joyent-cb4658fbb85e4290093c4fea0eb396a7d98de1fb.tar.gz |
6320514 UNIX03/UNIX98 *vsc* awk.ex 35 fails - new test, awk fails on filenames with "=", i.e. x=y
Diffstat (limited to 'usr/src/cmd/awk/lib.c')
-rw-r--r-- | usr/src/cmd/awk/lib.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/usr/src/cmd/awk/lib.c b/usr/src/cmd/awk/lib.c index 588700e870..063883122a 100644 --- a/usr/src/cmd/awk/lib.c +++ b/usr/src/cmd/awk/lib.c @@ -151,7 +151,7 @@ getrec(uchar **bufp, size_t *bufsizep) int readrec(uchar **bufp, size_t *sizep, FILE *inf) /* read one record into buf */ { - register int sep, c; + int sep, c; uchar *buf; int count; size_t bufsize; @@ -225,7 +225,7 @@ setclvar(uchar *s) /* set var=value from s */ void fldbld(void) { - register uchar *r, *fr, sep; + uchar *r, *fr, sep; Cell *p; int i; size_t len; @@ -313,7 +313,7 @@ static void cleanfld(int n1, int n2) /* clean out fields n1..n2 inclusive */ { static uchar *nullstat = (uchar *) ""; - register Cell *p; + Cell *p; int i; for (i = n2; i > n1; i--) { @@ -464,7 +464,7 @@ void recbld(void) { int i; - register uchar *p; + uchar *p; size_t cnt, len, olen; static uchar *rec; size_t osize, nsize; @@ -673,12 +673,25 @@ PUTS(uchar *s) int isclvar(uchar *s) /* is s of form var=something? */ { - uchar *os = s; + if (s != NULL) { + + /* Must begin with an underscore or alphabetic character */ + if (isalpha(*s) || (*s == '_')) { + + for (s++; *s; s++) { + /* + * followed by a sequence of underscores, + * digits, and alphabetics + */ + if (!(isalnum(*s) || *s == '_')) { + break; + } + } + return (*s == '=' && *(s + 1) != '='); + } + } - for (; *s; s++) - if (!(isalnum(*s) || *s == '_')) - break; - return (*s == '=' && s > os && *(s + 1) != '='); + return (0); } #define MAXEXPON 38 /* maximum exponent for fp number */ @@ -686,7 +699,7 @@ isclvar(uchar *s) /* is s of form var=something? */ int is_number(uchar *s) { - register int d1, d2; + int d1, d2; int point; uchar *es; extern char radixpoint; |