Support emscripten for compiling spcomp (r=dvander).

This commit is contained in:
Asher Baker 2013-04-05 07:03:43 +01:00
parent c0c3fceaad
commit d5ec523584
2 changed files with 11 additions and 3 deletions

View File

@ -613,8 +613,14 @@ static void inst_datetime_defines(void)
time(&td);
curtime = localtime(&td);
#if defined EMSCRIPTEN
snprintf(date, sizeof(date), "\"%02d/%02d/%04d\"", curtime->tm_mon + 1, curtime->tm_mday, curtime->tm_year + 1900);
snprintf(ltime, sizeof(ltime), "\"%02d:%02d:%02d\"", curtime->tm_hour, curtime->tm_min, curtime->tm_sec);
#else
strftime(date, 31, "\"%m/%d/%Y\"", curtime);
strftime(ltime, 31, "\"%H:%M:%S\"", curtime);
#endif
insert_subst("__DATE__", date, 8);
insert_subst("__TIME__", ltime, 8);

View File

@ -16,8 +16,6 @@
*/
#include "getch.h"
#define strnicmp(a,b,c) strncasecmp(a,b,c)
/*
* WinWorld wants '\'. Unices do not.
*/
@ -30,7 +28,11 @@
* For Linux, we must overrule these settings with those defined in glibc.
*/
#if !defined __BYTE_ORDER
# include <stdlib.h>
# if defined EMSCRIPTEN
# include <endian.h>
# else
# include <stdlib.h>
# endif
#endif
#if defined __OpenBSD__ || defined __FreeBSD__ || defined __APPLE__