Unified · Split
| @@ -42,9 +42,10 @@ · 41 unmodified lines | ||
| 42 | 42 | #ifdef _WIN32 |
| 43 | 43 | #include <windows.h> |
| 44 | 44 | #include <sys/timeb.h> |
| 45 | −#ifdef _MSC_VER | |
| 45 | +#include <io.h> /* open, close etc. */ | |
| 46 | +#include <direct.h> /* getcwd */ | |
| 46 | 47 | #define inline __inline |
| 47 | −#endif | |
| 48 | +#define inp next_inp | |
| 48 | 49 | #endif |
| 49 | 50 | |
| 50 | 51 | #ifndef _WIN32 |
| @@ -9,6 +9,9 @@ · 8 unmodified lines | ||
| 9 | 9 | #include <stdio.h> |
| 10 | 10 | #include <stdlib.h> |
| 11 | 11 | #include <string.h> |
| 12 | +#ifdef _WIN32 | |
| 13 | +#include <io.h> /* for mktemp */ | |
| 14 | +#endif | |
| 12 | 15 | |
| 13 | 16 | /* #include "ar-elf.h" */ |
| 14 | 17 | /* "ar-elf.h" */ |
| @@ -177,25 +180,13 @@ int main(int argc, char **argv) · 162 unmodified lines | ||
| 177 | 180 | } |
| 178 | 181 | } |
| 179 | 182 | |
| 180 | − //tfile[0] = '.'; tfile[1] = '/'; | |
| 181 | − //if (tmpnam(&tfile[2])) { | |
| 182 | 183 | strcpy(tfile, "./XXXXXX"); |
| 183 | − if (mktemp(tfile)) | |
| 184 | + if (!mktemp(tfile) || (fo = fopen(tfile, "wb+")) == NULL) | |
| 184 | 185 | { |
| 185 | − if ((fo = fopen(tfile, "wb+")) == NULL) | |
| 186 | − { | |
| 187 | − fprintf(stderr, "Can't open file %s \n", tfile); | |
| 188 | − return 2; | |
| 189 | − } | |
| 190 | − } | |
| 191 | − | |
| 192 | −/* | |
| 193 | − if ((fo = tmpfile()) == NULL) | |
| 194 | − { | |
| 195 | − fprintf(stderr, "Can't open temporary file \n"); | |
| 186 | + fprintf(stderr, "Can't open temporary file %s\n", tfile); | |
| 196 | 187 | return 2; |
| 197 | 188 | } |
| 198 | −*/ | |
| 189 | + | |
| 199 | 190 | if ((fh = fopen(afile, "wb")) == NULL) |
| 200 | 191 | { |
| 201 | 192 | fprintf(stderr, "Can't open file %s \n", afile); |