version 1.9, 2003/12/13 13:29:44 |
version 1.11, 2004/02/23 09:03:42 |
|
|
/* $OpenXM: OpenXM/src/kan96xx/Kan/shell.c,v 1.8 2003/12/05 07:05:24 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kan96xx/Kan/shell.c,v 1.10 2004/02/05 10:35:04 takayama Exp $ */ |
#include <stdio.h> |
#include <stdio.h> |
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#include <sys/stat.h> |
Line 173 struct object KoxWhich(struct object cmdo,struct objec |
|
Line 173 struct object KoxWhich(struct object cmdo,struct objec |
|
return(rob); |
return(rob); |
} |
} |
|
|
|
static int mysetenv(char *name, char *value, int overwrite); |
|
static int myunsetenv(char *name); |
|
static int mysetenv(char *name, char *value, int overwrite) { |
|
char *s; |
|
char *orig; |
|
s = (char *)getenv(name); |
|
if ((s == NULL) || overwrite) { |
|
s = (char *) mymalloc(strlen(name)+strlen(value)+5); |
|
if (s == 0) { fprintf(stderr,"No more memory.\n"); exit(10); } |
|
strcpy(s,name); |
|
strcat(s,"="); strcat(s,value); |
|
return(putenv(s)); |
|
} |
|
return (0); |
|
} |
|
|
|
/* bug on Solaris. It does not unsetenv. |
|
libc4, libc5, glibc. It does unsetenv. */ |
|
static myunsetenv(char *name) { |
|
return(putenv(name)); |
|
} |
|
|
/* Example. [(export) (PATH) (=) (/usr/new/bin:$PATH)] */ |
/* Example. [(export) (PATH) (=) (/usr/new/bin:$PATH)] */ |
static struct object oxsSetenv(struct object ob) { |
static struct object oxsSetenv(struct object ob) { |
struct object rob; |
struct object rob; |
Line 197 static struct object oxsSetenv(struct object ob) { |
|
Line 219 static struct object oxsSetenv(struct object ob) { |
|
/* printf("%s\n",new); */ |
/* printf("%s\n",new); */ |
new = oxEvalEnvVar(new); |
new = oxEvalEnvVar(new); |
/* printf("%s\n",new); */ |
/* printf("%s\n",new); */ |
r = setenv(envp,new,1); |
r = mysetenv(envp,new,1); |
}else{ |
}else{ |
unsetenv(envp); r = 0; |
myunsetenv(envp); r = 0; |
|
/* bug: On Solaris, unsetenv will not work. */ |
} |
} |
if (r != 0) errorKan1("%s\n","setenv failed."); |
if (r != 0) errorKan1("%s\n","setenv failed."); |
new = (char *) getenv(envp); |
new = (char *) getenv(envp); |