Fixed the build under BeOS/Dano:

* setenv() actually exists in Dano.
* On R5, it now uses sprintf() - the previous version would not compile.
* Cleaned some weird code in TermBuffer.cpp to set the "buf" variable to the
  end of the string - it also no longer uses the index() BSD extension
  (same as strchr()).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21793 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-08-02 16:55:44 +00:00
parent 075430faf4
commit f328fdc455
3 changed files with 4 additions and 3 deletions
+2 -2
View File
@@ -86,7 +86,7 @@
/*
* Set environment variable.
*/
#if !defined(__HAIKU__) || defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST)
#if defined(HAIKU_TARGET_PLATFORM_BEOS) || defined(HAIKU_TARGET_PLATFORM_LIBBE_TEST)
extern char **environ;
@@ -102,7 +102,7 @@ setenv(const char *var, const char *value, bool overwrite)
/* found it */
if (overwrite) {
environ[envindex] = (char *)malloc((unsigned)len + val_len + 2);
snprintf(environ[envindex], "%s=%s", var, value);
sprintf(environ[envindex], "%s=%s", var, value);
}
return 0;
}
+1
View File
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
static bool sUsageRequested = false;
+1 -1
View File
@@ -200,7 +200,7 @@ TermBuffer::GetString(int row, int col, int num, uchar *buf,
if (ptr->attr != (ptr + 1)->attr)
return all_count;
buf = (uchar *)index((char *)buf, 0x00);
buf += strlen((char *)buf);
ptr++;
col++;