citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit 1c0fa58c0c73eda8e0f35423d35e488dd6b6deb9
parent fe95e47a75eeed55da573c5a4ed28e40fafcd3b6
Author: Kyle Milz <kyle@0x30.net>
Date:   Mon,  2 Jan 2017 16:13:52 -0700

src/wrap: fix up unix part

Diffstat:
Msrc/Jamfile | 2+-
Msrc/wrap.cc | 10+++++-----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/Jamfile b/src/Jamfile @@ -85,7 +85,7 @@ if $(NT) { # Link with the c++ compiler so that the matching c++ runtime library gets added # automatically. -LINK on citrun_inst citrun_gl citrun_gltest = $(C++) ; +LINK on citrun_wrap citrun_inst citrun_gl citrun_gltest = $(C++) ; # Create installation directories and setup quirky ../../citrun_inst links. diff --git a/src/wrap.cc b/src/wrap.cc @@ -16,6 +16,7 @@ #include <windows.h> #include <tchar.h> #else // _WIN32 +#include <err.h> #include <unistd.h> // execvp #endif // _WIN32 @@ -87,15 +88,14 @@ _tmain(int argc, TCHAR *argv[]) int main(int argc, char *argv[]) { - char path[PATH_MAX]; - if (argc < 2) usage(); - strlcpy(path, CITRUN_SHARE ":", PATH_MAX); - strlcat(path, getenv("PATH"), PATH_MAX); + std::stringstream path; + path << CITRUN_SHARE ":"; + path << getenv("PATH"); - if (setenv("PATH", path, 1)) + if (setenv("PATH", path.str().c_str(), 1)) err(1, "setenv"); argv[argc] = NULL;