diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 63a3856f5..2054f7989 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,7 +1,19 @@ -Sun Feb 18 21:31:00 2000 Corinna Vinschen +Sun Feb 20 22:10:21 2000 Christopher Faylor - * fhandler.cc (fhandler_disk_file::fstat): Modify get_file_attribute - return value if FILE_ATTRIBUTE_READONLY is set. + * environ.cc (getwinenv): Make __stdcall. + (winenv): Ditto. + * malloc.cc (strdup): New function. Occludes newlib version. + (_strdup_r): Ditto. + * winsup.h: Reflect above __stdcall changes. + +Sun Feb 20 21:31:00 2000 Corinna Vinschen + + * fhandler.cc (fhandler_disk_file::fstat): Modify get_file_attribute + return value if FILE_ATTRIBUTE_READONLY is set. + +Thu Feb 17 11:00:23 2000 Christopher Faylor + + * environ.cc (environ_init): Cosmetic change. Mon Feb 7 16:50:44 2000 Christopher Faylor diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index 249e95c99..e59802c81 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -72,7 +72,7 @@ win_env::add_cache (const char *in_posix, const char *in_native) * of the name including a mandatory '='. Returns a pointer to the * appropriate conversion structure. */ -win_env * +win_env * __stdcall getwinenv (const char *env, const char *in_posix) { for (int i = 0; conv_envvars[i].name != NULL; i++) @@ -153,8 +153,7 @@ my_findenv (const char *name, int *offset) * Returns ptr to value associated with name, if any, else NULL. */ -extern "C" -char * +extern "C" char * getenv (const char *name) { int offset; @@ -166,8 +165,7 @@ getenv (const char *name) * Sets an environment variable */ -extern "C" -int +extern "C" int putenv (const char *str) { register char *p, *equal; @@ -192,8 +190,7 @@ putenv (const char *str) * "value". If rewrite is set, replace any current value. */ -extern "C" -int +extern "C" int setenv (const char *name, const char *value, int rewrite) { register char *C; @@ -249,8 +246,7 @@ setenv (const char *name, const char *value, int rewrite) * Delete environment variable "name". */ -extern "C" -void +extern "C" void unsetenv (const char *name) { register char **P; @@ -490,7 +486,7 @@ environ_init (void) if (!sawTERM) envp[i++] = strdup ("TERM=cygwin"); envp[i] = NULL; - __cygwin_environ = *user_data->envptr = envp; + __cygwin_environ = environ = envp; FreeEnvironmentStringsA ((char *) rawenv); parse_options (NULL); MALLOC_CHECK; @@ -512,7 +508,7 @@ env_sort (const void *a, const void *b) * Converts environment variables noted in conv_envvars into win32 form * prior to placing them in the string. */ -char * +char * __stdcall winenv (const char * const *envp) { int len, n, tl; diff --git a/winsup/cygwin/malloc_wrapper.cc b/winsup/cygwin/malloc_wrapper.cc index aa4891b8e..b4babd901 100644 --- a/winsup/cygwin/malloc_wrapper.cc +++ b/winsup/cygwin/malloc_wrapper.cc @@ -74,7 +74,7 @@ _realloc_r (struct _reent *, void *p, size_t size) extern "C" char * strdup_dbg (const char *s, const char *file, int line) { - char *p; + char *p; export_malloc_called = 1; if ((p = (char *) malloc_dbg (strlen (s) + 1, file, line)) != NULL) strcpy (p, s); @@ -177,6 +177,22 @@ export_calloc (size_t nmemb, size_t size) return res; } +extern "C" char * +strdup (const char *s) +{ + char *p; + size_t len = strlen (s) + 1; + if ((p = (char *) malloc (len)) != NULL) + memcpy (p, s, len); + return p; +} + +extern "C" char * +_strdup_r (struct _reent *, const char *s) +{ + return strdup (s); +} + /* We use a critical section to lock access to the malloc data structures. This permits malloc to be called from different threads. Note that it does not make malloc reentrant, and it does diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 7b486d077..4bbf789f2 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -557,9 +557,9 @@ struct win_env const char * get_native () {return native ? native + namelen : NULL;} }; -win_env *getwinenv (const char *name, const char *posix = NULL); +win_env * __stdcall getwinenv (const char *name, const char *posix = NULL); -char *winenv (const char * const *); +char * __stdcall winenv (const char * const *); extern char **__cygwin_environ; /* The title on program start. */