diff options
Diffstat (limited to 'x2p')
-rw-r--r-- | x2p/util.c | 50 | ||||
-rw-r--r-- | x2p/util.h | 2 |
2 files changed, 0 insertions, 52 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; -} diff --git a/x2p/util.h b/x2p/util.h index ef1cd04d04..f3ee2a0417 100644 --- a/x2p/util.h +++ b/x2p/util.h @@ -25,11 +25,9 @@ int makedir(); char * cpy2 _(( char *to, char *from, int delim )); char * cpytill _(( char *to, char *from, int delim )); int croak _(( char *pat, int a1, int a2, int a3, int a4 )); -int envix _(( char *nam )); void growstr _(( char **strptr, int *curlen, int newlen )); char * instr _(( char *big, char *little )); int Myfatal (); char * safecpy _(( char *to, char *from, int len )); char * savestr _(( char *str )); -void setenv _(( char *nam, char *val )); void warn (); |