aboutsummaryrefslogtreecommitdiff
path: root/win32/tools/tiny_libmaker.c
diff options
context:
space:
mode:
authorgrischka <grischka>2009-05-11 18:53:52 +0200
committergrischka <grischka>2009-05-11 18:53:52 +0200
commitca4b4a52add51e44a47d7ed1f12e51dd3ee3cd69 (patch)
treedb63e4e67c03b2916fd3091aba06a4a7c2d77461 /win32/tools/tiny_libmaker.c
parent03c787d6ce8dbd6a0898995c47309f33d7d3490e (diff)
downloadtinycc-ca4b4a52add51e44a47d7ed1f12e51dd3ee3cd69.tar.gz
tinycc-ca4b4a52add51e44a47d7ed1f12e51dd3ee3cd69.tar.bz2
fix build with msvc
Diffstat (limited to 'win32/tools/tiny_libmaker.c')
-rw-r--r--win32/tools/tiny_libmaker.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/win32/tools/tiny_libmaker.c b/win32/tools/tiny_libmaker.c
index d45ec70..cf9ac67 100644
--- a/win32/tools/tiny_libmaker.c
+++ b/win32/tools/tiny_libmaker.c
@@ -9,6 +9,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifdef _WIN32
+#include <io.h> /* 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);