Fix Setenv to properly export TERM that commands like clear work too.

We use Setenv instead of the native setenv to stay binary compatible with
BeOS, as R5 does not have setenv.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12079 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2005-03-27 16:05:55 +00:00
parent fa78489457
commit 11356b94e3
+5 -4
View File
@@ -52,15 +52,16 @@ Setenv(const char *var, const char *value)
while (environ [envindex] != NULL) {
if (strncmp (environ [envindex], var, len) == 0) {
/* found it */
environ[envindex] = (char *)malloc ((unsigned)len + val_len + 1);
sprintf (environ [envindex], "%s%s", var, value);
// TODO: shouldn't we free the old variable first?
environ[envindex] = (char *)malloc ((unsigned)len + val_len + 2);
sprintf (environ [envindex], "%s=%s", var, value);
return;
}
envindex ++;
}
environ [envindex] = (char *) malloc ((unsigned)len + val_len + 1);
sprintf (environ [envindex], "%s%s", var, value);
environ [envindex] = (char *) malloc ((unsigned)len + val_len + 2);
sprintf (environ [envindex], "%s=%s", var, value);
environ [++envindex] = NULL;
}