home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / rcs / sources / status.c < prev    next >
C/C++ Source or Header  |  1992-01-19  |  2KB  |  92 lines

  1. #ifndef lint
  2. static char rcsid[] = "$Id: status.c,v 1.13 89/11/19 23:40:44 berliner Exp $";
  3. #endif 
  4.  
  5. /*
  6.  *    Copyright (c) 1989, Brian Berliner
  7.  *
  8.  *    You may distribute under the terms of the GNU General Public License
  9.  *    as specified in the README file that comes with the CVS 1.0 kit.
  10.  *
  11.  * Status Information
  12.  *
  13.  *    Prints three lines of information for each of its arguments,
  14.  *    one for the user file (line 1), one for the newest RCS file
  15.  *    (line 3) and one for the RCS file both derive from (line 2).
  16.  */
  17.  
  18. #include "cvs.h"
  19.  
  20. status(argc, argv)
  21.     int argc;
  22.     char *argv[];
  23. {
  24.     register int i;
  25.     int c;
  26.     int long_format = 0;
  27.  
  28.     if (argc == -1)
  29.     status_usage();
  30.     optind = 1;
  31.     while ((c = getopt(argc, argv, "l")) != -1) {
  32.     switch (c) {
  33.     case 'l':
  34.         /*
  35.          * XXX - long format not done yet; should probably display
  36.          * other people that have checked out the current repository,
  37.          * or pieces thereof.
  38.          */
  39.         long_format = 1;
  40.         break;
  41.     case '?':
  42.     default:
  43.         status_usage();
  44.         break;
  45.     }
  46.     }
  47.     argc -= optind;
  48.     argv += optind;
  49.     Name_Repository();
  50.     if (long_format)
  51.     error(0, "long format status output not done yet");
  52.     if (argc == 0) {
  53.     Find_Names(&fileargc, fileargv, ALL);
  54.     argc = fileargc;
  55.     argv = fileargv;
  56.     }
  57.     for (i = 0; i < argc; i++) {
  58.     (void) strcpy(User, argv[i]);
  59.     Locate_RCS();
  60.     Version_TS(Rcs, Tag, User);
  61.     if (TS_User[0] == '\0') {
  62.         printf("File:\tno file %s\n", User);
  63.     } else {
  64.         printf("File:\t%s\n", User);
  65.     }
  66.     if (VN_User[0] == '\0') {
  67.         printf("From:\tno entry for %s\n", User);
  68.     } else if (VN_User[0] == '0' && VN_User[1] == '\0') {
  69.         printf("From:\tNew file!\n");
  70.     } else {
  71.         /*
  72.          * Only print the modification time
  73.          */
  74.         printf("From:\t%s\t%s\n", VN_User, &TS_Rcs[25]);
  75.     }
  76.     if (VN_Rcs[0] == '\0') {
  77.         printf("RCS:\tno %s\n", Rcs);
  78.     } else {
  79.         printf("RCS:\t%s\t%s\n", VN_Rcs, Rcs);
  80.     }
  81.     printf("\n");
  82.     }
  83.     exit(0);
  84. }
  85.  
  86. static
  87. status_usage()
  88. {
  89.     (void) fprintf(stderr, "Usage: %s %s [files...]\n", progname, command);
  90.     exit(1);
  91. }
  92.