diff options
-rw-r--r-- | Tests/TestsWorkingDirectory/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Tests/TestsWorkingDirectory/main.c (renamed from Tests/TestsWorkingDirectory/main.cxx) | 20 |
2 files changed, 11 insertions, 11 deletions
diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt index 24dc5e6..01e6650 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 index 42c3d34..ad5eb30 100644 --- a/Tests/TestsWorkingDirectory/main.cxx +++ b/Tests/TestsWorkingDirectory/main.c @@ -1,8 +1,7 @@ -#include <cstdlib> -#include <cstring> #include <ctype.h> - -#include <iostream> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #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 <fcntl.h> #include <unistd.h> -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; } |