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

- Added a new callback function which can be used in programs which want

to avoid that the command line wildcard expansion takes place.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15132 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2006-09-15 06:58:17 +00:00
parent 927407de1b
commit 42dba39aef
6 changed files with 76 additions and 7 deletions

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.68k,v 1.94 2006-08-06 08:31:05 obarthel Exp $
# $Id: GNUmakefile.68k,v 1.95 2006-09-15 06:58:16 obarthel Exp $
#
# :ts=8
#
@ -496,6 +496,7 @@ UNIX_LIB = \
stdlib_alloca_trap.o \
stdlib_arg.o \
stdlib_expand_wildcard.o \
stdlib_expand_wildcard_check.o \
stdlib_getmemstats.o \
stdlib_main.o \
stdlib_main_stub.o \

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.os4,v 1.107 2006-08-06 08:31:05 obarthel Exp $
# $Id: GNUmakefile.os4,v 1.108 2006-09-15 06:58:16 obarthel Exp $
#
# :ts=8
#
@ -538,6 +538,7 @@ UNIX_LIB = \
stdlib_alloca_trap.o \
stdlib_arg.o \
stdlib_expand_wildcard.o \
stdlib_expand_wildcard_check.o \
stdlib_getmemstats.o \
stdlib_main.o \
stdlib_main_stub.o \

View File

@ -1,9 +1,12 @@
- updated m68k specs file in /documentation to contain an own __CLIB2__
- Updated m68k specs file in /documentation to contain an own __CLIB2__
define so that existing m68k compilers also have this define. In addition,
the common "-noixemul" option can now also be specified but will do a NOP
so that Makefiles sharing multiple runtime lib setups work without
a warning.
- Added a new callback function which can be used in programs which want
to avoid that the command line wildcard expansion takes place.
- __get_default_file() now dynamically fills in file handles for the
stdin/stdout/stderr streams if it's part of the thread-safe library.

View File

@ -1,5 +1,5 @@
/*
* $Id: dos.h,v 1.24 2006-08-06 08:15:42 obarthel Exp $
* $Id: dos.h,v 1.25 2006-09-15 06:58:17 obarthel Exp $
*
* :ts=4
*
@ -487,6 +487,17 @@ extern BOOL __thread_safe_errno_h_errno;
*/
extern BOOL __expand_wildcard_args;
/*
* Similar to the boolean flag value __expand_wildcard_args described above,
* a function can be called which may be used to enable/disable wildcard
* expansion at runtime. The function is undefined by default, which means
* that the __expand_wildcard_args value will take precedence. If you want
* to override the effects of the __expand_wildcard_args variable, declare
* your own check function and then assign it to the
* __expand_wildcard_args_check pointer.
*/
extern BOOL (*__expand_wildcard_args_check)(void);
/****************************************************************************/
/*

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_arg.c,v 1.11 2006-05-04 08:01:47 obarthel Exp $
* $Id: stdlib_arg.c,v 1.12 2006-09-15 06:58:16 obarthel Exp $
*
* :ts=4
*
@ -121,12 +121,25 @@ ARG_CONSTRUCTOR(arg_init)
/* Shell startup? */
if(__WBenchMsg == NULL)
{
BOOL expand_wildcard_args;
size_t number_of_arguments;
unsigned char * arg_str;
size_t arg_len;
unsigned char * command_line;
unsigned char * str;
/* Check if wildcard expansion of command line parameters
should be enabled. Note that the callback function, if
declared, takes precedence over the global variable. */
#if defined(UNIX_PATH_SEMANTICS)
{
expand_wildcard_args = __expand_wildcard_args;
if(__expand_wildcard_args_check != NULL)
expand_wildcard_args = (*__expand_wildcard_args_check)();
}
#endif /* UNIX_PATH_SEMANTICS */
/* Get the shell parameter string and find out
how long it is, stripping a trailing line
feed and blank spaces if necessary. */
@ -234,7 +247,7 @@ ARG_CONSTRUCTOR(arg_init)
#if defined(UNIX_PATH_SEMANTICS)
{
/* If necessary, indicate that this parameter was quoted. */
if(__expand_wildcard_args && __wildcard_quote_parameter(__argc) < 0)
if(expand_wildcard_args && __wildcard_quote_parameter(__argc) < 0)
goto out;
}
#endif /* UNIX_PATH_SEMANTICS */
@ -319,7 +332,7 @@ ARG_CONSTRUCTOR(arg_init)
{
/* If necessary, expand wildcard patterns found in the command
line string into file and directory names. */
if(__expand_wildcard_args && __wildcard_expand_init() < 0)
if(expand_wildcard_args && __wildcard_expand_init() < 0)
goto out;
}
#endif /* UNIX_PATH_SEMANTICS */

View File

@ -0,0 +1,40 @@
/*
* $Id: stdlib_expand_wildcard_check.c,v 1.1 2006-09-15 06:58:16 obarthel Exp $
*
* :ts=4
*
* Portable ISO 'C' (1994) runtime library for the Amiga computer
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
* 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_check)(void);