home *** CD-ROM | disk | FTP | other *** search
-
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- #include <stdlib.h>
-
- int
- main(ac,av)
- int ac;
- char **av;
- {
- FILE *fp;
- int i = 0,r,v,f=0;
- char buff[100],*line[100],*p;
-
- if (ac == 2 && strcmp(av[1],"-v") == 0)
- f = 1;
- if (!(fp = fopen("sreg_version.i","r+"))) {
- puts("Unable to open input.");
- return 30;
- }
-
- while (fgets(buff,100,fp) == buff)
- line[i++] = strdup(buff);
- line[i] = NULL;
-
- fseek(fp,0,SEEK_SET);
- for (i = 0; line[i]; i++) {
- if (strncmp(line[i],"VERSION",7) == 0) {
- p = line[i];
- while (!isdigit(*p)) p++;
- v = atoi(p);
- if (f) {
- v++;
- sprintf(p,"%d\n",v);
- }
- } else
- if (strncmp(line[i],"REVISION",8) == 0) {
- p = line[i];
- while (!isdigit(*p)) p++;
- r = atoi(p)+1;
- if (f)
- r = 0;
- sprintf(p,"%d\n",r);
- }
- fputs(line[i],fp);
- }
- fclose(fp);
- if (!(fp = fopen("sreg_version.c","w"))) {
- puts("Unable to open c file.");
- return 10;
- }
- fprintf(fp,
- "\n\nconst __far char idString[] = \"sreglib %d.%d (\"__DATE__\")\\x0d\\x0a\";\n"
- ,v,r);
- fclose(fp);
- printf("Up to version %d.%d\n",v,r);
- return 0;
- }
-