diff --git a/Changes b/Changes index 6008b4a03..3a960cca8 100644 --- a/Changes +++ b/Changes @@ -875,3 +875,4 @@ seen. gmtime warning still there - Fixed the Z:line bug (caused by stskeeps-on-crack coding) reported by Power2All - Removed the tokens for /users, /summon, and /samode (these never come from a server so they don't need it) +- Added a utility to auto create version.c for win32. It's the worst coding I've ever done, but it works :P diff --git a/makefile.win32 b/makefile.win32 index 3a4645bbe..2291448e0 100644 --- a/makefile.win32 +++ b/makefile.win32 @@ -47,17 +47,19 @@ MOD_FILES=SRC/L_COMMANDS.OBJ SRC/M_CHGHOST.OBJ SRC/M_SDESC.OBJ SRC/M_SETIDENT.OB SRC/SCAN.OBJ SRC/SCAN_SOCKS.OBJ SRC/SCAN_HTTP.OBJ -ALL: WIRCD.EXE +ALL: CONF WIRCD.EXE CLEAN: - -@erase src\*.exe 2>NUL - -@erase src\*.obj 2>NUL - -@erase src\win32.res 2>NUL - -@erase src\version.c 2>NUL - -@erase src\win32\*.obj 2>NUL - -@erase .\*.exe 2>NUL - + -@erase src\*.obj >NUL + -@erase src\win32.res >NUL + -@erase src\version.c >NUL + -@erase src\win32\*.obj >NUL + -@erase .\*.exe >NUL +CONF: + -@copy include\win32\setup.h include\setup.h >NUL + $(CC) src/win32/config.c + -@config.exe ./WIRCD.EXE: $(OBJ_FILES) $(MOD_FILES) SRC/win32/WIN32.RES $(LINK) $(LFLAGS) $(OBJ_FILES) $(MOD_FILES) SRC/win32/WIN32.RES SRC/WIN32/GNU_REGEX.LIB SRC/WIN32/DEBUG/STACKTRACE.LIB /MAPINFO:LINES /MAP diff --git a/src/win32/config.c b/src/win32/config.c new file mode 100644 index 000000000..0b84fe200 --- /dev/null +++ b/src/win32/config.c @@ -0,0 +1,78 @@ + +#include +#include +int main() { + FILE *fd = fopen("Changes", "r"); + FILE *fd2; + char buf[1024]; + int i = 0, space = 0, j = 0; + char releaseid[512]; + int generation = 0; + + if (!fd) { + return -1; + } + + while (fgets(buf, 1023, fd)) { + if (!strstr(buf, "Changes,v")) + continue; + else { + while (!isdigit(buf[i])) + i++; + j = i; + while (buf[j]) { + if (buf[j] == ' ') + space++; + if (space == 3) { + buf[j] = 0; + break; + } + j++; + } + strcpy(releaseid,&buf[i]); + } + } + fclose(fd); + i = 0; + fd = fopen("src/version.c", "r"); + if (!fd) + generation = 1; + else { + while (fgets(buf, 1023, fd)) { + if (!strstr(buf, "char *generation")) + continue; + while (!isdigit(buf[i])) + i++; + j = i; + while (isdigit(buf[j])) + j++; + buf[j] = 0; + generation = (atoi(&buf[i])+1); + } + } + fd = fopen("src/version.c.sh", "r"); + if (!fd) + return 0; + fd2 = fopen("src/version.c", "w"); + if (!fd2) + return 0; + while (fgets(buf, 1023, fd)) { + if (!strncmp("cat >version.c <