From f328fdc455e42072a0909d2155b44bd4b6e375a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 2 Aug 2007 16:55:44 +0000 Subject: [PATCH] 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 --- src/apps/terminal/Shell.cpp | 4 ++-- src/apps/terminal/TermApp.cpp | 1 + src/apps/terminal/TermBuffer.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/apps/terminal/Shell.cpp b/src/apps/terminal/Shell.cpp index b90005d0ee..97906875cf 100644 --- a/src/apps/terminal/Shell.cpp +++ b/src/apps/terminal/Shell.cpp @@ -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; } diff --git a/src/apps/terminal/TermApp.cpp b/src/apps/terminal/TermApp.cpp index a6f887161b..d724bc97ec 100644 --- a/src/apps/terminal/TermApp.cpp +++ b/src/apps/terminal/TermApp.cpp @@ -25,6 +25,7 @@ #include #include +#include static bool sUsageRequested = false; diff --git a/src/apps/terminal/TermBuffer.cpp b/src/apps/terminal/TermBuffer.cpp index b816c3d9a7..1e7d3313f4 100644 --- a/src/apps/terminal/TermBuffer.cpp +++ b/src/apps/terminal/TermBuffer.cpp @@ -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++;