aboutsummaryrefslogtreecommitdiff
path: root/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-03-19 14:32:08 +0000
committerUlrich Drepper <drepper@redhat.com>1998-03-19 14:32:08 +0000
commit838e5ffe9e0071859b635151729192dedbf104a7 (patch)
tree0886a5307590f0c708c9d1f7dfab853de0dc26b0 /posix
parent7551a1e5100c596793fa182cd26346ff971d3a4f (diff)
downloadglibc-838e5ffe9e0071859b635151729192dedbf104a7.zip
glibc-838e5ffe9e0071859b635151729192dedbf104a7.tar.gz
glibc-838e5ffe9e0071859b635151729192dedbf104a7.tar.bz2
1998-03-19 14:28 Ulrich Drepper <drepper@cygnus.com> * sysdeps/generic/strtok_r.c: Make __strtok_r real name and strtok_r weak alias. * sysdeps/i386/strtok_r.c: Likewise. * sysdeps/libm-i387/i686/s_fdim.S: Make it really work. * sysdeps/libm-i387/i686/s_fdimf.S: Likewise. * sysdeps/libm-i387/i686/s_fdiml.S: Likewise. * sysdeps/libm-i387/i686/s_fmin.S: Likewise. * sysdeps/libm-i387/i686/s_fminf.S: Likewise. * sysdeps/libm-i387/i686/s_fminl.S: Likewise. 1998-03-19 Andreas Jaeger <aj@arthur.rhein-neckar.de> * intl/localealias.c: Remove unneeded define for strdup. 1998-03-19 13:45 Ulrich Drepper <drepper@cygnus.com> * manual/argp.texi: Adjust for better TeX output. * manual/arith.texi: Likewise. * manual/conf.texi: Likewise. * manual/filesys.texi: Likewise. * manual/header.texi: Likewise. * manual/lgpl.texinfo: Likewise. * manual/math.texi: Likewise. * manual/message.texi: Likewise. * manual/pattern.texi: Likewise. * manual/process.texi: Likewise. * manual/signal.texi: Likewise. * manual/socket.texi: Likewise. * manual/startup.texi: Likewise. * manual/stdio.texi: Likewise. * manual/terminal.texi: Likewise. * manual/examples/rprintf.c: Likewise. * manual/examples/testopt.c: Likewise. Patches by Zack Weinberg <zack@rabi.phys.columbia.edu>. 1998-03-19 20:45 Tim Waugh <tim@cyberelk.demon.co.uk> * posix/wordexp.c (parse_param): Don't immediately stop parsing a parameter name after seeing a digit if it's enclosed in braces.
Diffstat (limited to 'posix')
-rw-r--r--posix/wordexp.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/posix/wordexp.c b/posix/wordexp.c
index 268a0e8..1df552a 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -1220,10 +1220,9 @@ parse_param (char **word, size_t *word_length, size_t *max_length,
continue;
}
- special = (strchr ("*@$", words[*offset]) != NULL
- || isdigit (words[*offset]));
+ special = strchr ("*@$", words[*offset]) != NULL;
- if (!isalpha (words[*offset]) && !special)
+ if (!isalnum (words[*offset]) && !special)
/* Stop and evaluate, remembering char we stopped at */
break;
@@ -1273,11 +1272,13 @@ envsubst:
}
/* Is it a special parameter? */
- if (strpbrk (env, "0123456789*@$"))
+ if (strpbrk (env, "*@$") || isdigit (*env))
{
- if (env[1])
+ if ((isdigit(*env) && strcspn (env, "1234567890")) ||
+ (!isdigit(*env) && env[1] != '\0'))
{
- /* Bad substitution if there is more than one character */
+ /* Bad substitution if it isn't "*", "@", "$", or just a number. */
+ bad_subst:
free (env);
fprintf (stderr, "${%s}: bad substitution\n", env);
return WRDE_SYNTAX;
@@ -1286,7 +1287,11 @@ envsubst:
/* Is it a digit? */
if (isdigit(*env))
{
- int n = *env - '0';
+ char *endp;
+ int n = strtol (env, &endp, 10);
+
+ if (*endp != '\0')
+ goto bad_subst;
free (env);
if (n >= __libc_argc)