diff --git a/library/GNUmakefile.68k b/library/GNUmakefile.68k index deae8e9..520d316 100644 --- a/library/GNUmakefile.68k +++ b/library/GNUmakefile.68k @@ -1,5 +1,5 @@ # -# $Id: GNUmakefile.68k,v 1.84 2006-04-05 08:39:45 obarthel Exp $ +# $Id: GNUmakefile.68k,v 1.85 2006-05-04 08:01:45 obarthel Exp $ # # :ts=8 # @@ -492,6 +492,7 @@ UNIX_LIB = \ stdlib_alloca_cleanup.o \ stdlib_alloca_trap.o \ stdlib_arg.o \ + stdlib_expand_wildcard.o \ stdlib_getmemstats.o \ stdlib_main.o \ stdlib_main_stub.o \ diff --git a/library/GNUmakefile.os4 b/library/GNUmakefile.os4 index f4852e7..4c3d9a8 100644 --- a/library/GNUmakefile.os4 +++ b/library/GNUmakefile.os4 @@ -1,5 +1,5 @@ # -# $Id: GNUmakefile.os4,v 1.96 2006-04-05 08:39:45 obarthel Exp $ +# $Id: GNUmakefile.os4,v 1.97 2006-05-04 08:01:46 obarthel Exp $ # # :ts=8 # @@ -534,6 +534,7 @@ UNIX_LIB = \ stdlib_alloca_cleanup.o \ stdlib_alloca_trap.o \ stdlib_arg.o \ + stdlib_expand_wildcard.o \ stdlib_getmemstats.o \ stdlib_main.o \ stdlib_main_stub.o \ diff --git a/library/changes b/library/changes index 2e1a7a0..a6793c5 100644 --- a/library/changes +++ b/library/changes @@ -1,3 +1,9 @@ +- Added the global variable __expand_wildcard_args which can be used + to disable wildcard pattern expansion of command line parameters when + linked against "libunix.a". Note that this has no effect on the "regular" + libc.a behaviour. + + c.lib 1.200 (17.4.2006) - The default break signal mask (SIGBREAKF_CTRL_C) is no longer diff --git a/library/include/dos.h b/library/include/dos.h index 568ffab..9e55d87 100644 --- a/library/include/dos.h +++ b/library/include/dos.h @@ -1,5 +1,5 @@ /* - * $Id: dos.h,v 1.19 2006-04-05 08:39:46 obarthel Exp $ + * $Id: dos.h,v 1.20 2006-05-04 08:01:47 obarthel Exp $ * * :ts=4 * @@ -470,6 +470,25 @@ extern BOOL __thread_safe_errno_h_errno; /****************************************************************************/ +/* + * If you link against libunix.a then the default command line processing + * function will attempt to expand every single wildcard parameter on the + * command line into a series of file and directories names matching the + * wildcards. The idea is to provide functionality which on Unix the + * shell is responsible for. On AmigaDOS the shell commands need to perform + * the expansion. However, if you are mixing AmigaDOS commands which expand + * wildcard patterns with a shell that already does the job, you may run into + * big trouble. To disable the expansion, declare the global variable named + * "__expand_wildcard_args" in your code and have it set to FALSE. Because + * the program startup code checks this variable early on, its value must + * be available at that time, i.e. you cannot just set it differently in + * your code lateron because by that time the startup code will have already + * checked it. + */ +extern BOOL __expand_wildcard_args; + +/****************************************************************************/ + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/library/stdlib_arg.c b/library/stdlib_arg.c index 831ab33..ffaa59a 100644 --- a/library/stdlib_arg.c +++ b/library/stdlib_arg.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_arg.c,v 1.10 2006-01-08 12:04:25 obarthel Exp $ + * $Id: stdlib_arg.c,v 1.11 2006-05-04 08:01:47 obarthel Exp $ * * :ts=4 * @@ -234,7 +234,7 @@ ARG_CONSTRUCTOR(arg_init) #if defined(UNIX_PATH_SEMANTICS) { /* If necessary, indicate that this parameter was quoted. */ - if(__wildcard_quote_parameter(__argc) < 0) + if(__expand_wildcard_args && __wildcard_quote_parameter(__argc) < 0) goto out; } #endif /* UNIX_PATH_SEMANTICS */ @@ -319,7 +319,7 @@ ARG_CONSTRUCTOR(arg_init) { /* If necessary, expand wildcard patterns found in the command line string into file and directory names. */ - if(__wildcard_expand_init() < 0) + if(__expand_wildcard_args && __wildcard_expand_init() < 0) goto out; } #endif /* UNIX_PATH_SEMANTICS */ diff --git a/library/stdlib_expand_wildcard.c b/library/stdlib_expand_wildcard.c new file mode 100644 index 0000000..e409e13 --- /dev/null +++ b/library/stdlib_expand_wildcard.c @@ -0,0 +1,40 @@ +/* + * $Id: stdlib_expand_wildcard.c,v 1.1 2006-05-04 08:01:47 obarthel Exp $ + * + * :ts=4 + * + * Portable ISO 'C' (1994) runtime library for the Amiga computer + * Copyright (c) 2002-2006 by Olaf Barthel + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Neither the name of Olaf Barthel nor the names of contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _STDLIB_HEADERS_H +#include "stdlib_headers.h" +#endif /* _STDLIB_HEADERS_H */ + +/****************************************************************************/ + +BOOL __expand_wildcard_args = TRUE;