libc/winsup/mingw/init.c
Earnie Boyd 4d6c899474 * CONTRIBUTORS: New file.
* DISCLAIMER: Ditto.
	* CRT_noglob.c: Reword copyright and disclaimer.  Move Contributors
	section CONTRIBUTORS file.  Remove RCS tags.
	* CRTFmode.c: Ditto.
	* CRTglob.c: Ditto.
	* CRTinit.c: Ditto.
	* crt1.c: Ditto.
	* crtdll.dev: Ditto.
	* dllcrt1.c: Ditto.
	* dllmain.c: Ditto.
	* gccmain.c: Ditto.
	* init.c: Ditto.
	* isascii.c: Ditto.
	* iscsym.c: Ditto.
	* iscsymf.c: Ditto.
	* jamfile: Ditto.
	* main.c: Ditto.
	* msvcrt.def.in: Ditto.
	* strcasecmp.c: Ditto.
	* toascii.c: Ditto.
	* wcscmpi.c: Ditto.
	* include/assert.h: Ditto.
	* include/conio.h: Ditto.
	* include/ctype.h: Ditto.
	* include/direct.h: Ditto.
	* include/dirent.h: Ditto.
	* include/dos.h: Ditto.
	* include/errno.h: Ditto.
	* include/excpt.h: Ditto.
	* include/fcntl.h: Ditto.
	* include/float.h: Ditto.
	* include/io.h: Ditto.
	* include/locale.h: Ditto.
	* include/malloc.h: Ditto.
	* include/math.h: Ditto.
	* include/process.h: Ditto.
	* include/setjmp.h: Ditto.
	* include/share.h: Ditto.
	* include/signal.h: Ditto.
	* include/stdio.h: Ditto.
	* include/stdlib.h: Ditto.
	* include/string.h: Ditto.
	* include/tchar.h: Ditto.
	* include/time.h: Ditto.
	* include/wchar.h: Ditto.
	* include/sys/locking.h: Ditto.
	* include/sys/param.h: Ditto.
	* include/sys/stat.h: Ditto.
	* include/sys/timeb.h: Ditto.
	* include/sys/types.h: Ditto.
	* include/sys/utime.h: Ditto.
	* mingwex/dirent.c: Ditto.
2004-04-20 22:49:32 +00:00

68 lines
2 KiB
C

/*
* init.c
* This file has no copyright assigned and is placed in the Public Domain.
* This file is a part of the mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within the package.
*
* Code to initialize standard file handles and command line arguments.
* This file is #included in both crt1.c and dllcrt1.c.
*
*/
/*
* Access to a standard 'main'-like argument count and list. Also included
* is a table of environment variables.
*/
int _argc = 0;
char **_argv = 0;
/* NOTE: Thanks to Pedro A. Aranda Gutiirrez <paag@tid.es> for pointing
* this out to me. GetMainArgs (used below) takes a fourth argument
* which is an int that controls the globbing of the command line. If
* _CRT_glob is non-zero the command line will be globbed (e.g. *.*
* expanded to be all files in the startup directory). In the mingw32
* library a _CRT_glob variable is defined as being -1, enabling
* this command line globbing by default. To turn it off and do all
* command line processing yourself (and possibly escape bogons in
* MS's globbing code) include a line in one of your source modules
* defining _CRT_glob and setting it to zero, like this:
* int _CRT_glob = 0;
*/
extern int _CRT_glob;
#ifdef __MSVCRT__
typedef struct {
int newmode;
} _startupinfo;
extern void __getmainargs (int *, char ***, char ***, int, _startupinfo *);
#else
extern void __GetMainArgs (int *, char ***, char ***, int);
#endif
/*
* Initialize the _argc, _argv and environ variables.
*/
static void
_mingw32_init_mainargs ()
{
/* The environ variable is provided directly in stdlib.h through
* a dll function call. */
char **dummy_environ;
#ifdef __MSVCRT__
_startupinfo start_info;
start_info.newmode = 0;
#endif
/*
* Microsoft's runtime provides a function for doing just that.
*/
#ifdef __MSVCRT__
(void) __getmainargs (&_argc, &_argv, &dummy_environ, _CRT_glob,
&start_info);
#else
/* CRTDLL version */
(void) __GetMainArgs (&_argc, &_argv, &dummy_environ, _CRT_glob);
#endif
}