From 11356b94e3e4794dcaf521adcd8c5979e3fb8cd2 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 27 Mar 2005 16:05:55 +0000 Subject: [PATCH] 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 --- src/tests/apps/miniterminal/MiniView.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tests/apps/miniterminal/MiniView.cpp b/src/tests/apps/miniterminal/MiniView.cpp index 134880d6b8..fce8cc4382 100644 --- a/src/tests/apps/miniterminal/MiniView.cpp +++ b/src/tests/apps/miniterminal/MiniView.cpp @@ -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; }