home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pine / ccmd / incversion.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-19  |  1.1 KB  |  43 lines

  1. /*
  2.  Author: Howie Kaye
  3.  
  4.  Columbia University Center for Computing Activities, July 1986.
  5.  Copyright (C) 1986, 1987, Trustees of Columbia University in the City
  6.  of New York.  Permission is granted to any individual or institution
  7.  to use, copy, or redistribute this software so long as it is not sold
  8.  for profit, provided this copyright notice is retained.
  9. */
  10.  
  11. #include <stdio.h>
  12.  
  13. #define MAJSTRING "#define MAJORVERSION"
  14. #define MINSTRING "#define MINORVERSION"
  15. #define DATSTRING "#define VERSIONDATE"
  16.  
  17. char *ctime();
  18.  
  19. main(argc, argv) int argc; char **argv; {
  20.   int maj_len, min_len, dat_len;
  21.   char line[100];
  22.  
  23.   maj_len = strlen(MAJSTRING);
  24.   min_len = strlen(MINSTRING);
  25.   dat_len = strlen(DATSTRING);
  26.  
  27.   while(fgets(line, 100, stdin) != NULL) {
  28.     if (strncmp(line,MINSTRING,maj_len) == 0) {
  29.       int newversion = atoi(&line[min_len]) + 1;
  30.       fprintf(stdout, "#define MINORVERSION %d\n",newversion);
  31.     }
  32.     else if (strncmp(line,DATSTRING,dat_len) == 0) {
  33.       long t = time(0);
  34.       char *cp = ctime(&t);
  35.       cp[strlen(cp)-1] = '\0';
  36.       
  37.       fprintf(stdout, "#define VERSIONDATE \"%s\"\n", cp);
  38.     }
  39.     else 
  40.       fprintf(stdout,"%s",line);
  41.   }
  42. }
  43.