summaryrefslogtreecommitdiffstats
path: root/Tests/TestsWorkingDirectory
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2010-12-17 17:28:33 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2010-12-17 17:34:20 (GMT)
commit96309fc6e2439ede2604fc18ad04e82ffc54b606 (patch)
tree68bdee31c1ec85343ccf7d452e7e58db9668b74a /Tests/TestsWorkingDirectory
parenta4a5e375685adcfe765c45be086706720a96dbea (diff)
downloadCMake-96309fc6e2439ede2604fc18ad04e82ffc54b606.zip
CMake-96309fc6e2439ede2604fc18ad04e82ffc54b606.tar.gz
CMake-96309fc6e2439ede2604fc18ad04e82ffc54b606.tar.bz2
Make TestsWorkingDirectory test a C file
Diffstat (limited to 'Tests/TestsWorkingDirectory')
-rw-r--r--Tests/TestsWorkingDirectory/CMakeLists.txt2
-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;
}