1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- Repaired the pattern matching code which expands command line arguments:

it no longer requires that any parameters are quoted and it is automatically
  enabled if you link against libunix.a, without libc.a standing a chance to
  accidentally override it.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14990 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-06-26 10:23:05 +00:00
parent e293873dc7
commit 3d58795d0f
5 changed files with 33 additions and 17 deletions

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.68k,v 1.63 2005-06-26 09:06:09 obarthel Exp $
# $Id: GNUmakefile.68k,v 1.64 2005-06-26 10:23:05 obarthel Exp $
#
# :ts=8
#
@ -362,7 +362,6 @@ C_LIB = \
stdlib_udivsi4.o \
stdlib_umodsi3.o \
stdlib_unsetenv.o \
stdlib_wildcard_expand.o \
strings_ffs.o \
strings_strcasecmp.o \
strings_strncasecmp.o \
@ -483,6 +482,7 @@ UNIX_LIB = \
stdio_record_locking.o \
stdio_remove.o \
stdio_rename.o \
stdlib_arg.o \
stdlib_main.o \
stdlib_mkdtemp.o \
stdlib_mkstemp.o \

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.os4,v 1.69 2005-06-26 09:06:10 obarthel Exp $
# $Id: GNUmakefile.os4,v 1.70 2005-06-26 10:23:05 obarthel Exp $
#
# :ts=8
#
@ -373,7 +373,6 @@ C_LIB = \
stdlib_udivsi4.o \
stdlib_umodsi3.o \
stdlib_unsetenv.o \
stdlib_wildcard_expand.o \
strings_ffs.o \
strings_strcasecmp.o \
strings_strncasecmp.o \
@ -495,6 +494,7 @@ UNIX_LIB = \
stdio_record_locking.o \
stdio_remove.o \
stdio_rename.o \
stdlib_arg.o \
stdlib_main.o \
stdlib_mkdtemp.o \
stdlib_mkstemp.o \

View File

@ -21,6 +21,11 @@
it with a backtick ("`"), which is the wildcard pattern escape character
used on AmigaOS.
- Repaired the pattern matching code which expands command line arguments:
it no longer requires that any parameters are quoted and it is automatically
enabled if you link against libunix.a, without libc.a standing a chance to
accidentally override it.
c.lib 1.193 (4.6.2005)

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_arg.c,v 1.6 2005-03-18 12:38:23 obarthel Exp $
* $Id: stdlib_arg.c,v 1.7 2005-06-26 10:23:05 obarthel Exp $
*
* :ts=4
*
@ -231,9 +231,13 @@ ARG_CONSTRUCTOR(arg_init)
{
char * arg;
/* If necessary, indicate that this parameter was quoted. */
if(__wildcard_quote_parameter(__argc) < 0)
goto out;
#if defined(UNIX_PATH_SEMANTICS)
{
/* If necessary, indicate that this parameter was quoted. */
if(__wildcard_quote_parameter(__argc) < 0)
goto out;
}
#endif /* UNIX_PATH_SEMANTICS */
str++;
@ -311,10 +315,14 @@ ARG_CONSTRUCTOR(arg_init)
__argv[__argc] = NULL;
/* If necessary, expand wildcard patterns found in the command
line string into file and directory names. */
if(__wildcard_expand_init() < 0)
goto out;
#if defined(UNIX_PATH_SEMANTICS)
{
/* If necessary, expand wildcard patterns found in the command
line string into file and directory names. */
if(__wildcard_expand_init() < 0)
goto out;
}
#endif /* UNIX_PATH_SEMANTICS */
}
else
{

View File

@ -1,5 +1,5 @@
/*
* $Id: unistd_wildcard_expand.c,v 1.13 2005-06-26 09:57:52 obarthel Exp $
* $Id: unistd_wildcard_expand.c,v 1.14 2005-06-26 10:23:05 obarthel Exp $
*
* :ts=4
*
@ -173,7 +173,7 @@ __wildcard_expand_init(void)
old_window_pointer = __set_process_window((APTR)-1);
/* No work to be done? */
if(quote_vector == NULL || __argc == 0 || __argv == NULL)
if(__argc == 0 || __argv == NULL)
{
error = OK;
goto out;
@ -230,7 +230,7 @@ __wildcard_expand_init(void)
match_made = FALSE;
/* Check if the string is quoted. Quoted strings are never expanded. */
if(i > 0 && (quote_vector[i / 8] & (1 << (7 - (i % 8)))) == 0)
if(i > 0 && (quote_vector == NULL || (quote_vector[i / 8] & (1 << (7 - (i % 8)))) == 0))
{
size_t arg_len,star_count,j;
char last_c;
@ -505,8 +505,11 @@ __wildcard_expand_init(void)
if(replacement_arg != NULL)
free(replacement_arg);
free(quote_vector);
quote_vector = NULL;
if(quote_vector != NULL)
{
free(quote_vector);
quote_vector = NULL;
}
quote_vector_size = 0;