create C files with ".c" suffix

This commit is contained in:
Josh Holtrop 2018-05-20 16:16:46 -04:00
parent 6217665076
commit bd52a4c5d5

View File

@ -8,7 +8,7 @@
#include <string.h>
static char preprocessed_fname[] = "/tmp/cxlppXXXXXX";
static char c_fname[] = "/tmp/cxlcXXXXXX";
static char c_fname[] = "/tmp/cxlcXXXXXX.c";
static bool preprocessed_fname_created = false;
static bool c_fname_created = false;
@ -71,7 +71,7 @@ void write_node(FILE * file, Node * node)
bool emit_c(Node * node)
{
int fd = mkstemp(c_fname);
int fd = mkstemps(c_fname, 2);
if (fd < 0)
{
perror("mkstemp");
@ -94,7 +94,7 @@ bool compile()
}
else if (pid == 0)
{
execlp("gcc", "gcc", "-x", "c", "-c", c_fname, "-o", "out.o", NULL);
execlp("gcc", "gcc", "-c", c_fname, "-o", "out.o", NULL);
}
else
{