mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 10:50:07 +00:00
Update.
1998-03-14 00:52 Tim Waugh <tim@cyberelk.demon.co.uk> * posix/wordexp.c (parse_param): Perform field-splitting after expanding positional parameter. * posix/wordexp-tst.sh: Test that field-splitting is performed after expanding positional parameter. * posix/wordexp.c (parse_param): Fixed memory leak in field-splitting after parameter expansion. 1998-03-14 Ulrich Drepper <drepper@cygnus.com> * locale/programs/linereader.c (lr_token): Return EOF token at EOF. (get_toplvl_escape): Correctly terminate loop at EOF. Patch by Cristian Gafton <gafton@redhat.com>.
This commit is contained in:
parent
14c44e2ec4
commit
76fbcfdd66
18
ChangeLog
18
ChangeLog
@ -1,3 +1,21 @@
|
|||||||
|
1998-03-14 00:52 Tim Waugh <tim@cyberelk.demon.co.uk>
|
||||||
|
|
||||||
|
* posix/wordexp.c (parse_param): Perform field-splitting after
|
||||||
|
expanding positional parameter.
|
||||||
|
|
||||||
|
* posix/wordexp-tst.sh: Test that field-splitting is performed
|
||||||
|
after expanding positional parameter.
|
||||||
|
|
||||||
|
* posix/wordexp.c (parse_param): Fixed memory leak in
|
||||||
|
field-splitting after parameter expansion.
|
||||||
|
|
||||||
|
1998-03-14 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* locale/programs/linereader.c (lr_token): Return EOF token at
|
||||||
|
EOF.
|
||||||
|
(get_toplvl_escape): Correctly terminate loop at EOF.
|
||||||
|
Patch by Cristian Gafton <gafton@redhat.com>.
|
||||||
|
|
||||||
1998-03-13 16:55 Ulrich Drepper <drepper@cygnus.com>
|
1998-03-13 16:55 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
* string/tester.c (test_strpbrk): Add more strpbrk tests.
|
* string/tester.c (test_strpbrk): Add more strpbrk tests.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
|
/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
|
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1996.
|
||||||
|
|
||||||
@ -159,6 +159,12 @@ lr_token (struct linereader *lr, const struct charset_t *charset)
|
|||||||
{
|
{
|
||||||
ch = lr_getc (lr);
|
ch = lr_getc (lr);
|
||||||
|
|
||||||
|
if (ch == EOF)
|
||||||
|
{
|
||||||
|
lr->token.tok = tok_eof;
|
||||||
|
return &lr->token;
|
||||||
|
};
|
||||||
|
|
||||||
if (ch == '\n')
|
if (ch == '\n')
|
||||||
{
|
{
|
||||||
lr->token.tok = tok_eol;
|
lr->token.tok = tok_eol;
|
||||||
@ -283,7 +289,7 @@ get_toplvl_escape (struct linereader *lr)
|
|||||||
esc_error:
|
esc_error:
|
||||||
lr->token.val.str.start = &lr->buf[start_idx];
|
lr->token.val.str.start = &lr->buf[start_idx];
|
||||||
|
|
||||||
while (ch != EOF || !isspace (ch))
|
while (ch != EOF && !isspace (ch))
|
||||||
ch = lr_getc (lr);
|
ch = lr_getc (lr);
|
||||||
lr->token.val.str.len = lr->idx - start_idx;
|
lr->token.val.str.len = lr->idx - start_idx;
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
1998-03-14 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* locales/ru_RU: Correct last patch.
|
||||||
|
Patch by Cristian Gafton <gafton@redhat.com>.
|
||||||
|
|
||||||
1998-03-11 Ulrich Drepper <drepper@cygnus.com>
|
1998-03-11 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
* locales/de_DE: Use common german data and time format not ISO
|
* locales/de_DE: Use common german data and time format not ISO
|
||||||
|
@ -2134,18 +2134,18 @@ abday "<V=><s=><k=>";/
|
|||||||
"<C%><t=><v=>";/
|
"<C%><t=><v=>";/
|
||||||
"<P=><t=><n=>";/
|
"<P=><t=><n=>";/
|
||||||
"<S=><u=><b=>"
|
"<S=><u=><b=>"
|
||||||
mon "<JA><n=><v=><a=><r=><%'>";/
|
mon "<JA><n=><v=><a=><r=><ja>";/
|
||||||
"<F=><e=><v=><r=><a=><l=><%'>";/
|
"<F=><e=><v=><r=><a=><l=><ja>";/
|
||||||
"<M=><a=><r=><t=>";/
|
"<M=><a=><r=><t=>";/
|
||||||
"<A=><p=><r=><e=><l=><%'>";/
|
"<A=><p=><r=><e=><l=><ja>";/
|
||||||
"<M=><a=><j=>";/
|
"<M=><a=><j=>";/
|
||||||
"<I=><ju><n=><%'>";/
|
"<I=><ju><n=><ja>";/
|
||||||
"<I=><ju><l=><%'>";/
|
"<I=><ju><l=><ja>";/
|
||||||
"<A=><v=><g=><u=><s=><t=>";/
|
"<A=><v=><g=><u=><s=><t=><a=>";/
|
||||||
"<S=><e=><n=><t=><ja><b=><r=><%'>";/
|
"<S=><e=><n=><t=><ja><b=><r=><ja>";/
|
||||||
"<O=><k=><t=><ja><b=><r=><%'>";/
|
"<O=><k=><t=><ja><b=><r=><ja>";/
|
||||||
"<N=><o=><ja><b=><r=><%'>";/
|
"<N=><o=><ja><b=><r=><ja>";/
|
||||||
"<D=><e=><k=><a=><b=><r=><%'>"
|
"<D=><e=><k=><a=><b=><r=><ja>"
|
||||||
abmon "<JA><n=><v=>";/
|
abmon "<JA><n=><v=>";/
|
||||||
"<F=><e=><v=>";/
|
"<F=><e=><v=>";/
|
||||||
"<M=><a=><r=>";/
|
"<M=><a=><r=>";/
|
||||||
|
@ -61,11 +61,13 @@ we_wordv[0] = "5"
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
|
${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
|
||||||
${common_objpfx}posix/wordexp-test '$2 ${3}' 2nd 3rd > ${testout}6
|
${common_objpfx}posix/wordexp-test '$2 ${3} $4' 2nd 3rd "4 th" > ${testout}7
|
||||||
cat <<"EOF" | cmp - ${testout}6 || failed=1
|
cat <<"EOF" | cmp - ${testout}7 || failed=1
|
||||||
wordexp returned 0
|
wordexp returned 0
|
||||||
we_wordv[0] = "2nd"
|
we_wordv[0] = "2nd"
|
||||||
we_wordv[1] = "3rd"
|
we_wordv[1] = "3rd"
|
||||||
|
we_wordv[2] = "4"
|
||||||
|
we_wordv[3] = "th"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
exit $failed
|
exit $failed
|
||||||
|
@ -1018,6 +1018,7 @@ parse_param (char **word, size_t *word_length, size_t *max_length,
|
|||||||
int colon_seen = 0;
|
int colon_seen = 0;
|
||||||
int depth = 0;
|
int depth = 0;
|
||||||
int seen_hash = 0;
|
int seen_hash = 0;
|
||||||
|
int free_value = 0;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
for (; words[*offset]; ++(*offset))
|
for (; words[*offset]; ++(*offset))
|
||||||
@ -1285,7 +1286,6 @@ envsubst:
|
|||||||
if (isdigit(*env))
|
if (isdigit(*env))
|
||||||
{
|
{
|
||||||
int n = *env - '0';
|
int n = *env - '0';
|
||||||
char *param;
|
|
||||||
|
|
||||||
free (env);
|
free (env);
|
||||||
if (n >= __libc_argc)
|
if (n >= __libc_argc)
|
||||||
@ -1293,12 +1293,8 @@ envsubst:
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Replace with the appropriate positional parameter */
|
/* Replace with the appropriate positional parameter */
|
||||||
param = __strdup (__libc_argv[n]);
|
value = __libc_argv[n];
|
||||||
if (!param)
|
goto maybe_fieldsplit;
|
||||||
return WRDE_NOSPACE;
|
|
||||||
|
|
||||||
*word = w_addstr (*word, word_length, max_length, param);
|
|
||||||
return *word ? 0 : WRDE_NOSPACE;
|
|
||||||
}
|
}
|
||||||
/* Is it `$$' ? */
|
/* Is it `$$' ? */
|
||||||
else if (*env == '$')
|
else if (*env == '$')
|
||||||
@ -1347,6 +1343,7 @@ envsubst:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free_value = 1;
|
||||||
if (value)
|
if (value)
|
||||||
goto maybe_fieldsplit;
|
goto maybe_fieldsplit;
|
||||||
|
|
||||||
@ -1666,31 +1663,42 @@ envsubst:
|
|||||||
return *word ? 0 : WRDE_NOSPACE;
|
return *word ? 0 : WRDE_NOSPACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
maybe_fieldsplit:
|
maybe_fieldsplit:
|
||||||
if (quoted || !pwordexp)
|
if (quoted || !pwordexp)
|
||||||
{
|
{
|
||||||
/* Quoted - no field split */
|
/* Quoted - no field split */
|
||||||
*word = w_addstr (*word, word_length, max_length, value);
|
*word = w_addstr (*word, word_length, max_length, value);
|
||||||
|
if (free_value)
|
||||||
|
free (value);
|
||||||
|
|
||||||
return *word ? 0 : WRDE_NOSPACE;
|
return *word ? 0 : WRDE_NOSPACE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Need to field-split */
|
/* Need to field-split */
|
||||||
char *field_begin = value;
|
char *value_copy = __strdup (value); /* Don't modify value */
|
||||||
|
char *field_begin = value_copy;
|
||||||
int seen_nonws_ifs = 0;
|
int seen_nonws_ifs = 0;
|
||||||
|
|
||||||
|
if (free_value)
|
||||||
|
free (value);
|
||||||
|
|
||||||
|
if (value_copy == NULL)
|
||||||
|
return WRDE_NOSPACE;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
char *field_end = field_begin;
|
char *field_end = field_begin;
|
||||||
char *next_field;
|
char *next_field;
|
||||||
char ch;
|
|
||||||
|
|
||||||
/* If this isn't the first field, start a new word */
|
/* If this isn't the first field, start a new word */
|
||||||
if (field_begin != value)
|
if (field_begin != value_copy)
|
||||||
{
|
{
|
||||||
if (w_addword (pwordexp, *word) == WRDE_NOSPACE)
|
if (w_addword (pwordexp, *word) == WRDE_NOSPACE)
|
||||||
|
{
|
||||||
|
free (value_copy);
|
||||||
return WRDE_NOSPACE;
|
return WRDE_NOSPACE;
|
||||||
|
}
|
||||||
|
|
||||||
*word = NULL;
|
*word = NULL;
|
||||||
*word_length = *max_length = 0;
|
*word_length = *max_length = 0;
|
||||||
@ -1710,8 +1718,7 @@ envsubst:
|
|||||||
field_end++;
|
field_end++;
|
||||||
|
|
||||||
/* Set up pointer to the character after end of field */
|
/* Set up pointer to the character after end of field */
|
||||||
ch = *field_end;
|
next_field = *field_end ? field_end : NULL;
|
||||||
next_field = ch ? field_end : NULL;
|
|
||||||
|
|
||||||
/* Skip whitespace IFS after the field */
|
/* Skip whitespace IFS after the field */
|
||||||
while (next_field && *next_field && strchr (ifs_white, *next_field))
|
while (next_field && *next_field && strchr (ifs_white, *next_field))
|
||||||
@ -1729,13 +1736,19 @@ envsubst:
|
|||||||
*field_end = 0;
|
*field_end = 0;
|
||||||
|
|
||||||
/* Tag a copy onto the current word */
|
/* Tag a copy onto the current word */
|
||||||
*word = w_addstr (*word, word_length, max_length,
|
*word = w_addstr (*word, word_length, max_length, field_begin);
|
||||||
__strdup (field_begin));
|
|
||||||
if (*word == NULL)
|
if (*word == NULL)
|
||||||
|
{
|
||||||
|
free (value_copy);
|
||||||
return WRDE_NOSPACE;
|
return WRDE_NOSPACE;
|
||||||
|
}
|
||||||
|
|
||||||
field_begin = next_field;
|
field_begin = next_field;
|
||||||
} while (seen_nonws_ifs || (field_begin && *field_begin));
|
}
|
||||||
|
while (seen_nonws_ifs || (field_begin != NULL && *field_begin));
|
||||||
|
|
||||||
|
free (value_copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -840,7 +840,7 @@ __strsep_g (char **__s, __const char *__reject)
|
|||||||
register char *__retval = *__s;
|
register char *__retval = *__s;
|
||||||
if (__retval == NULL || *__retval == '\0')
|
if (__retval == NULL || *__retval == '\0')
|
||||||
return NULL;
|
return NULL;
|
||||||
if ((*__s = strpbrk (__retval, __reject)) != '\0')
|
if ((*__s = strpbrk (__retval, __reject)) != NULL)
|
||||||
*(*__s)++ = '\0';
|
*(*__s)++ = '\0';
|
||||||
return __retval;
|
return __retval;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user