int status, len;
struct stat s;
char *scriptname;
+ int i;
cp();
#ifdef HAVE_PUTENV
/* Set environment */
- while(*envp)
- putenv(*envp++);
+ for(i = 0; envp[i]; i++)
+ putenv(envp[i]);
#endif
scriptname[len - 1] = '\"';
free(scriptname);
- /* Unset environment? */
+ /* Unset environment */
+
+ for(i = 0; envp[i]; i++) {
+ char *e = strchr(envp[i], '=');
+ if(e)
+ putenv(strndupa(envp[i], e - envp[i]));
+ }
#ifdef WEXITSTATUS
if(status != -1) {