setting environment variables differently for easy porting to mingw

This commit is contained in:
Axel Kohlmeyer
2013-10-06 14:17:21 +02:00
parent 5024d0ca3f
commit ea913a741e
3 changed files with 22 additions and 20 deletions

View File

@ -1005,9 +1005,16 @@ void Input::shell()
if (me == 0)
for (int i = 1; i < narg; i++) rmdir(arg[i]);
} else if (strcmp(arg[0],"setenv") == 0) {
if (narg != 3) error->all(FLERR,"Illegal shell setenv command");
setenv(arg[1],arg[2],1);
} else if (strcmp(arg[0],"putenv") == 0) {
if (narg < 2) error->all(FLERR,"Illegal shell putenv command");
for (int i = 1; i < narg; i++) {
char *ptr = strdup(arg[i]);
#ifdef _WIN32
if (ptr != NULL) _putenv(ptr);
#else
if (ptr != NULL) putenv(ptr);
#endif
}
// use work string to concat args back into one string separated by spaces
// invoke string in shell via system()