#include #include int main(int argc, char **argv) { FILE *f; int major, minor, day, month, year; char tmp[1024]; char *format; if (argc != 2) { fprintf(stderr, "Usage: parse_version \n"); exit(2); } strcpy(tmp, argv[1]); strcat(tmp, "/../version.in"); f = fopen(tmp, "r"); if (f == NULL) { fprintf(stderr, "Cannot open %s\n", tmp); exit(2); } fscanf(f, "%d.%d,%d.%d.%d", &major, &minor, &day, &month, &year); fclose(f); format = "/*\n\ * version.h file. Automatically generated by parse_version.\n\ */\n\ \n\ #ifndef __VERSION_H__\n\ #define __VERSION_H__\n\ \n\ #define IXNET_NAME \"ixnet.library\"\n\ #define IXNET_IDSTRING \"ixnet %d.%d [%s] (%d.%d.%d)\"\n\ #define IXNET_VERSION %d\n\ #define IXNET_REVISION %d\n\ #define IXNET_PRIORITY 0\n\ \n\ #endif\n\ "; tmp[0] = '\0'; #ifdef NOTRAP if (tmp[0]) strcat(tmp, ", "); strcat(tmp, "notrap"); #endif #ifdef DEBUG_VERSION if (tmp[0]) strcat(tmp, ", "); strcat(tmp, "debug"); #endif if (tmp[0]) strcat(tmp, ", "); #if defined(CPU_604e) strcat(tmp, "604e"); #elif defined(CPU_603e) strcat(tmp, "603e"); #elif defined(mc68060) strcat(tmp, "68060"); #elif defined(mc68040) strcat(tmp, "68040"); #elif defined(mc68020) strcat(tmp, "68020"); #else strcat(tmp, "68000"); #endif #if defined(NATIVE_MORPHOS) strcat(tmp, ", morphos"); #else strcat(tmp, ", amigaos"); #endif printf(format, major, minor, tmp, day, month, year, major, minor); return 0; }