summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/putenv.c
diff options
context:
space:
mode:
authorMystery Man <unknown@mandriva.org>2004-07-15 06:27:30 +0000
committerMystery Man <unknown@mandriva.org>2004-07-15 06:27:30 +0000
commit9a047aaee6ce50ac6f4ed6f51f590764c4a8c4c2 (patch)
treeb5ddf2e127d03e3a0f8fbf0caded464da2ed447c /mdk-stage1/dietlibc/lib/putenv.c
parent416a326f1fc775511cf1eac2c04cca2a69d9961a (diff)
downloaddrakx-backup-do-not-use-9a047aaee6ce50ac6f4ed6f51f590764c4a8c4c2.tar
drakx-backup-do-not-use-9a047aaee6ce50ac6f4ed6f51f590764c4a8c4c2.tar.gz
drakx-backup-do-not-use-9a047aaee6ce50ac6f4ed6f51f590764c4a8c4c2.tar.bz2
drakx-backup-do-not-use-9a047aaee6ce50ac6f4ed6f51f590764c4a8c4c2.tar.xz
drakx-backup-do-not-use-9a047aaee6ce50ac6f4ed6f51f590764c4a8c4c2.zip
This commit was manufactured by cvs2svn to create tag 'V10_54mdk'.V10_54mdk
Diffstat (limited to 'mdk-stage1/dietlibc/lib/putenv.c')
-rw-r--r--mdk-stage1/dietlibc/lib/putenv.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/mdk-stage1/dietlibc/lib/putenv.c b/mdk-stage1/dietlibc/lib/putenv.c
deleted file mode 100644
index 448d59840..000000000
--- a/mdk-stage1/dietlibc/lib/putenv.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-int putenv(const char *string) {
- size_t len;
- int envc;
- int remove=0;
- char *tmp;
- const char **ep;
- char **newenv;
- static char **origenv;
- if (!origenv) origenv=environ;
- if (!(tmp=strchr(string,'='))) {
- len=strlen(string);
- remove=1;
- } else
- len=tmp-string+1;
- for (envc=0, ep=(const char**)environ; *ep; ++ep) {
- if (*string == **ep && !memcmp(string,*ep,len)) {
- if (remove) {
- for (; ep[1]; ++ep) ep[0]=ep[1];
- ep[0]=0;
- return 0;
- }
- *ep=string;
- return 0;
- }
- ++envc;
- }
- if (tmp) {
- newenv = (char**) realloc(environ==origenv?0:origenv,
- (envc+2)*sizeof(char*));
- if (!newenv) return -1;
- newenv[0]=(char*)string;
- memcpy(newenv+1,environ,(envc+1)*sizeof(char*));
- environ=newenv;
- }
- return 0;
-}