home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_11_07 / 1107047a < prev    next >
Text File  |  1993-04-30  |  1KB  |  61 lines

  1. /*
  2.    revup.c
  3.    The Revision Control System
  4.  
  5.    Dwayne Phillips
  6.    1991
  7. */
  8.  
  9. #include "rcs.h"
  10.  
  11. main(argc, argv)
  12.    int argc;
  13.    char *argv[];
  14. {
  15.    char   rcs_name[80], source_name[80], string[80];
  16.    FILE   *output_file, *rcs_file;
  17.    int    leave_source = 0, one = 1, result, rev;
  18.    struct stat rcs_file_status;
  19.  
  20.    if(argc <  3   ||   argc > 3){
  21.       printf("\n\n\tusage: revup source-file #\n");
  22.       exit(1);
  23.    }
  24.    strcpy(source_name, argv[1]);
  25.    create_rcs_file_name(source_name, rcs_name);
  26.    rev = atoi(argv[2]);
  27.  
  28.    if((rcs_file = fopen(rcs_name, "r")) == '\0'){
  29.       printf("\nrevup>> "
  30.                "cannot open the rcs file >>%s<<",
  31.                rcs_name);
  32.       exit(-1);
  33.    }
  34.  
  35.   if((output_file = fopen("((((", "w")) == '\0'){
  36.       printf("\nrevup>> cannot open the temp file ((((");
  37.       exit(-1);
  38.    }
  39.  
  40.    get_header_lines(output_file, rev);
  41.    copy_latest_rcs_to_source(rcs_file, output_file);
  42.    sprintf(string, "%s", DELIMETER);
  43.    fputs(string, output_file);
  44.  
  45.    fseek(rcs_file, 0L, SEEK_SET);
  46.    while(fgets(string, 80, rcs_file)){
  47.       fputs(string, output_file);
  48.    }
  49.  
  50.    fclose(rcs_file);
  51.    fclose(output_file);
  52.  
  53.    sprintf(string, "copy (((( %s", rcs_name);
  54.    replace_slash(string);
  55.    system(string);
  56.    unlink("((((");
  57.  
  58. } /* ends main */
  59.  
  60.  
  61.