2000-09-08 10:56:55 +08:00
|
|
|
/* environ.h: Declarations for environ manipulation
|
|
|
|
|
2002-06-12 13:13:54 +08:00
|
|
|
Copyright 2000, 2001, 2002 Red Hat, Inc.
|
2000-09-08 10:56:55 +08:00
|
|
|
|
|
|
|
This file is part of Cygwin.
|
|
|
|
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
|
|
|
/* Initialize the environment */
|
2002-06-16 05:59:32 +08:00
|
|
|
void environ_init (char **, int)
|
|
|
|
__attribute__ ((regparm (2)));
|
2000-09-08 10:56:55 +08:00
|
|
|
|
|
|
|
/* The structure below is used to control conversion to/from posix-style
|
2002-06-12 13:13:54 +08:00
|
|
|
file specs. Currently, only PATH and HOME are converted, but PATH
|
|
|
|
needs to use a "convert path list" function while HOME needs a simple
|
|
|
|
"convert to posix/win32". For the simple case, where a calculated length
|
2003-11-15 07:40:06 +08:00
|
|
|
is required, just return CYG_MAX_PATH. *FIXME* */
|
2000-09-08 10:56:55 +08:00
|
|
|
struct win_env
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
size_t namelen;
|
|
|
|
char *posix;
|
|
|
|
char *native;
|
|
|
|
int (*toposix) (const char *, char *);
|
|
|
|
int (*towin32) (const char *, char *);
|
|
|
|
int (*posix_len) (const char *);
|
|
|
|
int (*win32_len) (const char *);
|
2002-06-16 05:59:32 +08:00
|
|
|
void add_cache (const char *in_posix, const char *in_native = NULL)
|
|
|
|
__attribute__ ((regparm (3)));
|
2001-10-31 08:55:32 +08:00
|
|
|
const char * get_native () const {return native ? native + namelen : NULL;}
|
|
|
|
const char * get_posix () const {return posix ? posix : NULL;}
|
2000-09-08 10:56:55 +08:00
|
|
|
};
|
|
|
|
|
2002-06-16 05:59:32 +08:00
|
|
|
win_env * __stdcall getwinenv (const char *name, const char *posix = NULL)
|
|
|
|
__attribute__ ((regparm (3)));
|
2002-06-29 10:36:08 +08:00
|
|
|
char * __stdcall getwinenveq (const char *name, size_t len, int)
|
|
|
|
__attribute__ ((regparm (3)));
|
2000-09-08 10:56:55 +08:00
|
|
|
|
|
|
|
void __stdcall update_envptrs ();
|
|
|
|
extern char **__cygwin_environ, ***main_environ;
|
|
|
|
extern "C" char __stdcall **cur_environ ();
|
2002-06-12 13:13:54 +08:00
|
|
|
char ** __stdcall build_env (const char * const *envp, char *&envblock,
|
2002-06-16 05:59:32 +08:00
|
|
|
int &envc, bool need_envblock)
|
|
|
|
__attribute__ ((regparm (3)));
|