diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-04-15 20:10:32 +0000 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-04-15 20:10:32 +0000 |
commit | 69f6c9ae70ecfcbdb630dff8ee2a9a975d465eb6 (patch) | |
tree | e91b16b290e51ae29084cfb0d625984bd2861a96 /source/lib/replace/replace.c | |
parent | 2a8a9963b94dc51f1c5411cade72e8ac59a2f4f6 (diff) | |
download | samba-69f6c9ae70ecfcbdb630dff8ee2a9a975d465eb6.tar.gz samba-69f6c9ae70ecfcbdb630dff8ee2a9a975d465eb6.tar.xz samba-69f6c9ae70ecfcbdb630dff8ee2a9a975d465eb6.zip |
r22220: merge from samba4:
- libreplace unsetenv() and strptime() replacements
metze
Diffstat (limited to 'source/lib/replace/replace.c')
-rw-r--r-- | source/lib/replace/replace.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/source/lib/replace/replace.c b/source/lib/replace/replace.c index 8310d66d9e5..db299130e51 100644 --- a/source/lib/replace/replace.c +++ b/source/lib/replace/replace.c @@ -563,6 +563,32 @@ int rep_setenv(const char *name, const char *value, int overwrite) } #endif +#ifndef HAVE_UNSETENV +int rep_unsetenv(const char *name) +{ + extern char **environ; + size_t len = strlen(name); + size_t i; + int found = 0; + + for (i=0; (environ && environ[i]); i++) { + if (found) { + environ[i-1] = environ[i]; + continue; + } + + if (strncmp(environ[i], name, len) == 0 && environ[i][len] == '=') { + free(environ[i]); + environ[i] = NULL; + found = 1; + continue; + } + } + + return 0; +} +#endif + #ifndef HAVE_SOCKETPAIR int rep_socketpair(int d, int type, int protocol, int sv[2]) { |