From d75bfedab59d325b72d575beac8844290de0c279 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 19 Apr 2007 12:11:16 -0400 Subject: [PATCH] COMP: Need to include header for unlink function. --- Source/kwsys/EncodeExecutable.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Source/kwsys/EncodeExecutable.c b/Source/kwsys/EncodeExecutable.c index d7c9a459b..712638b7c 100644 --- a/Source/kwsys/EncodeExecutable.c +++ b/Source/kwsys/EncodeExecutable.c @@ -52,6 +52,21 @@ int main(int argc, char* argv[]) fprintf(ofp, "#include \"kwsysPrivate.h\"\n"); fprintf(ofp, "#include KWSYS_HEADER(Configure.h)\n\n"); fprintf(ofp, "#include \n\n"); + fprintf(ofp, "#if defined(_WIN32)\n"); + fprintf(ofp, "# include \n"); + fprintf(ofp, "#else\n"); + fprintf(ofp, "# include \n"); + fprintf(ofp, "#endif\n"); + fprintf(ofp, "\n"); + fprintf(ofp, "static void kwsys_unlink(const char* fname)\n"); + fprintf(ofp, "{\n"); + fprintf(ofp, "#if defined(__WATCOMC__)\n"); + fprintf(ofp, " unlink(fname);\n"); + fprintf(ofp, "#else\n"); + fprintf(ofp, " _unlink(fname);\n"); + fprintf(ofp, "#endif\n"); + fprintf(ofp, "}\n"); + fprintf(ofp, "\n"); /* Split file up in 1024-byte chunks. */ while((n = (int)fread(buffer, 1, 1024, ifp)) > 0) @@ -78,9 +93,6 @@ int main(int argc, char* argv[]) fprintf(ofp, "extern %s_EXPORT int %sEncodedWriteArray%s(const char* fname)\n", argv[3], argv[3], argv[4]); fprintf(ofp, "{\n"); - fprintf(ofp, "#ifdef __WATCOMC__\n"); - fprintf(ofp, "#define _unlink unlink\n"); - fprintf(ofp, "#endif\n"); fprintf(ofp, " FILE* ofp = fopen(fname, \"wb\");\n"); fprintf(ofp, " if(!ofp) { return 0; }\n"); for(i=0; i < count; ++i) @@ -91,7 +103,7 @@ int main(int argc, char* argv[]) argv[4], i, argv[4], i, argv[4], i); fprintf(ofp, " {\n"); fprintf(ofp, " fclose(ofp);\n"); - fprintf(ofp, " _unlink(fname);\n"); + fprintf(ofp, " kwsys_unlink(fname);\n"); fprintf(ofp, " return 0;\n"); fprintf(ofp, " }\n"); }