2002-11-12 02:07:20 +03:00
|
|
|
#include "DumpInformation.h"
|
2003-07-16 19:38:57 +04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/stat.h>
|
2002-11-12 02:07:20 +03:00
|
|
|
|
2003-07-16 19:38:57 +04:00
|
|
|
void cmDumpInformationPrintFile(const char* name, FILE* fout)
|
2002-11-12 02:07:20 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
fprintf(fout, "Avoid ctest truncation of output: CTEST_FULL_OUTPUT\n");
|
|
|
|
fprintf(
|
|
|
|
fout,
|
|
|
|
"================================================================\n");
|
2003-07-16 19:38:57 +04:00
|
|
|
struct stat fs;
|
2016-05-16 17:34:04 +03:00
|
|
|
if (stat(name, &fs) != 0) {
|
2003-07-16 19:38:57 +04:00
|
|
|
fprintf(fout, "The file \"%s\" does not exist.\n", name);
|
|
|
|
fflush(fout);
|
|
|
|
return;
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2003-08-05 23:20:48 +04:00
|
|
|
FILE* fin = fopen(name, "r");
|
2016-05-16 17:34:04 +03:00
|
|
|
if (fin) {
|
|
|
|
fprintf(
|
|
|
|
fout,
|
|
|
|
"Contents of \"%s\":\n"
|
|
|
|
"----------------------------------------------------------------\n",
|
|
|
|
name);
|
2003-07-16 19:38:57 +04:00
|
|
|
const int bufferSize = 4096;
|
|
|
|
char buffer[bufferSize];
|
|
|
|
int n;
|
2016-05-16 17:34:04 +03:00
|
|
|
while ((n = fread(buffer, 1, bufferSize, fin)) > 0) {
|
|
|
|
for (char* c = buffer; c < buffer + n; ++c) {
|
|
|
|
switch (*c) {
|
|
|
|
case '<':
|
|
|
|
fprintf(fout, "<");
|
|
|
|
break;
|
|
|
|
case '>':
|
|
|
|
fprintf(fout, ">");
|
|
|
|
break;
|
|
|
|
case '&':
|
|
|
|
fprintf(fout, "&");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
putc(*c, fout);
|
|
|
|
break;
|
2002-11-12 22:18:36 +03:00
|
|
|
}
|
2002-11-12 17:33:00 +03:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
fflush(fout);
|
2003-07-16 19:38:57 +04:00
|
|
|
}
|
2016-05-16 17:34:04 +03:00
|
|
|
fclose(fin);
|
|
|
|
} else {
|
2003-07-16 19:38:57 +04:00
|
|
|
fprintf(fout, "Error opening \"%s\" for reading.\n", name);
|
|
|
|
fflush(fout);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2002-11-12 02:07:20 +03:00
|
|
|
}
|
2003-03-17 16:25:45 +03:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
int main(int, char* [])
|
2003-03-17 16:25:45 +03:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
const char* files[] = {
|
|
|
|
DumpInformation_BINARY_DIR "/SystemInformation.out",
|
|
|
|
DumpInformation_BINARY_DIR "/AllVariables.txt",
|
|
|
|
DumpInformation_BINARY_DIR "/AllCommands.txt",
|
|
|
|
DumpInformation_BINARY_DIR "/AllMacros.txt",
|
|
|
|
DumpInformation_BINARY_DIR "/OtherProperties.txt",
|
|
|
|
DumpInformation_BINARY_DIR "/../../Source/cmConfigure.h",
|
|
|
|
DumpInformation_BINARY_DIR "/../../CMakeCache.txt",
|
|
|
|
DumpInformation_BINARY_DIR "/../../CMakeFiles/CMakeOutput.log",
|
|
|
|
DumpInformation_BINARY_DIR "/../../CMakeFiles/CMakeError.log",
|
|
|
|
DumpInformation_BINARY_DIR "/../../Bootstrap.cmk/cmake_bootstrap.log",
|
|
|
|
DumpInformation_BINARY_DIR "/../../Source/cmsys/Configure.hxx",
|
|
|
|
DumpInformation_BINARY_DIR "/../../Source/cmsys/Configure.h",
|
|
|
|
DumpInformation_BINARY_DIR "/CMakeFiles/CMakeOutput.log",
|
|
|
|
DumpInformation_BINARY_DIR "/CMakeFiles/CMakeError.log",
|
|
|
|
0
|
|
|
|
};
|
2003-07-16 19:38:57 +04:00
|
|
|
|
|
|
|
const char** f;
|
2016-05-16 17:34:04 +03:00
|
|
|
for (f = files; *f; ++f) {
|
2003-07-16 19:38:57 +04:00
|
|
|
cmDumpInformationPrintFile(*f, stdout);
|
2016-05-16 17:34:04 +03:00
|
|
|
}
|
2012-08-13 21:42:58 +04:00
|
|
|
|
2003-07-16 19:38:57 +04:00
|
|
|
return 0;
|
2012-08-13 21:42:58 +04:00
|
|
|
}
|