diff options
Diffstat (limited to 'x2p/util.c')
-rw-r--r-- | x2p/util.c | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/x2p/util.c b/x2p/util.c index a7fdaea35d..aa8a7a3a7e 100644 --- a/x2p/util.c +++ b/x2p/util.c @@ -218,53 +218,3 @@ int a1,a2,a3,a4; fprintf(stderr,pat,a1,a2,a3,a4); } -static bool firstsetenv = TRUE; -extern char **environ; - -void -setenv(nam,val) -char *nam, *val; -{ - register int i=envix(nam); /* where does it go? */ - - if (!environ[i]) { /* does not exist yet */ - if (firstsetenv) { /* need we copy environment? */ - int j; -#ifndef lint - char **tmpenv = (char**) /* point our wand at memory */ - safemalloc((i+2) * sizeof(char*)); -#else - char **tmpenv = Null(char **); -#endif /* lint */ - - firstsetenv = FALSE; - for (j=0; j<i; j++) /* copy environment */ - tmpenv[j] = environ[j]; - environ = tmpenv; /* tell exec where it is now */ - } -#ifndef lint - else - environ = (char**) saferealloc((char*) environ, - (i+2) * sizeof(char*)); - /* just expand it a bit */ -#endif /* lint */ - environ[i+1] = Nullch; /* make sure it's null terminated */ - } - environ[i] = safemalloc(strlen(nam) + strlen(val) + 2); - /* this may or may not be in */ - /* the old environ structure */ - sprintf(environ[i],"%s=%s",nam,val);/* all that work just for this */ -} - -int -envix(nam) -char *nam; -{ - register int i, len = strlen(nam); - - for (i = 0; environ[i]; i++) { - if (strnEQ(environ[i],nam,len) && environ[i][len] == '=') - break; /* strnEQ must come first to avoid */ - } /* potential SEGV's */ - return i; -} |