From ca4b4a52add51e44a47d7ed1f12e51dd3ee3cd69 Mon Sep 17 00:00:00 2001 From: grischka Date: Mon, 11 May 2009 18:53:52 +0200 Subject: [PATCH] fix build with msvc --- tcc.h | 5 +++-- win32/tools/tiny_libmaker.c | 21 ++++++--------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/tcc.h b/tcc.h index 7ee52829..be9c4ccb 100644 --- a/tcc.h +++ b/tcc.h @@ -42,9 +42,10 @@ #ifdef _WIN32 #include #include -#ifdef _MSC_VER +#include /* open, close etc. */ +#include /* getcwd */ #define inline __inline -#endif +#define inp next_inp #endif #ifndef _WIN32 diff --git a/win32/tools/tiny_libmaker.c b/win32/tools/tiny_libmaker.c index d45ec704..cf9ac67b 100644 --- a/win32/tools/tiny_libmaker.c +++ b/win32/tools/tiny_libmaker.c @@ -9,6 +9,9 @@ #include #include #include +#ifdef _WIN32 +#include /* for mktemp */ +#endif /* #include "ar-elf.h" */ /* "ar-elf.h" */ @@ -177,25 +180,13 @@ int main(int argc, char **argv) } } - //tfile[0] = '.'; tfile[1] = '/'; - //if (tmpnam(&tfile[2])) { strcpy(tfile, "./XXXXXX"); - if (mktemp(tfile)) + if (!mktemp(tfile) || (fo = fopen(tfile, "wb+")) == NULL) { - if ((fo = fopen(tfile, "wb+")) == NULL) - { - fprintf(stderr, "Can't open file %s \n", tfile); - return 2; - } - } - -/* - if ((fo = tmpfile()) == NULL) - { - fprintf(stderr, "Can't open temporary file \n"); + fprintf(stderr, "Can't open temporary file %s\n", tfile); return 2; } -*/ + if ((fh = fopen(afile, "wb")) == NULL) { fprintf(stderr, "Can't open file %s \n", afile); -- 2.11.4.GIT