Removed dependence on unistd.h in project.c

Travis CI failed because system could not find unistd.h.
This commit is contained in:
Lew Rossman
2019-09-26 11:18:39 -04:00
parent da1253f4ea
commit f2ef979d95

View File

@@ -18,8 +18,8 @@
//*** For the Windows SDK _tempnam function ***// //*** For the Windows SDK _tempnam function ***//
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#else //#else
#include <unistd.h > //#include <unistd.h >
#endif #endif
#include "types.h" #include "types.h"
@@ -1093,11 +1093,17 @@ char *getTmpName(char *fname)
// --- for non-Windows systems: // --- for non-Windows systems:
#else #else
// --- use system function mkstemp() to create a temporary file name // --- use system function mkstemp() to create a temporary file name
/*
int f = -1; int f = -1;
strcpy(fname, "enXXXXXX"); strcpy(fname, "enXXXXXX");
f = mkstemp(fname); f = mkstemp(fname);
close(f); close(f);
remove(fname); remove(fname);
*/
strcpy(fname, "enXXXXXX");
FILE *f = fdopen(mkstemp(fname), "r");
fclose(f);
remove(fname);
#endif #endif
return fname; return fname;
} }