From 96309fc6e2439ede2604fc18ad04e82ffc54b606 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 12:28:33 -0500 Subject: [PATCH] Make TestsWorkingDirectory test a C file --- Tests/TestsWorkingDirectory/CMakeLists.txt | 2 +- .../{main.cxx => main.c} | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) rename Tests/TestsWorkingDirectory/{main.cxx => main.c} (68%) diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt index 24dc5e6687..01e665001f 100644 --- a/Tests/TestsWorkingDirectory/CMakeLists.txt +++ b/Tests/TestsWorkingDirectory/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 2.6) project(TestsWorkingDirectoryProj) -add_executable(WorkingDirectory main.cxx) +add_executable(WorkingDirectory main.c) enable_testing() diff --git a/Tests/TestsWorkingDirectory/main.cxx b/Tests/TestsWorkingDirectory/main.c similarity index 68% rename from Tests/TestsWorkingDirectory/main.cxx rename to Tests/TestsWorkingDirectory/main.c index 42c3d3446b..ad5eb30b8a 100644 --- a/Tests/TestsWorkingDirectory/main.cxx +++ b/Tests/TestsWorkingDirectory/main.c @@ -1,8 +1,7 @@ -#include -#include #include - -#include +#include +#include +#include #if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) @@ -14,12 +13,13 @@ #define _getcwd getcwd #endif -inline const char* Getcwd(char* buf, unsigned int len) +static const char* Getcwd(char* buf, unsigned int len) { const char* ret = _getcwd(buf, len); + char* p = NULL; if(!ret) { - std::cerr << "No current working directory." << std::endl; + fprintf(stderr, "No current working directory.\n"); abort(); } // make sure the drive letter is capital @@ -27,7 +27,7 @@ inline const char* Getcwd(char* buf, unsigned int len) { buf[0] = toupper(buf[0]); } - for(char* p = buf; *p; ++p) + for(p = buf; *p; ++p) { if(*p == '\\') { @@ -42,12 +42,12 @@ inline const char* Getcwd(char* buf, unsigned int len) #include #include -inline const char* Getcwd(char* buf, unsigned int len) +static const char* Getcwd(char* buf, unsigned int len) { const char* ret = getcwd(buf, len); if(!ret) { - std::cerr << "No current working directory" << std::endl; + fprintf(stderr, "No current working directory\n"); abort(); } return ret; @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) char buf[2048]; const char *cwd = Getcwd(buf, sizeof(buf)); - std::cout << "Working directory: -->" << cwd << "<--"; + fprintf(stdout, "Working directory: -->%s<--", cwd); return 0; }