diff --git a/src/project.c b/src/project.c index 349e6ed..76a863f 100644 --- a/src/project.c +++ b/src/project.c @@ -18,6 +18,8 @@ //*** For the Windows SDK _tempnam function ***// #ifdef _WIN32 #include +//#else +//#include #endif #include "types.h" @@ -853,8 +855,8 @@ void adjustpattern(int *pat, int index) **---------------------------------------------------------------- */ { - if (*pat == index) *pat = 0; - else if (*pat > index) (*pat)--; + if (*pat == index) *pat = 0; + else if (*pat > index) (*pat)--; } void adjustpatterns(Network *network, int index) @@ -1092,6 +1094,13 @@ void getTmpName(char *fname) // --- for non-Windows systems: #else // --- use system function mkstemp() to create a temporary file name +/* + int f = -1; + strcpy(fname, "enXXXXXX"); + f = mkstemp(fname); + close(f); + remove(fname); +*/ strcpy(fname, "enXXXXXX"); FILE *f = fdopen(mkstemp(fname), "r"); if (f == NULL) strcpy(fname, ""); @@ -1136,7 +1145,7 @@ char *xstrcpy(char **s1, const char *s2, const size_t n) if (n2 > n1) *s1 = realloc(*s1, (n2 + 1) * sizeof(char)); // Copy the source string into the destination string - strncpy(*s1, s2, n2); + strncpy(*s1, s2, n2+1); return *s1; }