fix build with msvc
This commit is contained in:
parent
03c787d6ce
commit
ca4b4a52ad
2 changed files with 9 additions and 17 deletions
5
tcc.h
5
tcc.h
|
@ -42,9 +42,10 @@
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <sys/timeb.h>
|
#include <sys/timeb.h>
|
||||||
#ifdef _MSC_VER
|
#include <io.h> /* open, close etc. */
|
||||||
|
#include <direct.h> /* getcwd */
|
||||||
#define inline __inline
|
#define inline __inline
|
||||||
#endif
|
#define inp next_inp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
|
|
@ -9,6 +9,9 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <io.h> /* for mktemp */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* #include "ar-elf.h" */
|
/* #include "ar-elf.h" */
|
||||||
/* "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");
|
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 temporary file %s\n", tfile);
|
||||||
{
|
|
||||||
fprintf(stderr, "Can't open file %s \n", tfile);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
if ((fo = tmpfile()) == NULL)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Can't open temporary file \n");
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
if ((fh = fopen(afile, "wb")) == NULL)
|
if ((fh = fopen(afile, "wb")) == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Can't open file %s \n", afile);
|
fprintf(stderr, "Can't open file %s \n", afile);
|
||||||
|
|
Loading…
Reference in a new issue