home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / os2 / rcs / rcs56src / source / cvs / src / pc-files / patches.os2 < prev    next >
Encoding:
Text File  |  1992-02-23  |  109.2 KB  |  3,811 lines

  1. diff -cb orig/add.c src/add.c
  2. *** orig/add.c    Sun Feb 23 15:02:20 1992
  3. --- src/add.c    Sun Feb 23 17:06:38 1992
  4. ***************
  5. *** 1,6 ****
  6.   #ifndef lint
  7.   static char rcsid[] = "$Id: add.c,v 1.10 89/11/19 23:40:28 berliner Exp $";
  8. ! #endif !lint
  9.   
  10.   /*
  11.    *    Copyright (c) 1989, Brian Berliner
  12. --- 1,6 ----
  13.   #ifndef lint
  14.   static char rcsid[] = "$Id: add.c,v 1.10 89/11/19 23:40:28 berliner Exp $";
  15. ! #endif
  16.   
  17.   /*
  18.    *    Copyright (c) 1989, Brian Berliner
  19. ***************
  20. *** 28,34 ****
  21.    *    cause the file to be resurrected.
  22.    */
  23.   
  24. - #include <sys/param.h>
  25.   #include "cvs.h"
  26.   
  27.   add(argc, argv)
  28. --- 28,33 ----
  29. ***************
  30. *** 68,74 ****
  31.           err += add_directory(User);
  32.           continue;
  33.       }
  34. !     (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  35.       Version_TS(Rcs, Tag, User);
  36.       if (VN_User[0] == '\0') {
  37.           /*
  38. --- 67,73 ----
  39.           err += add_directory(User);
  40.           continue;
  41.       }
  42. !     (void) sprintf(Rcs, "%s%c%s%s", Repository, DIRSEP, User, RCSEXT);
  43.       Version_TS(Rcs, Tag, User);
  44.       if (VN_User[0] == '\0') {
  45.           /*
  46. ***************
  47. *** 171,181 ****
  48.       char cwd[MAXPATHLEN], rcsdir[MAXPATHLEN];
  49.       char message[MAXPATHLEN+100];
  50.   
  51. !     if (index(dir, '/') != NULL) {
  52.       warn(0, "directory %s not added; must be a direct sub-directory", dir);
  53.       return (1);
  54.       }
  55. !     if (strcmp(dir, CVSADM) == 0) {
  56.       warn(0, "cannot add a '%s' directory", CVSADM);
  57.       return (1);
  58.       }
  59. --- 170,180 ----
  60.       char cwd[MAXPATHLEN], rcsdir[MAXPATHLEN];
  61.       char message[MAXPATHLEN+100];
  62.   
  63. !     if (index_sep(dir) != NULL) {
  64.       warn(0, "directory %s not added; must be a direct sub-directory", dir);
  65.       return (1);
  66.       }
  67. !     if (stricmp(dir, CVSADM) == 0) {
  68.       warn(0, "cannot add a '%s' directory", CVSADM);
  69.       return (1);
  70.       }
  71. ***************
  72. *** 188,197 ****
  73.       return (1);
  74.       }
  75.       if (isfile(CVSADM)) {
  76. !     warn(0, "%s/%s already exists", dir, CVSADM);
  77.       goto out;
  78.       }
  79. !     (void) sprintf(rcsdir, "%s/%s", Repository, dir);
  80.       if (isfile(rcsdir) && !isdir(rcsdir)) {
  81.       warn(0, "%s is not a directory; %s not added", rcsdir, dir);
  82.       goto out;
  83. --- 187,196 ----
  84.       return (1);
  85.       }
  86.       if (isfile(CVSADM)) {
  87. !     warn(0, "%s%c%s already exists", dir, DIRSEP, CVSADM);
  88.       goto out;
  89.       }
  90. !     (void) sprintf(rcsdir, "%s%c%s", Repository, DIRSEP, dir);
  91.       if (isfile(rcsdir) && !isdir(rcsdir)) {
  92.       warn(0, "%s is not a directory; %s not added", rcsdir, dir);
  93.       goto out;
  94. ***************
  95. *** 202,208 ****
  96.       FILE *fptty;
  97.       char line[MAXLINELEN];
  98.   
  99. !     fptty = open_file("/dev/tty", "r");
  100.       printf("Add directory %s to the repository (y/n) [n] ? ", rcsdir);
  101.       (void) fflush(stdout);
  102.       if (fgets(line, sizeof(line), fptty) == NULL ||
  103. --- 201,207 ----
  104.       FILE *fptty;
  105.       char line[MAXLINELEN];
  106.   
  107. !     fptty = open_file(CONSOLE, "r");
  108.       printf("Add directory %s to the repository (y/n) [n] ? ", rcsdir);
  109.       (void) fflush(stdout);
  110.       if (fgets(line, sizeof(line), fptty) == NULL ||
  111. diff -cb orig/build_entry.c src/build_entry.c
  112. *** orig/build_entry.c    Sun Feb 23 15:02:20 1992
  113. --- src/build_entry.c    Sun Feb 23 18:08:22 1992
  114. ***************
  115. *** 1,6 ****
  116.   #ifndef lint
  117.   static char rcsid[] = "$Id: build_entry.c,v 1.9 89/11/19 23:19:45 berliner Exp $";
  118. ! #endif !lint
  119.   
  120.   /*
  121.    *    Copyright (c) 1989, Brian Berliner
  122. --- 1,6 ----
  123.   #ifndef lint
  124.   static char rcsid[] = "$Id: build_entry.c,v 1.9 89/11/19 23:19:45 berliner Exp $";
  125. ! #endif
  126.   
  127.   /*
  128.    *    Copyright (c) 1989, Brian Berliner
  129. ***************
  130. *** 16,22 ****
  131.    *    Returns non-zero on error.
  132.    */
  133.   
  134. - #include <sys/param.h>
  135.   #include "cvs.h"
  136.   
  137.   Build_Entry(message)
  138. --- 16,21 ----
  139. ***************
  140. *** 31,47 ****
  141.        * This is, perhaps, an awkward place to check for this, but
  142.        * other places are equally awkward.
  143.        */
  144. !     (void) sprintf(fname, "%s/%s/%s%s", Repository, CVSATTIC, User, RCSEXT);
  145.       if (isreadable(fname)) {
  146. !     warn(0, "there is an old file %s already in %s/%s", User,
  147. !          Repository, CVSATTIC);
  148.       return (1);
  149.       }
  150.       /*
  151.        * The options for the "add" command are store in the file CVS.adm/User,p
  152.        */
  153. !     (void) sprintf(fname, "%s/%s%s", CVSADM, User, CVSEXT_OPT);
  154. !     fp = open_file(fname, "w+");
  155.       if (fprintf(fp, "%s\n", Options) == EOF)
  156.       error(1, "cannot write %s", fname);
  157.       (void) fclose(fp);
  158. --- 30,49 ----
  159.        * This is, perhaps, an awkward place to check for this, but
  160.        * other places are equally awkward.
  161.        */
  162. !     (void) sprintf(fname, "%s%c%s%c%s%s",
  163. !                    Repository, DIRSEP, CVSATTIC, DIRSEP, User, RCSEXT);
  164.       if (isreadable(fname)) {
  165. !     warn(0, "there is an old file %s already in %s%c%s", User,
  166. !          Repository, DIRSEP, CVSATTIC);
  167.       return (1);
  168.       }
  169.       /*
  170.        * The options for the "add" command are store in the file CVS.adm/User,p
  171.        */
  172. !     (void) mkdir(CVSEXT_OPT, 0777);
  173. !     (void) sprintf(fname, "%s%c%s", CVSEXT_OPT, DIRSEP, User);
  174. !     if ((fp = open_file(fname, "w+")) == NULL)
  175. !     error(1, "cannot write %s", fname);
  176.       if (fprintf(fp, "%s\n", Options) == EOF)
  177.       error(1, "cannot write %s", fname);
  178.       (void) fclose(fp);
  179. ***************
  180. *** 51,63 ****
  181.        * user specified the -m option to add, and it is not necessary to
  182.        * query him from the terminal.
  183.        */
  184. !     (void) sprintf(fname, "%s/%s%s", CVSADM, User, CVSEXT_LOG);
  185. !     fp = open_file(fname, "w+");
  186.       if (message[0] == '\0') {
  187.       printf("RCS file: %s\n", Rcs);
  188.       printf("enter description, terminated with ^D or '.':\n");
  189.       printf("NOTE: This is NOT the log message!\n");
  190. !     fptty = open_file("/dev/tty", "r");
  191.       for (;;) {
  192.           printf(">> ");
  193.           (void) fflush(stdout);
  194. --- 53,67 ----
  195.        * user specified the -m option to add, and it is not necessary to
  196.        * query him from the terminal.
  197.        */
  198. !     (void) mkdir(CVSEXT_LOG, 0777);
  199. !     (void) sprintf(fname, "%s%c%s", CVSEXT_LOG, DIRSEP, User);
  200. !     if ((fp = open_file(fname, "w+")) == NULL)
  201. !     error(1, "cannot write %s", fname);
  202.       if (message[0] == '\0') {
  203.       printf("RCS file: %s\n", Rcs);
  204.       printf("enter description, terminated with ^D or '.':\n");
  205.       printf("NOTE: This is NOT the log message!\n");
  206. !     fptty = open_file(CONSOLE, "r");
  207.       for (;;) {
  208.           printf(">> ");
  209.           (void) fflush(stdout);
  210. diff -cb orig/checkin.c src/checkin.c
  211. *** orig/checkin.c    Sun Feb 23 15:02:22 1992
  212. --- src/checkin.c    Sun Feb 23 19:10:54 1992
  213. ***************
  214. *** 1,6 ****
  215.   #ifndef lint
  216.   static char rcsid[] = "$Id: checkin.c,v 1.10 89/11/19 23:19:46 berliner Exp $";
  217. ! #endif !lint
  218.   
  219.   /*
  220.    *    Copyright (c) 1989, Brian Berliner
  221. --- 1,6 ----
  222.   #ifndef lint
  223.   static char rcsid[] = "$Id: checkin.c,v 1.10 89/11/19 23:19:46 berliner Exp $";
  224. ! #endif 
  225.   
  226.   /*
  227.    *    Copyright (c) 1989, Brian Berliner
  228. ***************
  229. *** 19,25 ****
  230.    *    Returns non-zero on error.
  231.    */
  232.   
  233. - #include <sys/param.h>
  234.   #include <ctype.h>
  235.   #include "cvs.h"
  236.   
  237. --- 19,24 ----
  238. ***************
  239. *** 44,51 ****
  240.       printf("Checking in %s;\n", User);
  241.       if (!use_editor)
  242.       printf("Log: %s\n", message);
  243. !     (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  244. !     (void) sprintf(fname, "%s/%s%s", CVSADM, CVSPREFIX, User);
  245.       /*
  246.        * Move the user file to a backup file, so as to preserve its
  247.        * modification times, then place a copy back in the original
  248. --- 43,51 ----
  249.       printf("Checking in %s;\n", User);
  250.       if (!use_editor)
  251.       printf("Log: %s\n", message);
  252. !     (void) fflush(stdout);
  253. !     (void) sprintf(Rcs, "%s%c%s%s", Repository, DIRSEP, User, RCSEXT);
  254. !     (void) sprintf(fname, "%s%c%s%s", CVSADM, DIRSEP, CVSPREFIX, User);
  255.       /*
  256.        * Move the user file to a backup file, so as to preserve its
  257.        * modification times, then place a copy back in the original
  258. ***************
  259. *** 53,59 ****
  260.        */
  261.       rename_file(User, fname);
  262.       copy_file(fname, User);
  263. !     (void) sprintf(prog, "%s/%s -f %s %s", Rcsbin, RCS_CI, revision, Rcs);
  264.       if ((fp = popen(prog, "w")) == NULL) {
  265.       err++;
  266.       } else {
  267. --- 53,59 ----
  268.        */
  269.       rename_file(User, fname);
  270.       copy_file(fname, User);
  271. !     (void) sprintf(prog, "%s -f %s %s", RCS_CI, revision, Rcs);
  272.       if ((fp = popen(prog, "w")) == NULL) {
  273.       err++;
  274.       } else {
  275. ***************
  276. *** 69,75 ****
  277.        * to leave the newly checkout file as the user file and remove
  278.        * the old original user file.
  279.        */
  280. !     (void) sprintf(prog, "%s/%s -q %s %s", Rcsbin, RCS_CO, revision, Rcs);
  281.       (void) system(prog);
  282.       xchmod(User, 1);        /* make it writable */
  283.       if (xcmp(User, fname) == 0)
  284. --- 69,75 ----
  285.        * to leave the newly checkout file as the user file and remove
  286.        * the old original user file.
  287.        */
  288. !     (void) sprintf(prog, "%s -q %s %s", RCS_CO, revision, Rcs);
  289.       (void) system(prog);
  290.       xchmod(User, 1);        /* make it writable */
  291.       if (xcmp(User, fname) == 0)
  292. ***************
  293. *** 94,100 ****
  294.        */
  295.       rename_file(fname, User);
  296.       warn(0, "could not check in %s", User);
  297. !     (void) sprintf(prog, "%s/%s -u %s", Rcsbin, RCS, Rcs);
  298.       if (system(prog) != 0)
  299.           warn(0, "could not UNlock %s", Rcs);
  300.       restore_branch();
  301. --- 94,100 ----
  302.        */
  303.       rename_file(fname, User);
  304.       warn(0, "could not check in %s", User);
  305. !     (void) sprintf(prog, "%s -u %s", RCS, Rcs);
  306.       if (system(prog) != 0)
  307.           warn(0, "could not UNlock %s", Rcs);
  308.       restore_branch();
  309. ***************
  310. *** 106,112 ****
  311.        * wrong branch, so to be sure, we do an extra unlock here
  312.        * before returning.
  313.        */
  314. !     (void) sprintf(prog, "%s/%s -q -u %s 2>%s", Rcsbin, RCS, Rcs, DEVNULL);
  315.       (void) system(prog);
  316.       }
  317.       return (0);
  318. --- 106,112 ----
  319.        * wrong branch, so to be sure, we do an extra unlock here
  320.        * before returning.
  321.        */
  322. !     (void) sprintf(prog, "%s -q -u %s 2>%s", RCS, Rcs, DEVNULL);
  323.       (void) system(prog);
  324.       }
  325.       return (0);
  326. ***************
  327. *** 137,148 ****
  328.           user--;
  329.       *cp++ = '\0';
  330.       if (strcmp(User, user) == 0) {
  331. !         (void) sprintf(prog, "%s/%s -q -b%s %s", Rcsbin, RCS,
  332. !                cp, Rcs);
  333.           if (system(prog) != 0)
  334.           warn(0, "cannot restore default branch %s for %s",
  335.                cp, Rcs);
  336. !         return;
  337.       }
  338.       }
  339.   }
  340. --- 137,147 ----
  341.           user--;
  342.       *cp++ = '\0';
  343.       if (strcmp(User, user) == 0) {
  344. !         (void) sprintf(prog, "%s -q -b%s %s", RCS, cp, Rcs);
  345.           if (system(prog) != 0)
  346.           warn(0, "cannot restore default branch %s for %s",
  347.                cp, Rcs);
  348. !         return 0;
  349.       }
  350.       }
  351.   }
  352. diff -cb orig/checkout.c src/checkout.c
  353. *** orig/checkout.c    Sun Feb 23 15:02:22 1992
  354. --- src/checkout.c    Sun Jan 19 22:05:02 1992
  355. ***************
  356. *** 1,6 ****
  357.   #ifndef lint
  358.   static char rcsid[] = "$Id: checkout.c,v 1.19 89/11/19 23:40:30 berliner Exp $";
  359. ! #endif !lint
  360.   
  361.   /*
  362.    *    Copyright (c) 1989, Brian Berliner
  363. --- 1,6 ----
  364.   #ifndef lint
  365.   static char rcsid[] = "$Id: checkout.c,v 1.19 89/11/19 23:40:30 berliner Exp $";
  366. ! #endif 
  367.   
  368.   /*
  369.    *    Copyright (c) 1989, Brian Berliner
  370. ***************
  371. *** 56,63 ****
  372.    *    the repository is moved, e.g.)
  373.    */
  374.   
  375. - #include <sys/param.h>
  376. - #include <ndbm.h>
  377.   #include "cvs.h"
  378.   
  379.   extern int update_prune_dirs;
  380. --- 56,61 ----
  381. ***************
  382. *** 136,142 ****
  383.       char *cp;
  384.   
  385.       (void) strcpy(path, dir);
  386. !     for (cp = path; (slash = index(cp, '/')) != NULL; cp = slash+1) {
  387.       *slash = '\0';
  388.       (void) mkdir(cp, 0777);
  389.       if (chdir(cp) < 0) {
  390. --- 134,140 ----
  391.       char *cp;
  392.   
  393.       (void) strcpy(path, dir);
  394. !     for (cp = path; (slash = index_sep(cp)) != NULL; cp = slash+1) {
  395.       *slash = '\0';
  396.       (void) mkdir(cp, 0777);
  397.       if (chdir(cp) < 0) {
  398. ***************
  399. *** 144,155 ****
  400.           return (1);
  401.       }
  402.       if (!isfile(CVSADM)) {
  403. !         (void) sprintf(Repository, "%s/%s", CVSroot, path);
  404.           Create_Admin(Repository, DFLT_RECORD);
  405.           fp = open_file(CVSADM_ENTSTAT, "w+");
  406.           (void) fclose(fp);
  407.       }
  408. !     *slash = '/';
  409.       }
  410.       (void) mkdir(cp, 0777);
  411.       if (chdir(cp) < 0) {
  412. --- 142,153 ----
  413.           return (1);
  414.       }
  415.       if (!isfile(CVSADM)) {
  416. !         (void) sprintf(Repository, "%s%c%s", CVSroot, DIRSEP, path);
  417.           Create_Admin(Repository, DFLT_RECORD);
  418.           fp = open_file(CVSADM_ENTSTAT, "w+");
  419.           (void) fclose(fp);
  420.       }
  421. !     *slash = DIRSEP;
  422.       }
  423.       (void) mkdir(cp, 0777);
  424.       if (chdir(cp) < 0) {
  425. diff -cb orig/collect_sets.c src/collect_sets.c
  426. *** orig/collect_sets.c    Sun Feb 23 15:02:22 1992
  427. --- src/collect_sets.c    Sun Jan 19 22:20:26 1992
  428. ***************
  429. *** 1,6 ****
  430.   #ifndef lint
  431.   static char rcsid[] = "$Id: collect_sets.c,v 1.15.1.1 91/01/29 07:16:13 berliner Exp $";
  432. ! #endif !lint
  433.   
  434.   /*
  435.    *    Copyright (c) 1989, Brian Berliner
  436. --- 1,6 ----
  437.   #ifndef lint
  438.   static char rcsid[] = "$Id: collect_sets.c,v 1.15.1.1 91/01/29 07:16:13 berliner Exp $";
  439. ! #endif 
  440.   
  441.   /*
  442.    *    Copyright (c) 1989, Brian Berliner
  443. ***************
  444. *** 27,33 ****
  445.    *    Returns non-zero on error.
  446.    */
  447.   
  448. - #include <sys/param.h>
  449.   #include "cvs.h"
  450.   
  451.   extern char update_dir[];
  452. --- 27,32 ----
  453. ***************
  454. *** 48,60 ****
  455.       for (i = 0; i < argc; i++) {
  456.       (void) strcpy(User, argv[i]);
  457.       if (update_dir[0] != '\0')
  458. !         (void) sprintf(update_user, "%s/%s", update_dir, User);
  459.       else
  460.           (void) strcpy(update_user, User);
  461.       if (force_tag_match && (Tag[0] != '\0' || Date[0] != '\0'))
  462.           Locate_RCS();
  463.       else
  464. !         (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  465.       if (isdir(User)) {        /* just a directory -- add to Dlist */
  466.           (void) strcat(Dlist, " ");
  467.           (void) strcat(Dlist, User);
  468. --- 47,59 ----
  469.       for (i = 0; i < argc; i++) {
  470.       (void) strcpy(User, argv[i]);
  471.       if (update_dir[0] != '\0')
  472. !         (void) sprintf(update_user, "%s%c%s", update_dir, DIRSEP, User);
  473.       else
  474.           (void) strcpy(update_user, User);
  475.       if (force_tag_match && (Tag[0] != '\0' || Date[0] != '\0'))
  476.           Locate_RCS();
  477.       else
  478. !         (void) sprintf(Rcs, "%s%c%s%s", Repository, DIRSEP, User, RCSEXT);
  479.       if (isdir(User)) {        /* just a directory -- add to Dlist */
  480.           (void) strcat(Dlist, " ");
  481.           (void) strcat(Dlist, User);
  482. diff -cb orig/commit.c src/commit.c
  483. *** orig/commit.c    Sun Feb 23 15:02:24 1992
  484. --- src/commit.c    Sun Feb 23 19:10:24 1992
  485. ***************
  486. *** 1,6 ****
  487.   #ifndef lint
  488.   static char rcsid[] = "$Id: commit.c,v 1.28.1.2 91/01/29 07:16:59 berliner Exp $";
  489. ! #endif !lint
  490.   
  491.   /*
  492.    *    Copyright (c) 1989, Brian Berliner
  493. --- 1,6 ----
  494.   #ifndef lint
  495.   static char rcsid[] = "$Id: commit.c,v 1.28.1.2 91/01/29 07:16:59 berliner Exp $";
  496. ! #endif 
  497.   
  498.   /*
  499.    *    Copyright (c) 1989, Brian Berliner
  500. ***************
  501. *** 31,39 ****
  502.    *    like to commit.
  503.    */
  504.   
  505. - #include <sys/param.h>
  506.   #include <sys/types.h>
  507.   #include <sys/stat.h>
  508.   #include <ctype.h>
  509.   #include "cvs.h"
  510.   
  511. --- 31,39 ----
  512.    *    like to commit.
  513.    */
  514.   
  515.   #include <sys/types.h>
  516.   #include <sys/stat.h>
  517. + #include <fcntl.h>
  518.   #include <ctype.h>
  519.   #include "cvs.h"
  520.   
  521. ***************
  522. *** 55,62 ****
  523. --- 55,64 ----
  524.       /*
  525.        * For log purposes, do not allow "root" to commit files
  526.        */
  527. + #ifndef OS2
  528.       if (geteuid() == 0)
  529.       error(0, "cannot commit files as 'root'");
  530. + #endif
  531.       optind = 1;
  532.       while ((c = getopt(argc, argv, "fnam:r:")) != -1) {
  533.       switch (c) {
  534. ***************
  535. *** 106,112 ****
  536.       register int i;
  537.       FILE *fptty;
  538.   
  539. !     fptty = open_file("/dev/tty", "r");
  540.       printf("WARNING:\n");
  541.       printf("\tCommitting with a specific revision number\n");
  542.       printf("\tbypasses all consistency checks.  Are you abosulutely\n");
  543. --- 108,114 ----
  544.       register int i;
  545.       FILE *fptty;
  546.   
  547. !     fptty = open_file(CONSOLE, "r");
  548.       printf("WARNING:\n");
  549.       printf("\tCommitting with a specific revision number\n");
  550.       printf("\tbypasses all consistency checks.  Are you abosulutely\n");
  551. ***************
  552. *** 217,223 ****
  553.           }
  554.       }
  555.       if (first == 0) {
  556. !         FILE *fptty = open_file("/dev/tty", "r");
  557.           printf("\tAre you sure you want to continue (y/n) [n] ? ");
  558.           (void) fflush(stdout);
  559.           if (fgets(line, sizeof(line), fptty) == NULL ||
  560. --- 219,225 ----
  561.           }
  562.       }
  563.       if (first == 0) {
  564. !         FILE *fptty = open_file(CONSOLE, "r");
  565.           printf("\tAre you sure you want to continue (y/n) [n] ? ");
  566.           (void) fflush(stdout);
  567.           if (fgets(line, sizeof(line), fptty) == NULL ||
  568. ***************
  569. *** 235,241 ****
  570.       (void) strcpy(line, Mlist);
  571.       for (cp = strtok(line, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  572.       (void) strcpy(User, cp);
  573. !     (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  574.       if (lock_RCS(rev) != 0)
  575.           err++;
  576.       }
  577. --- 237,243 ----
  578.       (void) strcpy(line, Mlist);
  579.       for (cp = strtok(line, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  580.       (void) strcpy(User, cp);
  581. !     (void) sprintf(Rcs, "%s%c%s%s", Repository, DIRSEP, User, RCSEXT);
  582.       if (lock_RCS(rev) != 0)
  583.           err++;
  584.       }
  585. ***************
  586. *** 245,251 ****
  587.       (void) strcpy(line, Rlist);
  588.       for (cp = strtok(line, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  589.       (void) strcpy(User, cp);
  590. !     (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  591.       if (lock_RCS(rev) != 0)
  592.           err++;
  593.       }
  594. --- 247,253 ----
  595.       (void) strcpy(line, Rlist);
  596.       for (cp = strtok(line, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  597.       (void) strcpy(User, cp);
  598. !     (void) sprintf(Rcs, "%s%c%s%s", Repository, DIRSEP, User, RCSEXT);
  599.       if (lock_RCS(rev) != 0)
  600.           err++;
  601.       }
  602. ***************
  603. *** 255,264 ****
  604.       (void) strcpy(line, Alist);
  605.       for (cp = strtok(line, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  606.       (void) strcpy(User, cp);
  607. !     (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  608. !     (void) sprintf(prog, "%s/%s -i -t%s/%s%s", Rcsbin, RCS, CVSADM,
  609. !                        User, CVSEXT_LOG);
  610. !     (void) sprintf(fname, "%s/%s%s", CVSADM, User, CVSEXT_OPT);
  611.       fp = open_file(fname, "r");
  612.       while (fgets(fname, sizeof(fname), fp) != NULL) {
  613.           if ((cp = rindex(fname, '\n')) != NULL)
  614. --- 257,265 ----
  615.       (void) strcpy(line, Alist);
  616.       for (cp = strtok(line, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  617.       (void) strcpy(User, cp);
  618. !     (void) sprintf(Rcs, "%s%c%s%s", Repository, DIRSEP, User, RCSEXT);
  619. !     (void) sprintf(prog, "%s -i -t%s%c%s", RCS, CVSEXT_LOG, DIRSEP, User);
  620. !     (void) sprintf(fname, "%s%c%s", CVSEXT_OPT, DIRSEP, User);
  621.       fp = open_file(fname, "r");
  622.       while (fgets(fname, sizeof(fname), fp) != NULL) {
  623.           if ((cp = rindex(fname, '\n')) != NULL)
  624. ***************
  625. *** 287,294 ****
  626.       for (cp = strtok(Llist, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  627.           didllist = 1;
  628.           (void) strcpy(User, cp);
  629. !         (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  630. !         (void) sprintf(prog, "%s/%s -q -u %s", Rcsbin, RCS, Rcs);
  631.           if (system(prog) != 0)
  632.           warn(0, "could not UNlock %s", Rcs);
  633.       }
  634. --- 288,295 ----
  635.       for (cp = strtok(Llist, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  636.           didllist = 1;
  637.           (void) strcpy(User, cp);
  638. !         (void) sprintf(Rcs, "%s%c%s%s", Repository, DIRSEP, User, RCSEXT);
  639. !         (void) sprintf(prog, "%s -q -u %s", RCS, Rcs);
  640.           if (system(prog) != 0)
  641.           warn(0, "could not UNlock %s", Rcs);
  642.       }
  643. ***************
  644. *** 298,306 ****
  645.               continue;
  646.           *branch++ = '\0';
  647.           (void) strcpy(User, cp);
  648. !         (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  649. !         (void) sprintf(prog, "%s/%s -q -b%s %s", Rcsbin, RCS,
  650. !                    branch, Rcs);
  651.           if (system(prog) != 0)
  652.               warn(0, "could not restore branch %s to %s", branch, Rcs);
  653.           }
  654. --- 299,306 ----
  655.               continue;
  656.           *branch++ = '\0';
  657.           (void) strcpy(User, cp);
  658. !         (void) sprintf(Rcs, "%s%c%s%s", Repository, DIRSEP, User, RCSEXT);
  659. !         (void) sprintf(prog, "%s -q -b%s %s", RCS, branch, Rcs);
  660.           if (system(prog) != 0)
  661.               warn(0, "could not restore branch %s to %s", branch, Rcs);
  662.           }
  663. ***************
  664. *** 307,313 ****
  665.       }
  666.       for (cp = strtok(Alist, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  667.           (void) strcpy(User, cp);
  668. !         (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  669.           (void) unlink(Rcs);
  670.       }
  671.       Lock_Cleanup(0);
  672. --- 307,313 ----
  673.       }
  674.       for (cp = strtok(Alist, " \t"); cp; cp = strtok((char *)NULL, " \t")) {
  675.           (void) strcpy(User, cp);
  676. !         (void) sprintf(Rcs, "%s%c%s%s", Repository, DIRSEP, User, RCSEXT);
  677.           (void) unlink(Rcs);
  678.       }
  679.       Lock_Cleanup(0);
  680. ***************
  681. *** 337,346 ****
  682.           (void) strcpy(User, cp);
  683.           if (Checkin(revision, message) != 0)
  684.           err++;
  685. !         (void) sprintf(fname, "%s/%s%s", CVSADM, User, CVSEXT_OPT);
  686.           (void) unlink(fname);
  687. !         (void) sprintf(fname, "%s/%s%s", CVSADM, User, CVSEXT_LOG);
  688.           (void) unlink(fname);
  689.       }
  690.       }
  691.       /*
  692. --- 337,348 ----
  693.           (void) strcpy(User, cp);
  694.           if (Checkin(revision, message) != 0)
  695.           err++;
  696. !         (void) sprintf(fname, "%s%c%s", CVSEXT_OPT, DIRSEP, User);
  697.           (void) unlink(fname);
  698. !         (void) rmdir(CVSEXT_OPT);
  699. !         (void) sprintf(fname, "%s%c%s", CVSEXT_LOG, DIRSEP, User);
  700.           (void) unlink(fname);
  701. +         (void) rmdir(CVSEXT_LOG);
  702.       }
  703.       }
  704.       /*
  705. ***************
  706. *** 368,381 ****
  707.       int omask;
  708.   
  709.       (void) strcpy(User, cp);
  710. !     (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  711. !     (void) sprintf(fname, "%s/%s", Repository, CVSATTIC);
  712.       omask = umask(2);
  713.       (void) mkdir(fname, 0777);
  714.       (void) umask(omask);
  715. !     (void) sprintf(fname, "%s/%s/%s%s", Repository, CVSATTIC,
  716. !                User, RCSEXT);
  717. !     (void) sprintf(prog, "%s/%s -u -q %s", Rcsbin, RCS, Rcs);
  718.       if ((system(prog) == 0 && rename(Rcs, fname) != -1) ||
  719.           (!isreadable(Rcs) && isreadable(fname)))
  720.           Scratch_Entry(User);
  721. --- 370,383 ----
  722.       int omask;
  723.   
  724.       (void) strcpy(User, cp);
  725. !     (void) sprintf(Rcs, "%s%c%s%s", Repository, DIRSEP, User, RCSEXT);
  726. !     (void) sprintf(fname, "%s%c%s", Repository, DIRSEP, CVSATTIC);
  727.       omask = umask(2);
  728.       (void) mkdir(fname, 0777);
  729.       (void) umask(omask);
  730. !     (void) sprintf(fname, "%s%c%s%c%s%s", Repository, DIRSEP, CVSATTIC,
  731. !                DIRSEP, User, RCSEXT);
  732. !     (void) sprintf(prog, "%s -u -q %s", RCS, Rcs);
  733.       if ((system(prog) == 0 && rename(Rcs, fname) != -1) ||
  734.           (!isreadable(Rcs) && isreadable(fname)))
  735.           Scratch_Entry(User);
  736. ***************
  737. *** 411,427 ****
  738.       if (numdots(rev) < 2) {
  739.       branch_number(Rcs, branch);
  740.       if (branch[0] != '\0') {
  741. !         (void) sprintf(prog, "%s/%s -q -b %s", Rcsbin, RCS, Rcs);
  742.           if (system(prog) != 0) {
  743.           warn(0, "cannot change branch to default for %s", Rcs);
  744.           return (1);
  745.           }
  746.       }
  747. !     (void) sprintf(prog, "%s/%s -q -l %s", Rcsbin, RCS, Rcs);
  748.       err = system(prog);
  749.       } else {
  750. !     (void) sprintf(prog, "%s/%s -q -l%s %s 2>%s",
  751. !                Rcsbin, RCS, rev, Rcs, DEVNULL);
  752.       (void) system(prog);
  753.       }
  754.       if (err == 0) {
  755. --- 413,428 ----
  756.       if (numdots(rev) < 2) {
  757.       branch_number(Rcs, branch);
  758.       if (branch[0] != '\0') {
  759. !         (void) sprintf(prog, "%s -q -b %s", RCS, Rcs);
  760.           if (system(prog) != 0) {
  761.           warn(0, "cannot change branch to default for %s", Rcs);
  762.           return (1);
  763.           }
  764.       }
  765. !     (void) sprintf(prog, "%s -q -l %s", RCS, Rcs);
  766.       err = system(prog);
  767.       } else {
  768. !     (void) sprintf(prog, "%s -q -l%s %s 2>%s", RCS, rev, Rcs, DEVNULL);
  769.       (void) system(prog);
  770.       }
  771.       if (err == 0) {
  772. ***************
  773. *** 436,442 ****
  774.       return (0);
  775.       }
  776.       if (branch[0] != '\0') {
  777. !     (void) sprintf(prog, "%s/%s -q -b%s %s", Rcsbin, RCS, branch, Rcs);
  778.       if (system(prog) != 0)
  779.           warn(0, "cannot restore branch to %s for %s", branch, Rcs);
  780.       }
  781. --- 437,443 ----
  782.       return (0);
  783.       }
  784.       if (branch[0] != '\0') {
  785. !     (void) sprintf(prog, "%s -q -b%s %s", RCS, branch, Rcs);
  786.       if (system(prog) != 0)
  787.           warn(0, "cannot restore branch to %s for %s", branch, Rcs);
  788.       }
  789. ***************
  790. *** 462,485 ****
  791.       fp = open_file(rcs, "r");
  792.       if (fgets(line, sizeof(line), fp) == NULL) {
  793.       (void) fclose(fp);
  794. !     return;
  795.       }
  796.       if (fgets(line, sizeof(line), fp) == NULL) {
  797.       (void) fclose(fp);
  798. !     return;
  799.       }
  800.       (void) fclose(fp);
  801.       if (strncmp(line, RCSBRANCH, sizeof(RCSBRANCH) - 1) != 0 ||
  802.       !isspace(line[sizeof(RCSBRANCH) - 1]) ||
  803.       (cp = rindex(line, ';')) == NULL)
  804. !     return;
  805.       *cp = '\0';                /* strip the ';' */
  806.       if ((cp = rindex(line, ' ')) == NULL &&
  807.       (cp = rindex(line, '\t')) == NULL)
  808. !     return;
  809.       cp++;
  810. !     if (*cp == NULL)
  811. !     return;
  812.       (void) strcpy(branch, cp);
  813.   }
  814.   
  815. --- 463,486 ----
  816.       fp = open_file(rcs, "r");
  817.       if (fgets(line, sizeof(line), fp) == NULL) {
  818.       (void) fclose(fp);
  819. !     return 0;
  820.       }
  821.       if (fgets(line, sizeof(line), fp) == NULL) {
  822.       (void) fclose(fp);
  823. !     return 0;
  824.       }
  825.       (void) fclose(fp);
  826.       if (strncmp(line, RCSBRANCH, sizeof(RCSBRANCH) - 1) != 0 ||
  827.       !isspace(line[sizeof(RCSBRANCH) - 1]) ||
  828.       (cp = rindex(line, ';')) == NULL)
  829. !     return 0;
  830.       *cp = '\0';                /* strip the ';' */
  831.       if ((cp = rindex(line, ' ')) == NULL &&
  832.       (cp = rindex(line, '\t')) == NULL)
  833. !     return 0;
  834.       cp++;
  835. !     if (*cp == 0)
  836. !     return 0;
  837.       (void) strcpy(branch, cp);
  838.   }
  839.   
  840. ***************
  841. *** 594,608 ****
  842.   
  843.       if (CVSroot == NULL) {
  844.       warn(0, "CVSROOT variable not set; no log message will be sent");
  845. !     return;
  846.       }
  847. !     (void) sprintf(logfile, "%s/%s", CVSroot, CVSROOTADM_LOGINFO);
  848.       if ((fp_info = fopen(logfile, "r")) == NULL) {
  849.       warn(0, "warning: cannot open %s", logfile);
  850. !     return;
  851.       }
  852.       if (CVSroot != NULL)
  853. !     (void) sprintf(path, "%s/", CVSroot);
  854.       else
  855.       (void) strcpy(path, REPOS_STRIP);
  856.       if (strncmp(repository, path, strlen(path)) == 0)
  857. --- 595,609 ----
  858.   
  859.       if (CVSroot == NULL) {
  860.       warn(0, "CVSROOT variable not set; no log message will be sent");
  861. !     return 0;
  862.       }
  863. !     (void) sprintf(logfile, "%s%c%s", CVSroot, DIRSEP, CVSROOTADM_LOGINFO);
  864.       if ((fp_info = fopen(logfile, "r")) == NULL) {
  865.       warn(0, "warning: cannot open %s", logfile);
  866. !     return 0;
  867.       }
  868.       if (CVSroot != NULL)
  869. !     (void) sprintf(path, "%s%c", CVSroot, DIRSEP);
  870.       else
  871.       (void) strcpy(path, REPOS_STRIP);
  872.       if (strncmp(repository, path, strlen(path)) == 0)
  873. ***************
  874. *** 673,679 ****
  875.    */
  876.   #ifndef MAXHOSTNAMELEN
  877.   #define    MAXHOSTNAMELEN    64
  878. ! #endif !MAXHOSTNAMELEN
  879.   
  880.   /*
  881.    * Writes some stuff to the logfile "filter" and returns the status of the
  882. --- 674,680 ----
  883.    */
  884.   #ifndef MAXHOSTNAMELEN
  885.   #define    MAXHOSTNAMELEN    64
  886. ! #endif
  887.   
  888.   /*
  889.    * Writes some stuff to the logfile "filter" and returns the status of the
  890. diff -cb orig/create_admin.c src/create_admin.c
  891. *** orig/create_admin.c    Sun Feb 23 15:02:24 1992
  892. --- src/create_admin.c    Sun Jan 19 22:28:30 1992
  893. ***************
  894. *** 1,6 ****
  895.   #ifndef lint
  896.   static char rcsid[] = "$Id: create_admin.c,v 1.7 89/11/19 23:19:55 berliner Exp $";
  897. ! #endif !lint
  898.   
  899.   /*
  900.    *    Copyright (c) 1989, Brian Berliner
  901. --- 1,6 ----
  902.   #ifndef lint
  903.   static char rcsid[] = "$Id: create_admin.c,v 1.7 89/11/19 23:19:55 berliner Exp $";
  904. ! #endif 
  905.   
  906.   /*
  907.    *    Copyright (c) 1989, Brian Berliner
  908. ***************
  909. *** 15,21 ****
  910.    *    argument.
  911.    */
  912.   
  913. - #include <sys/param.h>
  914.   #include "cvs.h"
  915.   
  916.   Create_Admin(repository, initrecord)
  917. --- 15,20 ----
  918. ***************
  919. *** 37,43 ****
  920.       if (CVSroot != NULL) {
  921.       char path[MAXPATHLEN];
  922.   
  923. !     (void) sprintf(path, "%s/", CVSroot);
  924.       if (strncmp(repository, path, strlen(path)) == 0)
  925.           cp = repository + strlen(path);
  926.       }
  927. --- 36,42 ----
  928.       if (CVSroot != NULL) {
  929.       char path[MAXPATHLEN];
  930.   
  931. !     (void) sprintf(path, "%s%c", CVSroot, DIRSEP);
  932.       if (strncmp(repository, path, strlen(path)) == 0)
  933.           cp = repository + strlen(path);
  934.       }
  935. diff -cb orig/cvs.h src/cvs.h
  936. *** orig/cvs.h    Sun Feb 23 15:02:26 1992
  937. --- src/cvs.h    Sun Feb 23 19:11:28 1992
  938. ***************
  939. *** 1,8 ****
  940.   /*    $Id: cvs.h,v 1.24.1.1 91/01/18 12:13:48 berliner Exp $    */
  941.   
  942. - #include <strings.h>
  943.   #include <string.h>
  944.   #include <stdio.h>
  945.   
  946.   /*
  947.    *    Copyright (c) 1989, Brian Berliner
  948. --- 1,30 ----
  949.   /*    $Id: cvs.h,v 1.24.1.1 91/01/18 12:13:48 berliner Exp $    */
  950.   
  951.   #include <string.h>
  952.   #include <stdio.h>
  953. + #include <time.h>
  954. + #include <direct.h>
  955. + #include "ndbm.h"
  956. + #include "regex.h"
  957. + #ifdef OS2
  958. + /* OS/2 can generally use / too, but not in some places when commands
  959. +  * are passed to CMD.EXE for execution (i.e. I/O redirection). */
  960. + #define DIRSEP           '\\'
  961. + #define DIRSEPSTR        "\\"
  962. + #define ISDIRSEP(c)      ((c) == DIRSEP || (c) == '/')
  963. + extern char *index_sep(char *);
  964. + extern char *rindex_sep(char *);
  965. + #define system(c)        (flushall(),system(c))
  966. + #else
  967. + #define DIRSEP           '/'
  968. + #define DIRSEPSTR        "/"
  969. + #define ISDIRSEP(c)      ((c) == DIRSEP)
  970. + #define index_sep(p)     index(p, DIRSEP)
  971. + #define rindex_sep(p)    rindex(p, DIRSEP)
  972. + #define stricmp          strcmp
  973. + #define strnicmp         strncmp
  974. + #endif
  975.   
  976.   /*
  977.    *    Copyright (c) 1989, Brian Berliner
  978. ***************
  979. *** 15,27 ****
  980.    * the names a simple task.
  981.    */
  982.   #define    CVSADM        "CVS.adm"
  983.   #define    CVSADM_ENT    "CVS.adm/Entries"
  984. ! #define    CVSADM_ENTBAK    "CVS.adm/Entries.Backup"
  985. ! #define    CVSADM_ENTSTAT    "CVS.adm/Entries.Static"
  986.   #define    CVSADM_FILE    "CVS.adm/Files"
  987.   #define    CVSADM_MOD    "CVS.adm/Mod"
  988. ! #define    CVSADM_REP    "CVS.adm/Repository"
  989. ! #define    CVSADM_CIPROG    "CVS.adm/Checkin.prog"
  990.   
  991.   /*
  992.    * Definitions for the CVSROOT Administrative directory and
  993. --- 37,52 ----
  994.    * the names a simple task.
  995.    */
  996.   #define    CVSADM        "CVS.adm"
  997. + #define    CVSEXT_OPT    "CVS.opt"
  998. + #define    CVSEXT_LOG    "CVS.log"
  999.   #define    CVSADM_ENT    "CVS.adm/Entries"
  1000. ! #define    CVSADM_ENTBAK    "CVS.adm/Entries.Bak"
  1001. ! #define    CVSADM_ENTSTAT    "CVS.adm/Entries.Sta"
  1002.   #define    CVSADM_FILE    "CVS.adm/Files"
  1003.   #define    CVSADM_MOD    "CVS.adm/Mod"
  1004. ! #define    CVSADM_REP    "CVS.adm/Reposit.ory"
  1005. ! #define    CVSADM_CIPROG    "CVS.adm/Checkin.prg"
  1006.   
  1007.   /*
  1008.    * Definitions for the CVSROOT Administrative directory and
  1009. ***************
  1010. *** 36,64 ****
  1011.   
  1012.   /* support for the CVSROOTADM files */
  1013.   #define    CVSMODULE_FILE    "modules" /* last component of CVSROOTADM_MODULES */
  1014. ! #define    CVSMODULE_TMP    ".#modules.XXXXXX"
  1015.   #define    CVSMODULE_OPTS    "ai:o:t:"
  1016.   #define    CVSLOGINFO_FILE    "loginfo" /* last component of CVSROOTADM_LOGINFO */
  1017. ! #define    CVSLOGINFO_TMP    ".#loginfo.XXXXXX"
  1018.   
  1019.   /* Other CVS file names */
  1020.   #define    CVSATTIC    "Attic"
  1021. ! #define    CVSLCK        "#cvs.lock"
  1022. ! #define    CVSTFL        "#cvs.tfl"
  1023. ! #define    CVSRFL        "#cvs.rfl"
  1024. ! #define    CVSWFL        "#cvs.wfl"
  1025. ! #define    CVSEXT_OPT    ",p"
  1026. ! #define    CVSEXT_LOG    ",t"
  1027. ! #define    CVSPREFIX    ",,"
  1028. ! #define    CVSTEMP        "/tmp/cvslog.XXXXXX"
  1029.   
  1030.   /* miscellaneous CVS defines */
  1031.   #define    CVSEDITPREFIX    "CVS: "
  1032.   #define    CVSLCKAGE    600        /* 10-min old lock files cleaned up */
  1033.   #define    CVSLCKSLEEP    15        /* wait 15 seconds before retrying */
  1034. ! #define    DFLT_RECORD    "/dev/null"
  1035. ! #define    BAKPREFIX    ".#"        /* when rcsmerge'ing */
  1036. ! #define    DEVNULL        "/dev/null"
  1037.   
  1038.   #define    FALSE        0
  1039.   #define    TRUE        1
  1040. --- 61,89 ----
  1041.   
  1042.   /* support for the CVSROOTADM files */
  1043.   #define    CVSMODULE_FILE    "modules" /* last component of CVSROOTADM_MODULES */
  1044. ! #define    CVSMODULE_TMP    "#mXXXXXX"
  1045.   #define    CVSMODULE_OPTS    "ai:o:t:"
  1046.   #define    CVSLOGINFO_FILE    "loginfo" /* last component of CVSROOTADM_LOGINFO */
  1047. ! #define    CVSLOGINFO_TMP    "#lXXXXXX"
  1048.   
  1049.   /* Other CVS file names */
  1050.   #define    CVSATTIC    "Attic"
  1051. ! #define    CVSLCK        "#cvs_lck"
  1052. ! #define    CVSTFL        "#tfl"
  1053. ! #define    CVSRFL        "#rfl"
  1054. ! #define    CVSWFL        "#wfl"
  1055. ! #define    CVSPREFIX    ""
  1056. ! #define    CVSTEMP        "#cXXXXXX"
  1057.   
  1058.   /* miscellaneous CVS defines */
  1059.   #define    CVSEDITPREFIX    "CVS: "
  1060.   #define    CVSLCKAGE    600        /* 10-min old lock files cleaned up */
  1061.   #define    CVSLCKSLEEP    15        /* wait 15 seconds before retrying */
  1062. ! #define    DFLT_RECORD    "nul"
  1063. ! #define    BAKPREFIX    "#"
  1064. ! #define    DEVNULL        "nul"
  1065. ! #define CONSOLE         "con"  /* or "/dev/tty" */
  1066.   
  1067.   #define    FALSE        0
  1068.   #define    TRUE        1
  1069. ***************
  1070. *** 73,80 ****
  1071.   #define    RCS_DIFF    "rcsdiff"
  1072.   #define    RCS_MERGE    "rcsmerge"
  1073.   #define    RCS_MERGE_PAT    "^>>>>>>> "    /* runs "grep" with this pattern */
  1074. ! #define    RCSID_PAT    "'\\$Id.*\\$'"    /* when committing files */
  1075. ! #define    RCSEXT        ",v"
  1076.   #define    RCSHEAD        "head"
  1077.   #define    RCSBRANCH    "branch"
  1078.   #define    RCSSYMBOL    "symbols"
  1079. --- 98,105 ----
  1080.   #define    RCS_DIFF    "rcsdiff"
  1081.   #define    RCS_MERGE    "rcsmerge"
  1082.   #define    RCS_MERGE_PAT    "^>>>>>>> "    /* runs "grep" with this pattern */
  1083. ! #define    RCSID_PAT    "\"\\$Id.*\\$\""    /* when committing files */
  1084. ! #define    RCSEXT          Rcsext
  1085.   #define    RCSHEAD        "head"
  1086.   #define    RCSBRANCH    "branch"
  1087.   #define    RCSSYMBOL    "symbols"
  1088. ***************
  1089. *** 83,92 ****
  1090.   #define    DATEFORM    "%02d.%02d.%02d.%02d.%02d.%02d"
  1091.   
  1092.   /* Programs that cvs runs */
  1093. ! #define    DIFF        "/bin/diff"
  1094. ! #define    GREP        "/bin/grep"
  1095. ! #define    RM        "/bin/rm"
  1096. ! #define    SORT        "/usr/bin/sort"
  1097.   
  1098.   /*
  1099.    * Environment variable used by CVS
  1100. --- 108,117 ----
  1101.   #define    DATEFORM    "%02d.%02d.%02d.%02d.%02d.%02d"
  1102.   
  1103.   /* Programs that cvs runs */
  1104. ! #define    DIFF        "diff"
  1105. ! #define    GREP        "grep"
  1106. ! #define    RM        "rm"
  1107. ! #define    SORT        "sort"
  1108.   
  1109.   /*
  1110.    * Environment variable used by CVS
  1111. ***************
  1112. *** 94,104 ****
  1113.   #define    CVSREAD_ENV    "CVSREAD"    /* make files read-only */
  1114.   #define    CVSREAD_DFLT    FALSE        /* writable files by default */
  1115.   
  1116.   #define    RCSBIN_ENV    "RCSBIN"    /* RCS binary directory */
  1117. ! #define    RCSBIN_DFLT    "/usr/local/bin" /* directory to find RCS progs */
  1118.   
  1119.   #define    EDITOR_ENV    "EDITOR"    /* which editor to use */
  1120. ! #define    EDITOR_DFLT    "/usr/ucb/vi"    /* somewhat standard */
  1121.   
  1122.   #define    CVSROOT_ENV    "CVSROOT"    /* source directory root */
  1123.   #define    CVSROOT_DFLT    NULL        /* No dflt; must set for checkout */
  1124. --- 119,133 ----
  1125.   #define    CVSREAD_ENV    "CVSREAD"    /* make files read-only */
  1126.   #define    CVSREAD_DFLT    FALSE        /* writable files by default */
  1127.   
  1128. + #define    TMPDIR_ENV    "TMP"        /* temp directory */
  1129. + #define    TMPDIR_DFLT    ""        /* directory to put temp files into */
  1130.   #define    RCSBIN_ENV    "RCSBIN"    /* RCS binary directory */
  1131. ! #define    RCSBIN_DFLT    "/bin"        /* directory to find RCS progs */
  1132. ! #define    RCSINIT_ENV    "RCSINIT"    /* RCS option settings */
  1133.   
  1134.   #define    EDITOR_ENV    "EDITOR"    /* which editor to use */
  1135. ! #define    EDITOR_DFLT    "emacs"     /* somewhat standard */
  1136.   
  1137.   #define    CVSROOT_ENV    "CVSROOT"    /* source directory root */
  1138.   #define    CVSROOT_DFLT    NULL        /* No dflt; must set for checkout */
  1139. ***************
  1140. *** 116,125 ****
  1141.    * This is mainly for sizing arrays statically rather than
  1142.    * dynamically.  3000 seems plenty for now.
  1143.    */
  1144. ! #define    MAXFILEPERDIR    3000
  1145.   #define    MAXLINELEN    1000        /* max input line from a file */
  1146.   #define    MAXPROGLEN    30000        /* max program length to system() */
  1147. ! #define    MAXLISTLEN    20000        /* For [A-Z]list holders */
  1148.   #define    MAXMESGLEN    1000        /* max RCS log message size */
  1149.   
  1150.   /*
  1151. --- 145,154 ----
  1152.    * This is mainly for sizing arrays statically rather than
  1153.    * dynamically.  3000 seems plenty for now.
  1154.    */
  1155. ! #define    MAXFILEPERDIR    1000
  1156.   #define    MAXLINELEN    1000        /* max input line from a file */
  1157.   #define    MAXPROGLEN    30000        /* max program length to system() */
  1158. ! #define    MAXLISTLEN    10000        /* For [A-Z]list holders */
  1159.   #define    MAXMESGLEN    1000        /* max RCS log message size */
  1160.   
  1161.   /*
  1162. ***************
  1163. *** 135,141 ****
  1164.   extern char User[], Repository[], SRepository[], Rcs[];
  1165.   extern char VN_User[], VN_Rcs[], TS_User[], TS_Rcs[];
  1166.   extern char Options[], Tag[], Date[], prog[];
  1167. ! extern char *Rcsbin, *Editor, *CVSroot;
  1168.   extern int really_quiet, quiet;
  1169.   extern int use_editor;
  1170.   extern int cvswrite;
  1171. --- 164,170 ----
  1172.   extern char User[], Repository[], SRepository[], Rcs[];
  1173.   extern char VN_User[], VN_Rcs[], TS_User[], TS_Rcs[];
  1174.   extern char Options[], Tag[], Date[], prog[];
  1175. ! extern char *Tmpdir, *Rcsbin, *Editor, *CVSroot, *Rcsext;
  1176.   extern int really_quiet, quiet;
  1177.   extern int use_editor;
  1178.   extern int cvswrite;
  1179. ***************
  1180. *** 157,164 ****
  1181.    * Externs that are included in libc, but are used frequently
  1182.    * enough to warrant defining here.
  1183.    */
  1184. - extern char *sprintf();
  1185.   extern char *optarg;            /* for getopt() support */
  1186. - extern char *getwd();
  1187. - extern char *re_comp();
  1188.   extern int optind;
  1189. --- 186,218 ----
  1190.    * Externs that are included in libc, but are used frequently
  1191.    * enough to warrant defining here.
  1192.    */
  1193.   extern char *optarg;            /* for getopt() support */
  1194.   extern int optind;
  1195. + #define DBLKSIZ             1024
  1196. + #define MAXPATHLEN          256
  1197. + #define COPYBUFFER          16384
  1198. + #define R_OK                04
  1199. + #define W_OK                02
  1200. + #define mkstemp(n)          (mktemp(n), open(n, O_CREAT|O_TRUNC|O_RDWR, 0644))
  1201. + #define getwd(d)            getcwd(d, MAXPATHLEN)
  1202. + #define geteuid()           0
  1203. + #define gethostname(n, s)   -1
  1204. + #define max(a,b)        (((a) > (b)) ? (a) : (b))
  1205. + #define min(a,b)        (((a) < (b)) ? (a) : (b))
  1206. + #define WEXITSTATUS(x)      (x & 255)
  1207. + #define index strchr
  1208. + #define rindex strrchr
  1209. + #define mkdir(p, m)         mkdir(p)
  1210. + #define bcmp(x, y, n)       memcmp(x, y, n)
  1211. + #define bcopy(s, d, n)      memcpy(d, s, n)
  1212. + #include "proto.h"
  1213. diff -cb orig/diff.c src/diff.c
  1214. *** orig/diff.c    Sun Feb 23 15:02:26 1992
  1215. --- src/diff.c    Sun Feb 23 18:58:16 1992
  1216. ***************
  1217. *** 1,6 ****
  1218.   #ifndef lint
  1219.   static char rcsid[] = "$Id: diff.c,v 1.12 89/11/19 23:40:34 berliner Exp $";
  1220. ! #endif !lint
  1221.   
  1222.   /*
  1223.    *    Copyright (c) 1989, Brian Berliner
  1224. --- 1,6 ----
  1225.   #ifndef lint
  1226.   static char rcsid[] = "$Id: diff.c,v 1.12 89/11/19 23:40:34 berliner Exp $";
  1227. ! #endif 
  1228.   
  1229.   /*
  1230.    *    Copyright (c) 1989, Brian Berliner
  1231. ***************
  1232. *** 17,23 ****
  1233.    *    currently modified files, as listed in the CVS.adm/Mod file.
  1234.    */
  1235.   
  1236. - #include <sys/param.h>
  1237.   #include "cvs.h"
  1238.   
  1239.   diff(argc, argv)
  1240. --- 17,22 ----
  1241. ***************
  1242. *** 91,98 ****
  1243.               }
  1244.           }
  1245.           if (fileargv[i][0] != '\0') {
  1246. !             (void) sprintf(tmp, "%s/%s%s", CVSADM, CVSPREFIX, User);
  1247. !             (void) sprintf(prog, "%s/%s -p -q -r%s %s > %s", Rcsbin,
  1248.                      RCS_CO, revision, Rcs, tmp);
  1249.               if (system(prog) == 0 && xcmp(User, tmp) == 0)
  1250.               fileargv[i][0] = '\0';
  1251. --- 90,97 ----
  1252.               }
  1253.           }
  1254.           if (fileargv[i][0] != '\0') {
  1255. !             (void) sprintf(tmp, "%s%c%s%s", CVSADM, DIRSEP, CVSPREFIX, User);
  1256. !             (void) sprintf(prog, "%s -p -q -r%s %s >%s",
  1257.                      RCS_CO, revision, Rcs, tmp);
  1258.               if (system(prog) == 0 && xcmp(User, tmp) == 0)
  1259.               fileargv[i][0] = '\0';
  1260. ***************
  1261. *** 135,150 ****
  1262.           (void) fflush(stdout);
  1263.       }
  1264.       if (rev2[0] != '\0') {
  1265. !         (void) sprintf(prog, "%s/%s %s -r%s -r%s %s", Rcsbin, RCS_DIFF,
  1266.                  Options, rev1, rev2, Rcs);
  1267.       } else if (rev1[0] != '\0') {
  1268. !         (void) sprintf(prog, "%s/%s %s -r%s %s", Rcsbin, RCS_DIFF,
  1269.                  Options, rev1, Rcs);
  1270.       } else {
  1271. !         (void) sprintf(prog, "%s/%s %s -r%s %s", Rcsbin, RCS_DIFF,
  1272.                  Options, VN_User, Rcs);
  1273.       }
  1274.       (void) strcat(prog, " 2>&1");
  1275.       err += system(prog);
  1276.       (void) fflush(stdout);
  1277.       }
  1278. --- 134,151 ----
  1279.           (void) fflush(stdout);
  1280.       }
  1281.       if (rev2[0] != '\0') {
  1282. !         (void) sprintf(prog, "%s %s -r%s -r%s %s", RCS_DIFF,
  1283.                  Options, rev1, rev2, Rcs);
  1284.       } else if (rev1[0] != '\0') {
  1285. !         (void) sprintf(prog, "%s %s -r%s %s", RCS_DIFF,
  1286.                  Options, rev1, Rcs);
  1287.       } else {
  1288. !         (void) sprintf(prog, "%s %s -r%s %s", RCS_DIFF,
  1289.                  Options, VN_User, Rcs);
  1290.       }
  1291. + #ifndef OS2
  1292.       (void) strcat(prog, " 2>&1");
  1293. + #endif
  1294.       err += system(prog);
  1295.       (void) fflush(stdout);
  1296.       }
  1297. diff -cb orig/entries_file.c src/entries_file.c
  1298. *** orig/entries_file.c    Sun Feb 23 15:02:28 1992
  1299. --- src/entries_file.c    Sun Jan 19 15:35:44 1992
  1300. ***************
  1301. *** 1,6 ****
  1302.   #ifndef lint
  1303.   static char rcsid[] = "$Id: entries_file.c,v 1.6 89/11/19 23:20:00 berliner Exp $";
  1304. ! #endif !lint
  1305.   
  1306.   /*
  1307.    *    Copyright (c) 1989, Brian Berliner
  1308. --- 1,6 ----
  1309.   #ifndef lint
  1310.   static char rcsid[] = "$Id: entries_file.c,v 1.6 89/11/19 23:20:00 berliner Exp $";
  1311. ! #endif 
  1312.   
  1313.   /*
  1314.    *    Copyright (c) 1989, Brian Berliner
  1315. diff -cb orig/find_names.c src/find_names.c
  1316. *** orig/find_names.c    Sun Feb 23 15:02:28 1992
  1317. --- src/find_names.c    Sun Feb 23 16:49:12 1992
  1318. ***************
  1319. *** 1,6 ****
  1320.   #ifndef lint
  1321.   static char rcsid[] = "$Id: find_names.c,v 1.11 89/11/19 23:20:02 berliner Exp $";
  1322. ! #endif !lint
  1323.   
  1324.   /*
  1325.    *    Copyright (c) 1989, Brian Berliner
  1326. --- 1,6 ----
  1327.   #ifndef lint
  1328.   static char rcsid[] = "$Id: find_names.c,v 1.11 89/11/19 23:20:02 berliner Exp $";
  1329. ! #endif 
  1330.   
  1331.   /*
  1332.    *    Copyright (c) 1989, Brian Berliner
  1333. ***************
  1334. *** 20,28 ****
  1335.    *    to indicate that the Repository should not be searched for new files.
  1336.    */
  1337.   
  1338. - #include <sys/param.h>
  1339.   #include <sys/types.h>
  1340. ! #include <dirent.h>
  1341.   #include "cvs.h"
  1342.   
  1343.   Find_Names(pargc, argv, which)
  1344. --- 20,27 ----
  1345.    *    to indicate that the Repository should not be searched for new files.
  1346.    */
  1347.   
  1348.   #include <sys/types.h>
  1349. ! #include "dir.h"
  1350.   #include "cvs.h"
  1351.   
  1352.   Find_Names(pargc, argv, which)
  1353. ***************
  1354. *** 57,63 ****
  1355.           if (find_rcs(Repository, pargc, argv) != 0)
  1356.           error(1, "cannot open directory %s", Repository);
  1357.           if (which == ALLPLUSATTIC) {
  1358. !         (void) sprintf(dir, "%s/%s", Repository, CVSATTIC);
  1359.           (void) find_rcs(dir, pargc, argv);
  1360.           }
  1361.       }
  1362. --- 56,62 ----
  1363.           if (find_rcs(Repository, pargc, argv) != 0)
  1364.           error(1, "cannot open directory %s", Repository);
  1365.           if (which == ALLPLUSATTIC) {
  1366. !         (void) sprintf(dir, "%s%c%s", Repository, DIRSEP, CVSATTIC);
  1367.           (void) find_rcs(dir, pargc, argv);
  1368.           }
  1369.       }
  1370. ***************
  1371. *** 93,101 ****
  1372.       int *pargc;
  1373.       char *argv[];
  1374.   {
  1375. !     char *cp, line[50];
  1376.       struct dirent *dp;
  1377.       DIR *dirp;
  1378.   
  1379.       if ((dirp = opendir(dir)) == NULL)
  1380.       return (1);
  1381. --- 92,101 ----
  1382.       int *pargc;
  1383.       char *argv[];
  1384.   {
  1385. !     char *cp, line[256];
  1386.       struct dirent *dp;
  1387.       DIR *dirp;
  1388. +     FILE *fp;
  1389.   
  1390.       if ((dirp = opendir(dir)) == NULL)
  1391.       return (1);
  1392. ***************
  1393. *** 104,111 ****
  1394.       error(0, "%s", cp);
  1395.       while ((dp = readdir(dirp)) != NULL) {
  1396.       if (re_exec(dp->d_name)) {
  1397.           /* strip the ,v */
  1398. !         *rindex(dp->d_name, ',') = '\0';
  1399.           addname(pargc, argv, dp->d_name);
  1400.       }
  1401.       }
  1402. --- 104,122 ----
  1403.       error(0, "%s", cp);
  1404.       while ((dp = readdir(dirp)) != NULL) {
  1405.       if (re_exec(dp->d_name)) {
  1406. +             /* check if really a RCS file */
  1407. +             (void) sprintf(line, "%s%c%s", dir, DIRSEP, dp->d_name);
  1408. +             if ((fp = fopen(line, "r")) == NULL)
  1409. +                 continue;
  1410. +             cp = fgets(line, strlen(RCSHEAD) + 1, fp);
  1411. +             fclose(fp);
  1412. +             if (cp == NULL)
  1413. +                 continue;
  1414. +             if (strncmp(line, RCSHEAD, strlen(RCSHEAD)))
  1415. +                 continue;
  1416.           /* strip the ,v */
  1417. !             if ((cp = rindex(dp->d_name, ',')) != NULL)
  1418. !             *cp = '\0';
  1419.           addname(pargc, argv, dp->d_name);
  1420.       }
  1421.       }
  1422. ***************
  1423. *** 127,133 ****
  1424.   
  1425.       for (i = 0; i < *pargc; i++) {
  1426.       if (strcmp(argv[i], name) == 0)
  1427. !         return;
  1428.       }
  1429.       (*pargc)++;
  1430.       argv[i] = xmalloc(strlen(name) + 1);
  1431. --- 138,144 ----
  1432.   
  1433.       for (i = 0; i < *pargc; i++) {
  1434.       if (strcmp(argv[i], name) == 0)
  1435. !         return 0;
  1436.       }
  1437.       (*pargc)++;
  1438.       argv[i] = xmalloc(strlen(name) + 1);
  1439. diff -cb orig/join.c src/join.c
  1440. *** orig/join.c    Sun Feb 23 15:02:30 1992
  1441. --- src/join.c    Sun Jan 19 22:20:26 1992
  1442. ***************
  1443. *** 1,6 ****
  1444.   #ifndef lint
  1445.   static char rcsid[] = "$Id: join.c,v 1.4 89/11/19 23:40:36 berliner Exp $";
  1446. ! #endif !lint
  1447.   
  1448.   /*
  1449.    *    Copyright (c) 1989, Brian Berliner
  1450. --- 1,6 ----
  1451.   #ifndef lint
  1452.   static char rcsid[] = "$Id: join.c,v 1.4 89/11/19 23:40:36 berliner Exp $";
  1453. ! #endif 
  1454.   
  1455.   /*
  1456.    *    Copyright (c) 1989, Brian Berliner
  1457. ***************
  1458. *** 93,99 ****
  1459.       char vers[50];
  1460.   
  1461.       (void) strcpy(User, file);
  1462. !     (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  1463.       Version_Number(Rcs, Tag, Date, vers);
  1464.       if (vers[0] == '\0') {
  1465.       if (!quiet)
  1466. --- 93,99 ----
  1467.       char vers[50];
  1468.   
  1469.       (void) strcpy(User, file);
  1470. !     (void) sprintf(Rcs, "%s%c%s%s", Repository, DIRSEP, User, RCSEXT);
  1471.       Version_Number(Rcs, Tag, Date, vers);
  1472.       if (vers[0] == '\0') {
  1473.       if (!quiet)
  1474. ***************
  1475. *** 102,108 ****
  1476.       }
  1477.       (void) unlink(User);
  1478.       Scratch_Entry(User);
  1479. !     (void) sprintf(prog, "%s/%s -j%s %s %s", Rcsbin, RCS_CO, vers, Rcs, User);
  1480.       if (system(prog) != 0) {
  1481.       if (!quiet)
  1482.           warn(0, "co of revision %s for %s failed", VN_Rcs, Rcs);
  1483. --- 102,108 ----
  1484.       }
  1485.       (void) unlink(User);
  1486.       Scratch_Entry(User);
  1487. !     (void) sprintf(prog, "%s -j%s %s %s", RCS_CO, vers, Rcs, User);
  1488.       if (system(prog) != 0) {
  1489.       if (!quiet)
  1490.           warn(0, "co of revision %s for %s failed", VN_Rcs, Rcs);
  1491. diff -cb orig/locate_rcs.c src/locate_rcs.c
  1492. *** orig/locate_rcs.c    Sun Feb 23 15:02:30 1992
  1493. --- src/locate_rcs.c    Sun Jan 19 22:20:26 1992
  1494. ***************
  1495. *** 1,6 ****
  1496.   #ifndef lint
  1497.   static char rcsid[] = "$Id: locate_rcs.c,v 1.5 89/11/19 23:20:05 berliner Exp $";
  1498. ! #endif !lint
  1499.   
  1500.   /*
  1501.    *    Copyright (c) 1989, Brian Berliner
  1502. --- 1,6 ----
  1503.   #ifndef lint
  1504.   static char rcsid[] = "$Id: locate_rcs.c,v 1.5 89/11/19 23:20:05 berliner Exp $";
  1505. ! #endif 
  1506.   
  1507.   /*
  1508.    *    Copyright (c) 1989, Brian Berliner
  1509. ***************
  1510. *** 14,20 ****
  1511.    * Sets the global Rcs variable to the correct file.
  1512.    */
  1513.   
  1514. - #include <sys/param.h>
  1515.   #include "cvs.h"
  1516.   
  1517.   Locate_RCS()
  1518. --- 14,19 ----
  1519. ***************
  1520. *** 21,28 ****
  1521.   {
  1522.       char old[MAXPATHLEN];
  1523.   
  1524. !     (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  1525. !     (void) sprintf(old, "%s/%s/%s%s", Repository, CVSATTIC, User, RCSEXT);
  1526.       if (!isreadable(Rcs)) {
  1527.       if (isreadable(old)) {
  1528.           (void) strcpy(Rcs, old);
  1529. --- 20,28 ----
  1530.   {
  1531.       char old[MAXPATHLEN];
  1532.   
  1533. !     (void) sprintf(Rcs, "%s%c%s%s", Repository, DIRSEP, User, RCSEXT);
  1534. !     (void) sprintf(old, "%s%c%s%c%s%s", Repository, DIRSEP, CVSATTIC,
  1535. !             DIRSEP, User, RCSEXT);
  1536.       if (!isreadable(Rcs)) {
  1537.       if (isreadable(old)) {
  1538.           (void) strcpy(Rcs, old);
  1539. diff -cb orig/log.c src/log.c
  1540. *** orig/log.c    Sun Feb 23 15:02:30 1992
  1541. --- src/log.c    Sun Jan 19 16:15:18 1992
  1542. ***************
  1543. *** 1,6 ****
  1544.   #ifndef lint
  1545.   static char rcsid[] = "$Id: log.c,v 1.9 89/11/19 23:40:37 berliner Exp $";
  1546. ! #endif !lint
  1547.   
  1548.   /*
  1549.    *    Copyright (c) 1989, Brian Berliner
  1550. --- 1,6 ----
  1551.   #ifndef lint
  1552.   static char rcsid[] = "$Id: log.c,v 1.9 89/11/19 23:40:37 berliner Exp $";
  1553. ! #endif 
  1554.   
  1555.   /*
  1556.    *    Copyright (c) 1989, Brian Berliner
  1557. ***************
  1558. *** 39,45 ****
  1559.       argc = fileargc;
  1560.       argv = fileargv;
  1561.       }
  1562. !     (void) sprintf(prog, "%s/%s %s", Rcsbin, RCS_RLOG, Options);
  1563.       cp = prog + strlen(prog);
  1564.       for (i = 0; i < argc; i++) {
  1565.       (void) strcpy(User, argv[i]);
  1566. --- 39,45 ----
  1567.       argc = fileargc;
  1568.       argv = fileargv;
  1569.       }
  1570. !     (void) sprintf(prog, "%s %s", RCS_RLOG, Options);
  1571.       cp = prog + strlen(prog);
  1572.       for (i = 0; i < argc; i++) {
  1573.       (void) strcpy(User, argv[i]);
  1574. diff -cb orig/main.c src/main.c
  1575. *** orig/main.c    Sun Feb 23 15:02:32 1992
  1576. --- src/main.c    Sun Feb 23 15:32:54 1992
  1577. ***************
  1578. *** 36,42 ****
  1579.    * 4/20/89
  1580.    */
  1581.   
  1582. - #include <sys/param.h>
  1583.   #include "cvs.h"
  1584.   #include "patchlevel.h"
  1585.   
  1586. --- 36,41 ----
  1587. ***************
  1588. *** 78,86 ****
  1589. --- 77,87 ----
  1590.   /*
  1591.    * Defaults, for the environment variables that are not set
  1592.    */
  1593. + char *Tmpdir = TMPDIR_DFLT;
  1594.   char *Rcsbin = RCSBIN_DFLT;
  1595.   char *Editor = EDITOR_DFLT;
  1596.   char *CVSroot = CVSROOT_DFLT;
  1597. + char *Rcsext = "";
  1598.   
  1599.   main(argc, argv)
  1600.       int argc;
  1601. ***************
  1602. *** 94,100 ****
  1603.       /*
  1604.        * Just save the last component of the path for error messages
  1605.        */
  1606. !     if ((progname = rindex(argv[0], '/')) == NULL)
  1607.       progname = argv[0];
  1608.       else
  1609.       progname++;
  1610. --- 95,101 ----
  1611.       /*
  1612.        * Just save the last component of the path for error messages
  1613.        */
  1614. !     if ((progname = rindex_sep(argv[0])) == NULL)
  1615.       progname = argv[0];
  1616.       else
  1617.       progname++;
  1618. ***************
  1619. *** 103,108 ****
  1620. --- 104,111 ----
  1621.        * Query the environment variables up-front, so that
  1622.        * they can be overridden by command line arguments
  1623.        */
  1624. +     if ((cp = getenv(TMPDIR_ENV)) != NULL)
  1625. +     Tmpdir = cp;
  1626.       if ((cp = getenv(RCSBIN_ENV)) != NULL)
  1627.       Rcsbin = cp;
  1628.       if ((cp = getenv(EDITOR_ENV)) != NULL)
  1629. ***************
  1630. *** 109,114 ****
  1631. --- 112,121 ----
  1632.       Editor = cp;
  1633.       if ((cp = getenv(CVSROOT_ENV)) != NULL)
  1634.       CVSroot = cp;
  1635. +     if ((cp = getenv(RCSINIT_ENV)) != NULL)
  1636. +         if ((cp = strstr(cp, "-x")) != NULL)
  1637. +             if ((cp = strstr(cp, ",v")) != NULL)
  1638. +                 Rcsext = ",v";
  1639.       if (getenv(CVSREAD_ENV) != NULL)
  1640.       cvswrite = FALSE;
  1641.   
  1642. ***************
  1643. *** 166,172 ****
  1644.        * to stdout -- just leave it block buffered.
  1645.        */
  1646.       if (strcmp(cp, "patch") != 0)
  1647. !     setlinebuf(stdout);
  1648.   
  1649.       if (strcmp(cp, "update") == 0)
  1650.       err += update(argc, argv);
  1651. --- 173,179 ----
  1652.        * to stdout -- just leave it block buffered.
  1653.        */
  1654.       if (strcmp(cp, "patch") != 0)
  1655. !     setvbuf(stdout, NULL, _IOLBF, 1024);
  1656.   
  1657.       if (strcmp(cp, "update") == 0)
  1658.       err += update(argc, argv);
  1659. ***************
  1660. *** 184,190 ****
  1661.       else if (strcmp(cp, "add") == 0)
  1662.       add(argc, argv);
  1663.       else if (strcmp(cp, "remove") == 0)
  1664. !     remove(argc, argv);
  1665.       else if (strcmp(cp, "join") == 0)
  1666.       join(argc, argv);
  1667.       else if (strcmp(cp, "patch") == 0)
  1668. --- 191,197 ----
  1669.       else if (strcmp(cp, "add") == 0)
  1670.       add(argc, argv);
  1671.       else if (strcmp(cp, "remove") == 0)
  1672. !     _remove(argc, argv);
  1673.       else if (strcmp(cp, "join") == 0)
  1674.       join(argc, argv);
  1675.       else if (strcmp(cp, "patch") == 0)
  1676. ***************
  1677. *** 200,205 ****
  1678. --- 207,218 ----
  1679.   static
  1680.   usage()
  1681.   {
  1682. +     (void) fputs("\nCVS 1.0, Copyright (c) 1989-91, Brian Berliner\n\n\
  1683. + CVS may be copied only under the terms of the GNU General Public License,\n\
  1684. + a copy of which can be found with the CVS 1.0 distribution kit.\n\n", stderr);
  1685. +     (void) sprintf(index(rcsid, '#'), "%d\n\n", PATCHLEVEL);
  1686. +     (void) fputs(rcsid, stderr);
  1687.       (void) fprintf(stderr,
  1688.       "Usage: %s [cvs-options] command [command-options] [files...]\n",
  1689.              progname);
  1690. diff -cb orig/maketime.c src/maketime.c
  1691. *** orig/maketime.c    Sun Feb 23 15:02:32 1992
  1692. --- src/maketime.c    Sun Jan 19 15:35:44 1992
  1693. ***************
  1694. *** 1,4 ****
  1695. - #
  1696.   /*
  1697.    * MAKETIME        derive 32-bit time value from TM structure.
  1698.    *
  1699. --- 1,3 ----
  1700. diff -cb orig/mkmodules.c src/mkmodules.c
  1701. *** orig/mkmodules.c    Sun Feb 23 15:02:32 1992
  1702. --- src/mkmodules.c    Sun Jan 19 22:05:02 1992
  1703. ***************
  1704. *** 1,6 ****
  1705.   #ifndef lint
  1706.   static char rcsid[] = "$Id: mkmodules.c,v 1.9 89/11/19 23:20:10 berliner Exp $";
  1707. ! #endif !lint
  1708.   
  1709.   /*
  1710.    *    Copyright (c) 1989, Brian Berliner
  1711. --- 1,6 ----
  1712.   #ifndef lint
  1713.   static char rcsid[] = "$Id: mkmodules.c,v 1.9 89/11/19 23:20:10 berliner Exp $";
  1714. ! #endif
  1715.   
  1716.   /*
  1717.    *    Copyright (c) 1989, Brian Berliner
  1718. ***************
  1719. *** 14,23 ****
  1720.    *    argument, which is the directory that the modules,v file lives in.
  1721.    */
  1722.   
  1723. - #include <sys/param.h>
  1724.   #include <fcntl.h>
  1725.   #include <signal.h>
  1726. - #include <ndbm.h>
  1727.   #include <ctype.h>
  1728.   #include "cvs.h"
  1729.   
  1730. --- 14,21 ----
  1731. ***************
  1732. *** 37,43 ****
  1733.       /*
  1734.        * Just save the last component of the path for error messages
  1735.        */
  1736. !     if ((progname = rindex(argv[0], '/')) == NULL)
  1737.       progname = argv[0];
  1738.       else
  1739.       progname++;
  1740. --- 35,41 ----
  1741.       /*
  1742.        * Just save the last component of the path for error messages
  1743.        */
  1744. !     if ((progname = rindex_sep(argv[0])) == NULL)
  1745.       progname = argv[0];
  1746.       else
  1747.       progname++;
  1748. ***************
  1749. *** 88,94 ****
  1750.       char *file;
  1751.       char *temp;
  1752.   {
  1753. !     (void) sprintf(prog, "%s/%s -q -p %s > %s", Rcsbin, RCS_CO, file, temp);
  1754.       if (system(prog) != 0) {
  1755.       warn(0, "failed to check out %s file", file);
  1756.       return (1);
  1757. --- 86,92 ----
  1758.       char *file;
  1759.       char *temp;
  1760.   {
  1761. !     (void) sprintf(prog, "%s -q -p %s >%s", RCS_CO, file, temp);
  1762.       if (system(prog) != 0) {
  1763.       warn(0, "failed to check out %s file", file);
  1764.       return (1);
  1765. ***************
  1766. *** 189,198 ****
  1767.       char dotdir[50], dotpag[50];
  1768.       char bakdir[50], bakpag[50];
  1769.   
  1770. !     (void) signal(SIGHUP, SIG_IGN);    /* don't mess with me... */
  1771. !     (void) signal(SIGINT, SIG_IGN);
  1772. !     (void) signal(SIGQUIT, SIG_IGN);
  1773.       (void) signal(SIGTERM, SIG_IGN);
  1774.   
  1775.       (void) sprintf(dotdir, "%s.dir", CVSMODULE_FILE);
  1776.       (void) sprintf(dotpag, "%s.pag", CVSMODULE_FILE);
  1777. --- 187,195 ----
  1778.       char dotdir[50], dotpag[50];
  1779.       char bakdir[50], bakpag[50];
  1780.   
  1781. !     (void) signal(SIGINT, SIG_IGN);    /* don't mess with me... */
  1782.       (void) signal(SIGTERM, SIG_IGN);
  1783. +     (void) signal(SIGBREAK, SIG_IGN);
  1784.   
  1785.       (void) sprintf(dotdir, "%s.dir", CVSMODULE_FILE);
  1786.       (void) sprintf(dotpag, "%s.pag", CVSMODULE_FILE);
  1787. ***************
  1788. *** 231,240 ****
  1789.    */
  1790.   void
  1791.   Lock_Cleanup(sig)
  1792.   {
  1793.   #ifdef lint
  1794.       sig = sig;
  1795. ! #endif lint
  1796.   }
  1797.   
  1798.   static
  1799. --- 228,238 ----
  1800.    */
  1801.   void
  1802.   Lock_Cleanup(sig)
  1803. + int sig;
  1804.   {
  1805.   #ifdef lint
  1806.       sig = sig;
  1807. ! #endif
  1808.   }
  1809.   
  1810.   static
  1811. diff -cb orig/modules.c src/modules.c
  1812. *** orig/modules.c    Sun Feb 23 15:02:34 1992
  1813. --- src/modules.c    Sun Jan 19 22:20:26 1992
  1814. ***************
  1815. *** 1,6 ****
  1816.   #ifndef lint
  1817.   static char rcsid[] = "$Id: modules.c,v 1.14.1.1 91/01/29 07:17:32 berliner Exp $";
  1818. ! #endif !lint
  1819.   
  1820.   /*
  1821.    *    Copyright (c) 1989, Brian Berliner
  1822. --- 1,6 ----
  1823.   #ifndef lint
  1824.   static char rcsid[] = "$Id: modules.c,v 1.14.1.1 91/01/29 07:17:32 berliner Exp $";
  1825. ! #endif 
  1826.   
  1827.   /*
  1828.    *    Copyright (c) 1989, Brian Berliner
  1829. ***************
  1830. *** 23,31 ****
  1831.    *    command line.
  1832.    */
  1833.   
  1834. ! #include <sys/param.h>
  1835. ! #include <sys/file.h>
  1836. ! #include <ndbm.h>
  1837.   #include "cvs.h"
  1838.   
  1839.   extern int update_build_dirs;
  1840. --- 23,29 ----
  1841.    *    command line.
  1842.    */
  1843.   
  1844. ! #include <fcntl.h>
  1845.   #include "cvs.h"
  1846.   
  1847.   extern int update_build_dirs;
  1848. ***************
  1849. *** 48,54 ****
  1850.                  progname);
  1851.       error(0, "or specify the '-d' option to %s", progname);
  1852.       }
  1853. !     (void) sprintf(mfile, "%s/%s", CVSroot, CVSROOTADM_MODULES);
  1854.       if ((db = dbm_open(mfile, O_RDONLY, 0666)) == NULL)
  1855.       warn(0, "warning: cannot open modules file %s", mfile);
  1856.       return (db);
  1857. --- 46,52 ----
  1858.                  progname);
  1859.       error(0, "or specify the '-d' option to %s", progname);
  1860.       }
  1861. !     (void) sprintf(mfile, "%s%c%s", CVSroot, DIRSEP, CVSROOTADM_MODULES);
  1862.       if ((db = dbm_open(mfile, O_RDONLY, 0666)) == NULL)
  1863.       warn(0, "warning: cannot open modules file %s", mfile);
  1864.       return (db);
  1865. ***************
  1866. *** 77,83 ****
  1867.       char *msg;
  1868.   {
  1869.       char *checkin_prog = NULL, *checkout_prog = NULL, *tag_prog = NULL;
  1870. !     char cwd[MAXPATHLEN], file[MAXPATHLEN];
  1871.       char *moduleargv[MAXFILEPERDIR];
  1872.       int moduleargc, just_file;
  1873.       datum key, val;
  1874. --- 75,81 ----
  1875.       char *msg;
  1876.   {
  1877.       char *checkin_prog = NULL, *checkout_prog = NULL, *tag_prog = NULL;
  1878. !     char cwd[MAXPATHLEN], file[MAXPATHLEN], value[MAXPATHLEN];
  1879.       char *moduleargv[MAXFILEPERDIR];
  1880.       int moduleargc, just_file;
  1881.       datum key, val;
  1882. ***************
  1883. *** 101,107 ****
  1884.       else
  1885.       val.dptr = NULL;
  1886.       if (val.dptr != NULL) {
  1887. !     val.dptr[val.dsize] = '\0';
  1888.       } else {
  1889.       /*
  1890.        * Need to determine if the argument module name is a directory
  1891. --- 99,106 ----
  1892.       else
  1893.       val.dptr = NULL;
  1894.       if (val.dptr != NULL) {
  1895. !         strncpy(value, val.dptr, val.dsize);
  1896. !     value[val.dsize] = '\0';
  1897.       } else {
  1898.       /*
  1899.        * Need to determine if the argument module name is a directory
  1900. ***************
  1901. *** 109,115 ****
  1902.        * and just_file accordingly
  1903.        */
  1904.       update_build_dirs = TRUE;
  1905. !     (void) sprintf(file, "%s/%s", CVSroot, key.dptr);
  1906.       if (!isdir(file)) {
  1907.           (void) strcat(file, RCSEXT);
  1908.           if (!isfile(file)) {
  1909. --- 108,114 ----
  1910.        * and just_file accordingly
  1911.        */
  1912.       update_build_dirs = TRUE;
  1913. !     (void) sprintf(file, "%s%c%s", CVSroot, DIRSEP, key.dptr);
  1914.       if (!isdir(file)) {
  1915.           (void) strcat(file, RCSEXT);
  1916.           if (!isfile(file)) {
  1917. ***************
  1918. *** 128,134 ****
  1919.        * passed in module name to look like an actual module entry.
  1920.        */
  1921.       if (just_file == TRUE) {
  1922. !     if ((cp = rindex(key.dptr, '/')) != NULL) {
  1923.           *cp++ = '\0';
  1924.       } else {
  1925.           cp = key.dptr;
  1926. --- 127,133 ----
  1927.        * passed in module name to look like an actual module entry.
  1928.        */
  1929.       if (just_file == TRUE) {
  1930. !     if ((cp = rindex_sep(key.dptr)) != NULL) {
  1931.           *cp++ = '\0';
  1932.       } else {
  1933.           cp = key.dptr;
  1934. ***************
  1935. *** 136,142 ****
  1936.       }
  1937.       (void) sprintf(file, "%s %s %s", key.dptr, key.dptr, cp);
  1938.       } else {
  1939. !     (void) sprintf(file, "%s %s", key.dptr, val.dptr);
  1940.       }
  1941.       line2argv(&moduleargc, moduleargv, file);
  1942.       argc = moduleargc;
  1943. --- 135,141 ----
  1944.       }
  1945.       (void) sprintf(file, "%s %s %s", key.dptr, key.dptr, cp);
  1946.       } else {
  1947. !     (void) sprintf(file, "%s %s", key.dptr, value);
  1948.       }
  1949.       line2argv(&moduleargc, moduleargv, file);
  1950.       argc = moduleargc;
  1951. ***************
  1952. *** 160,166 ****
  1953.           break;
  1954.       case '?':
  1955.           warn(0, "modules file has invalid option for key %s value %s",
  1956. !          key.dptr, val.dptr);
  1957.           err++;
  1958.           return (err);
  1959.           break;
  1960. --- 159,165 ----
  1961.           break;
  1962.       case '?':
  1963.           warn(0, "modules file has invalid option for key %s value %s",
  1964. !          key.dptr, value);
  1965.           err++;
  1966.           return (err);
  1967.           break;
  1968. ***************
  1969. *** 170,176 ****
  1970.       argv += optind;
  1971.       if (argc == 0) {
  1972.       warn(0, "modules file missing directory for key %s value %s",
  1973. !          key.dptr, val.dptr);
  1974.       err++;
  1975.       return (err);
  1976.       }
  1977. --- 169,175 ----
  1978.       argv += optind;
  1979.       if (argc == 0) {
  1980.       warn(0, "modules file missing directory for key %s value %s",
  1981. !          key.dptr, value);
  1982.       err++;
  1983.       return (err);
  1984.       }
  1985. ***************
  1986. *** 222,228 ****
  1987.       if (!just_file && update_build_dirs == FALSE && argc == 1)
  1988.       update_build_dirs = TRUE;
  1989.       if (m_type == TAG || m_type == PATCH) {
  1990. !     (void) sprintf(Repository, "%s/%s", CVSroot, argv[0]);
  1991.       if (chdir(Repository) < 0) {
  1992.           warn(1, "cannot chdir to %s", Repository);
  1993.           err++;
  1994. --- 221,227 ----
  1995.       if (!just_file && update_build_dirs == FALSE && argc == 1)
  1996.       update_build_dirs = TRUE;
  1997.       if (m_type == TAG || m_type == PATCH) {
  1998. !     (void) sprintf(Repository, "%s%c%s", CVSroot, DIRSEP, argv[0]);
  1999.       if (chdir(Repository) < 0) {
  2000.           warn(1, "cannot chdir to %s", Repository);
  2001.           err++;
  2002. ***************
  2003. *** 234,240 ****
  2004.           err++;
  2005.           return (err);
  2006.       }
  2007. !     (void) sprintf(Repository, "%s/%s", CVSroot, argv[0]);
  2008.       if (!isdir(CVSADM)) {
  2009.           FILE *fp;
  2010.   
  2011. --- 233,239 ----
  2012.           err++;
  2013.           return (err);
  2014.       }
  2015. !     (void) sprintf(Repository, "%s%c%s", CVSroot, DIRSEP, argv[0]);
  2016.       if (!isdir(CVSADM)) {
  2017.           FILE *fp;
  2018.   
  2019. ***************
  2020. *** 277,283 ****
  2021.       char line[MAXLINELEN];
  2022.   
  2023.       (void) strcpy(User, argv[i]);
  2024. !     (void) sprintf(Rcs, "%s/%s%s", Repository, User, RCSEXT);
  2025.       if (m_type == CHECKOUT) {
  2026.           Version_TS(Rcs, Tag, User);
  2027.           if (TS_User[0] == '\0') {
  2028. --- 276,282 ----
  2029.       char line[MAXLINELEN];
  2030.   
  2031.       (void) strcpy(User, argv[i]);
  2032. !     (void) sprintf(Rcs, "%s%c%s%s", Repository, DIRSEP, User, RCSEXT);
  2033.       if (m_type == CHECKOUT) {
  2034.           Version_TS(Rcs, Tag, User);
  2035.           if (TS_User[0] == '\0') {
  2036. ***************
  2037. *** 302,307 ****
  2038. --- 301,307 ----
  2039.       FILE *fp;
  2040.       DBM *db;
  2041.       datum key, val;
  2042. +     char value[MAXPATHLEN];
  2043.   
  2044.       if ((db = open_module()) == NULL)
  2045.       error(0, "failed to cat the modules file");
  2046. ***************
  2047. *** 312,319 ****
  2048.       (void) fprintf(fp, "%-20s", key.dptr);
  2049.       val = dbm_fetch(db, key);
  2050.       if (val.dptr != NULL) {
  2051. !         val.dptr[val.dsize] = '\0';
  2052. !         (void) fprintf(fp, " %s\n", val.dptr);
  2053.       } else {
  2054.           (void) fprintf(fp, "\n");
  2055.       }
  2056. --- 312,320 ----
  2057.       (void) fprintf(fp, "%-20s", key.dptr);
  2058.       val = dbm_fetch(db, key);
  2059.       if (val.dptr != NULL) {
  2060. !             strncpy(value, val.dptr, val.dsize);
  2061. !         value[val.dsize] = '\0';
  2062. !         (void) fprintf(fp, " %s\n", value);
  2063.       } else {
  2064.           (void) fprintf(fp, "\n");
  2065.       }
  2066. diff -cb orig/name_repository.c src/name_repository.c
  2067. *** orig/name_repository.c    Sun Feb 23 15:02:34 1992
  2068. --- src/name_repository.c    Sun Jan 19 22:05:02 1992
  2069. ***************
  2070. *** 1,6 ****
  2071.   #ifndef lint
  2072.   static char rcsid[] = "$Id: name_repository.c,v 1.9 89/11/19 23:20:13 berliner Exp $";
  2073. ! #endif !lint
  2074.   
  2075.   /*
  2076.    *    Copyright (c) 1989, Brian Berliner
  2077. --- 1,6 ----
  2078.   #ifndef lint
  2079.   static char rcsid[] = "$Id: name_repository.c,v 1.9 89/11/19 23:20:13 berliner Exp $";
  2080. ! #endif 
  2081.   
  2082.   /*
  2083.    *    Copyright (c) 1989, Brian Berliner
  2084. ***************
  2085. *** 14,20 ****
  2086.    *    accordingly.
  2087.    */
  2088.   
  2089. - #include <sys/param.h>
  2090.   #include "cvs.h"
  2091.   
  2092.   Name_Repository()
  2093. --- 14,19 ----
  2094. ***************
  2095. *** 42,48 ****
  2096.        * an absolute one by tacking on the CVSROOT environment variable.
  2097.        * If the CVSROOT environment variable is not set, die now.
  2098.        */
  2099. !     if (Repository[0] != '/') {
  2100.       if (CVSroot == NULL) {
  2101.           (void) fprintf(stderr,
  2102.                  "%s: must set the CVSROOT environment variable\n",
  2103. --- 41,47 ----
  2104.        * an absolute one by tacking on the CVSROOT environment variable.
  2105.        * If the CVSROOT environment variable is not set, die now.
  2106.        */
  2107. !     if (!ISDIRSEP(Repository[0])) {
  2108.       if (CVSroot == NULL) {
  2109.           (void) fprintf(stderr,
  2110.                  "%s: must set the CVSROOT environment variable\n",
  2111. ***************
  2112. *** 50,56 ****
  2113.           error(0, "or specify the '-d' option to %s", progname);
  2114.       }
  2115.       (void) strcpy(path, Repository);
  2116. !     (void) sprintf(Repository, "%s/%s", CVSroot, path);
  2117.       }
  2118.       if (!isdir(Repository))
  2119.       error(0, "there is no repository %s", Repository);
  2120. --- 49,55 ----
  2121.           error(0, "or specify the '-d' option to %s", progname);
  2122.       }
  2123.       (void) strcpy(path, Repository);
  2124. !     (void) sprintf(Repository, "%s%c%s", CVSroot, DIRSEP, path);
  2125.       }
  2126.       if (!isdir(Repository))
  2127.       error(0, "there is no repository %s", Repository);
  2128. diff -cb orig/no_difference.c src/no_difference.c
  2129. *** orig/no_difference.c    Sun Feb 23 15:02:36 1992
  2130. --- src/no_difference.c    Sun Jan 19 22:20:26 1992
  2131. ***************
  2132. *** 1,6 ****
  2133.   #ifndef lint
  2134.   static char rcsid[] = "$Id: no_difference.c,v 1.7.1.1 91/01/29 07:18:06 berliner Exp $";
  2135. ! #endif !lint
  2136.   
  2137.   /*
  2138.    *    Copyright (c) 1989, Brian Berliner
  2139. --- 1,6 ----
  2140.   #ifndef lint
  2141.   static char rcsid[] = "$Id: no_difference.c,v 1.7.1.1 91/01/29 07:18:06 berliner Exp $";
  2142. ! #endif 
  2143.   
  2144.   /*
  2145.    *    Copyright (c) 1989, Brian Berliner
  2146. ***************
  2147. *** 22,28 ****
  2148.    * Returns non-zero on error.
  2149.    */
  2150.   
  2151. - #include <sys/param.h>
  2152.   #include "cvs.h"
  2153.   
  2154.   No_Difference(doGlist)
  2155. --- 22,27 ----
  2156. ***************
  2157. *** 30,38 ****
  2158.   {
  2159.       char tmp[MAXPATHLEN];
  2160.   
  2161. !     (void) sprintf(tmp, "%s/%s%s", CVSADM, CVSPREFIX, User);
  2162. !     (void) sprintf(prog, "%s/%s -p -q -r%s %s > %s", Rcsbin, RCS_CO,
  2163. !            VN_User, Rcs, tmp);
  2164.       if (system(prog) == 0) {
  2165.       if (xcmp(User, tmp) == 0) {
  2166.           if (cvswrite == FALSE)
  2167. --- 29,36 ----
  2168.   {
  2169.       char tmp[MAXPATHLEN];
  2170.   
  2171. !     (void) sprintf(tmp, "%s%c%s%s", CVSADM, DIRSEP, CVSPREFIX, User);
  2172. !     (void) sprintf(prog, "%s -p -q -r%s %s >%s", RCS_CO, VN_User, Rcs, tmp);
  2173.       if (system(prog) == 0) {
  2174.       if (xcmp(User, tmp) == 0) {
  2175.           if (cvswrite == FALSE)
  2176. diff -cb orig/options.c src/options.c
  2177. *** orig/options.c    Sun Feb 23 15:02:36 1992
  2178. --- src/options.c    Sun Jan 19 15:35:44 1992
  2179. ***************
  2180. *** 1,6 ****
  2181.   #ifndef lint
  2182.   static char rcsid[] = "$Id: options.c,v 1.5 89/11/19 23:20:18 berliner Exp $";
  2183. ! #endif !lint
  2184.   
  2185.   /*
  2186.    *    Copyright (c) 1989, Brian Berliner
  2187. --- 1,6 ----
  2188.   #ifndef lint
  2189.   static char rcsid[] = "$Id: options.c,v 1.5 89/11/19 23:20:18 berliner Exp $";
  2190. ! #endif 
  2191.   
  2192.   /*
  2193.    *    Copyright (c) 1989, Brian Berliner
  2194. diff -cb orig/patch.c src/patch.c
  2195. *** orig/patch.c    Sun Feb 23 15:02:36 1992
  2196. --- src/patch.c    Sun Feb 23 17:03:58 1992
  2197. ***************
  2198. *** 1,6 ****
  2199.   #ifndef lint
  2200.   static char rcsid[] = "$Id: patch.c,v 1.6.1.1 91/01/18 12:18:45 berliner Exp $";
  2201. ! #endif !lint
  2202.   
  2203.   /*
  2204.    *    Copyright (c) 1989, Brian Berliner
  2205. --- 1,6 ----
  2206.   #ifndef lint
  2207.   static char rcsid[] = "$Id: patch.c,v 1.6.1.1 91/01/18 12:18:45 berliner Exp $";
  2208. ! #endif 
  2209.   
  2210.   /*
  2211.    *    Copyright (c) 1989, Brian Berliner
  2212. ***************
  2213. *** 15,25 ****
  2214.    *    specify the release as either a date or a revision number.
  2215.    */
  2216.   
  2217. - #include <sys/param.h>
  2218.   #include <time.h>
  2219. ! #include <ndbm.h>
  2220. ! #include <dirent.h>
  2221.   #include <ctype.h>
  2222.   #include "cvs.h"
  2223.   
  2224.   extern char update_dir[];
  2225. --- 15,26 ----
  2226.    *    specify the release as either a date or a revision number.
  2227.    */
  2228.   
  2229.   #include <time.h>
  2230. ! #include <fcntl.h>
  2231. ! #include <signal.h>
  2232.   #include <ctype.h>
  2233. + #include <sys/types.h>
  2234. + #include "dir.h"
  2235.   #include "cvs.h"
  2236.   
  2237.   extern char update_dir[];
  2238. ***************
  2239. *** 30,36 ****
  2240.   static int patch_short = 0;
  2241.   static int toptwo_diffs = 0;
  2242.   static char rev1[50], rev2[50], date1[50], date2[50];
  2243. ! static char tmpfile1[50], tmpfile2[50], tmpfile3[50];
  2244.   
  2245.   void patch_cleanup();
  2246.   
  2247. --- 31,37 ----
  2248.   static int patch_short = 0;
  2249.   static int toptwo_diffs = 0;
  2250.   static char rev1[50], rev2[50], date1[50], date2[50];
  2251. ! static char tmpfile1[MAXPATHLEN], tmpfile2[MAXPATHLEN], tmpfile3[MAXPATHLEN];
  2252.   
  2253.   void patch_cleanup();
  2254.   
  2255. ***************
  2256. *** 107,116 ****
  2257.       if (datecmp(date1, date2) >= 0)
  2258.           error(0, "second date must come after first date!");
  2259.       }
  2260. -     (void) signal(SIGHUP, patch_cleanup);
  2261.       (void) signal(SIGINT, patch_cleanup);
  2262. -     (void) signal(SIGQUIT, patch_cleanup);
  2263.       (void) signal(SIGTERM, patch_cleanup);
  2264.       db = open_module();
  2265.       for (i = 0; i < argc; i++)
  2266.       err += do_module(db, argv[i], PATCH, "Examining");
  2267. --- 108,116 ----
  2268.       if (datecmp(date1, date2) >= 0)
  2269.           error(0, "second date must come after first date!");
  2270.       }
  2271.       (void) signal(SIGINT, patch_cleanup);
  2272.       (void) signal(SIGTERM, patch_cleanup);
  2273. +     (void) signal(SIGBREAK, patch_cleanup);
  2274.       db = open_module();
  2275.       for (i = 0; i < argc; i++)
  2276.       err += do_module(db, argv[i], PATCH, "Examining");
  2277. ***************
  2278. *** 149,156 ****
  2279.           } else while ((dp = readdir(dirp)) != NULL) {
  2280.           if (strcmp(dp->d_name, ".") == 0 ||
  2281.               strcmp(dp->d_name, "..") == 0 ||
  2282. !             strcmp(dp->d_name, CVSATTIC) == 0 ||
  2283. !             strcmp(dp->d_name, CVSLCK) == 0)
  2284.               continue;
  2285.           if (isdir(dp->d_name) && patch_recursive) {
  2286.               char cwd[MAXPATHLEN];
  2287. --- 149,156 ----
  2288.           } else while ((dp = readdir(dirp)) != NULL) {
  2289.           if (strcmp(dp->d_name, ".") == 0 ||
  2290.               strcmp(dp->d_name, "..") == 0 ||
  2291. !             stricmp(dp->d_name, CVSATTIC) == 0 ||
  2292. !             stricmp(dp->d_name, CVSLCK) == 0)
  2293.               continue;
  2294.           if (isdir(dp->d_name) && patch_recursive) {
  2295.               char cwd[MAXPATHLEN];
  2296. ***************
  2297. *** 163,169 ****
  2298.               if (update_dir[0] == '\0') {
  2299.               (void) strcpy(update_dir, dp->d_name);
  2300.               } else {
  2301. !             (void) strcat(update_dir, "/");
  2302.               (void) strcat(update_dir, dp->d_name);
  2303.               }
  2304.               if (!quiet) {
  2305. --- 163,169 ----
  2306.               if (update_dir[0] == '\0') {
  2307.               (void) strcpy(update_dir, dp->d_name);
  2308.               } else {
  2309. !             (void) strcat(update_dir, DIRSEPSTR);
  2310.               (void) strcat(update_dir, dp->d_name);
  2311.               }
  2312.               if (!quiet) {
  2313. ***************
  2314. *** 176,182 ****
  2315.               continue;
  2316.               }
  2317.               err += patched((char *)0);
  2318. !             if ((cp = rindex(update_dir, '/')) != NULL)
  2319.               *cp = '\0';
  2320.               else
  2321.               update_dir[0] = '\0';
  2322. --- 176,182 ----
  2323.               continue;
  2324.               }
  2325.               err += patched((char *)0);
  2326. !             if ((cp = rindex_sep(update_dir)) != NULL)
  2327.               *cp = '\0';
  2328.               else
  2329.               update_dir[0] = '\0';
  2330. ***************
  2331. *** 225,231 ****
  2332.       if (patch_short) {
  2333.       printf("File ");
  2334.       if (update_dir[0] != '\0')
  2335. !         printf("%s/", update_dir);
  2336.       if (vers_tag[0] == '\0')
  2337.           printf("%s is new; current revision %s\n", rcs, vers_head);
  2338.       else
  2339. --- 225,231 ----
  2340.       if (patch_short) {
  2341.       printf("File ");
  2342.       if (update_dir[0] != '\0')
  2343. !         printf("%s%c", update_dir, DIRSEP);
  2344.       if (vers_tag[0] == '\0')
  2345.           printf("%s is new; current revision %s\n", rcs, vers_head);
  2346.       else
  2347. ***************
  2348. *** 233,241 ****
  2349.              rcs, vers_tag, vers_head);
  2350.       return (0);
  2351.       }
  2352. !     (void) strcpy(tmpfile1, "/tmp/cvspatch.XXXXXX");
  2353. !     (void) strcpy(tmpfile2, "/tmp/cvspatch.XXXXXX");
  2354. !     (void) strcpy(tmpfile3, "/tmp/cvspatch.XXXXXX");
  2355.       fd1 = mkstemp(tmpfile1);    (void) close(fd1);
  2356.       fd2 = mkstemp(tmpfile2);    (void) close(fd2);
  2357.       fd3 = mkstemp(tmpfile3);    (void) close(fd3);
  2358. --- 233,241 ----
  2359.              rcs, vers_tag, vers_head);
  2360.       return (0);
  2361.       }
  2362. !     (void) sprintf(tmpfile1, "%s%ccpXXXXXX", Tmpdir, DIRSEP);
  2363. !     (void) sprintf(tmpfile2, "%s%ccpXXXXXX", Tmpdir, DIRSEP);
  2364. !     (void) sprintf(tmpfile3, "%s%ccpXXXXXX", Tmpdir, DIRSEP);
  2365.       fd1 = mkstemp(tmpfile1);    (void) close(fd1);
  2366.       fd2 = mkstemp(tmpfile2);    (void) close(fd2);
  2367.       fd3 = mkstemp(tmpfile3);    (void) close(fd3);
  2368. ***************
  2369. *** 245,251 ****
  2370.       goto out;
  2371.       }
  2372.       if (vers_tag[0] != '\0') {
  2373. !     (void) sprintf(prog, "%s/%s -p -q -r%s %s > %s", Rcsbin, RCS_CO,
  2374.                  vers_tag, rcs, tmpfile1);
  2375.       if (system(prog) != 0) {
  2376.           if (!really_quiet)
  2377. --- 245,251 ----
  2378.       goto out;
  2379.       }
  2380.       if (vers_tag[0] != '\0') {
  2381. !     (void) sprintf(prog, "%s -p -q -r%s %s >%s", RCS_CO,
  2382.                  vers_tag, rcs, tmpfile1);
  2383.       if (system(prog) != 0) {
  2384.           if (!really_quiet)
  2385. ***************
  2386. *** 257,263 ****
  2387.       ret = 1;
  2388.       goto out;
  2389.       }
  2390. !     (void) sprintf(prog, "%s/%s -p -q -r%s %s > %s", Rcsbin, RCS_CO,
  2391.              vers_head, rcs, tmpfile2);
  2392.       if (system(prog) != 0) {
  2393.       if (!really_quiet)
  2394. --- 257,263 ----
  2395.       ret = 1;
  2396.       goto out;
  2397.       }
  2398. !     (void) sprintf(prog, "%s -p -q -r%s %s >%s", RCS_CO,
  2399.              vers_head, rcs, tmpfile2);
  2400.       if (system(prog) != 0) {
  2401.       if (!really_quiet)
  2402. ***************
  2403. *** 295,301 ****
  2404.           goto out;
  2405.       }
  2406.       if (CVSroot != NULL)
  2407. !         (void) sprintf(strippath, "%s/", CVSroot);
  2408.       else
  2409.           (void) strcpy(strippath, REPOS_STRIP);
  2410.       if (strncmp(rcs, strippath, strlen(strippath)) == 0)
  2411. --- 295,301 ----
  2412.           goto out;
  2413.       }
  2414.       if (CVSroot != NULL)
  2415. !         (void) sprintf(strippath, "%s%c", CVSroot, DIRSEP);
  2416.       else
  2417.           (void) strcpy(strippath, REPOS_STRIP);
  2418.       if (strncmp(rcs, strippath, strlen(strippath)) == 0)
  2419. ***************
  2420. *** 303,318 ****
  2421.       *rindex(rcs, ',') = '\0';
  2422.       if (vers_tag[0] != '\0') {
  2423.           (void) sprintf(file1, "%s%s%s:%s", update_dir,
  2424. !                update_dir[0] ? "/" : "", rcs, vers_tag);
  2425.       } else {
  2426.           (void) strcpy(file1, DEVNULL);
  2427.       }
  2428.           (void) sprintf(file2, "%s%s%s:%s", update_dir,
  2429. !                update_dir[0] ? "/" : "", rcs, vers_head);
  2430.       printf("diff -c %s %s\n", file1, file2);
  2431.       printf("*** %s%s--- ", file1, cp1);
  2432.       if (update_dir[0] != '\0')
  2433. !         printf("%s/", update_dir);
  2434.       printf("%s%s", rcs, cp2);
  2435.       while (fgets(line1, sizeof(line1), fp) != NULL)
  2436.           printf("%s", line1);
  2437. --- 303,319 ----
  2438.       *rindex(rcs, ',') = '\0';
  2439.       if (vers_tag[0] != '\0') {
  2440.           (void) sprintf(file1, "%s%s%s:%s", update_dir,
  2441. !                update_dir[0] ? DIRSEPSTR : "", rcs, vers_tag);
  2442.       } else {
  2443.           (void) strcpy(file1, DEVNULL);
  2444.       }
  2445.           (void) sprintf(file2, "%s%s%s:%s", update_dir,
  2446. !                 update_dir[0] ? DIRSEPSTR : "", rcs, vers_head);
  2447.       printf("diff -c %s %s\n", file1, file2);
  2448.       printf("*** %s%s--- ", file1, cp1);
  2449. +     /* but these dates pointed to by cp1 and cp2 aren't very useful ?!? */
  2450.       if (update_dir[0] != '\0')
  2451. !         printf("%s%c", update_dir, DIRSEP);
  2452.       printf("%s%s", rcs, cp2);
  2453.       while (fgets(line1, sizeof(line1), fp) != NULL)
  2454.           printf("%s", line1);
  2455. ***************
  2456. *** 383,388 ****
  2457. --- 384,390 ----
  2458.       }
  2459.       }
  2460.       (void) fclose(fp);
  2461. +     strcpy(date, cp);
  2462.       return (ret);
  2463.   }
  2464.   
  2465. Only in src: pc-files
  2466. diff -cb orig/register.c src/register.c
  2467. *** orig/register.c    Sun Feb 23 15:02:36 1992
  2468. --- src/register.c    Sun Jan 19 15:35:44 1992
  2469. ***************
  2470. *** 1,6 ****
  2471.   #ifndef lint
  2472.   static char rcsid[] = "$Id: register.c,v 1.5 89/11/19 23:20:21 berliner Exp $";
  2473. ! #endif !lint
  2474.   
  2475.   /*
  2476.    *    Copyright (c) 1989, Brian Berliner
  2477. --- 1,6 ----
  2478.   #ifndef lint
  2479.   static char rcsid[] = "$Id: register.c,v 1.5 89/11/19 23:20:21 berliner Exp $";
  2480. ! #endif 
  2481.   
  2482.   /*
  2483.    *    Copyright (c) 1989, Brian Berliner
  2484. diff -cb orig/remove.c src/remove.c
  2485. *** orig/remove.c    Sun Feb 23 15:02:38 1992
  2486. --- src/remove.c    Sun Feb 23 18:10:58 1992
  2487. ***************
  2488. *** 1,6 ****
  2489.   #ifndef lint
  2490.   static char rcsid[] = "$Id: remove.c,v 1.9 89/11/19 23:40:43 berliner Exp $";
  2491. ! #endif !lint
  2492.   
  2493.   /*
  2494.    *    Copyright (c) 1989, Brian Berliner
  2495. --- 1,6 ----
  2496.   #ifndef lint
  2497.   static char rcsid[] = "$Id: remove.c,v 1.9 89/11/19 23:40:43 berliner Exp $";
  2498. ! #endif 
  2499.   
  2500.   /*
  2501.    *    Copyright (c) 1989, Brian Berliner
  2502. ***************
  2503. *** 19,28 ****
  2504.    *    for "remove" to work correctly.
  2505.    */
  2506.   
  2507. - #include <sys/param.h>
  2508.   #include "cvs.h"
  2509.   
  2510. ! remove(argc, argv)
  2511.       int argc;
  2512.       char *argv[];
  2513.   {
  2514. --- 19,27 ----
  2515.    *    for "remove" to work correctly.
  2516.    */
  2517.   
  2518.   #include "cvs.h"
  2519.   
  2520. ! _remove(argc, argv)
  2521.       int argc;
  2522.       char *argv[];
  2523.   {
  2524. ***************
  2525. *** 53,62 ****
  2526.            * the entries file.
  2527.            */
  2528.           Scratch_Entry(User);
  2529. !         (void) sprintf(fname, "%s/%s%s", CVSADM, User, CVSEXT_OPT);
  2530.           (void) unlink(fname);
  2531. !         (void) sprintf(fname, "%s/%s%s", CVSADM, User, CVSEXT_LOG);
  2532.           (void) unlink(fname);
  2533.       } else if (VN_User[0] == '-') {
  2534.           /*
  2535.            * It's already been flagged for removal, nothing more to do.
  2536. --- 52,63 ----
  2537.            * the entries file.
  2538.            */
  2539.           Scratch_Entry(User);
  2540. !         (void) sprintf(fname, "%s%c%s", CVSEXT_OPT, DIRSEP, User);
  2541.           (void) unlink(fname);
  2542. !         (void) rmdir(CVSEXT_OPT);
  2543. !         (void) sprintf(fname, "%s%c%s", CVSEXT_LOG, DIRSEP, User);
  2544.           (void) unlink(fname);
  2545. +         (void) rmdir(CVSEXT_LOG);
  2546.       } else if (VN_User[0] == '-') {
  2547.           /*
  2548.            * It's already been flagged for removal, nothing more to do.
  2549. diff -cb orig/scratch_entry.c src/scratch_entry.c
  2550. *** orig/scratch_entry.c    Sun Feb 23 15:02:38 1992
  2551. --- src/scratch_entry.c    Sun Jan 19 15:35:44 1992
  2552. ***************
  2553. *** 1,6 ****
  2554.   #ifndef lint
  2555.   static char rcsid[] = "$Id: scratch_entry.c,v 1.5 89/11/19 23:20:24 berliner Exp $";
  2556. ! #endif !lint
  2557.   
  2558.   /*
  2559.    *    Copyright (c) 1989, Brian Berliner
  2560. --- 1,6 ----
  2561.   #ifndef lint
  2562.   static char rcsid[] = "$Id: scratch_entry.c,v 1.5 89/11/19 23:20:24 berliner Exp $";
  2563. ! #endif 
  2564.   
  2565.   /*
  2566.    *    Copyright (c) 1989, Brian Berliner
  2567. ***************
  2568. *** 14,20 ****
  2569.    * Entries file is placed in Entries.backup.
  2570.    */
  2571.   
  2572. ! #include <sys/param.h>
  2573.   #include "cvs.h"
  2574.   
  2575.   Scratch_Entry(fname)
  2576. --- 14,20 ----
  2577.    * Entries file is placed in Entries.backup.
  2578.    */
  2579.   
  2580. ! #include <stdlib.h>
  2581.   #include "cvs.h"
  2582.   
  2583.   Scratch_Entry(fname)
  2584. ***************
  2585. *** 29,35 ****
  2586.       fpout = open_file(CVSADM_ENT, "w+");
  2587.       while (fgets(line, sizeof(line), fpin) != NULL) {
  2588.       if ((cpend = rindex(line, '|')) && (cp = rindex(line, ' ')) &&
  2589. !         (cp++) && strncmp(fname, cp, MAX((cpend-cp), strlen(fname))) == 0)
  2590.           continue;
  2591.       if (fputs(line, fpout) == EOF)
  2592.           error(1, "cannot write file %s", CVSADM_ENT);
  2593. --- 29,35 ----
  2594.       fpout = open_file(CVSADM_ENT, "w+");
  2595.       while (fgets(line, sizeof(line), fpin) != NULL) {
  2596.       if ((cpend = rindex(line, '|')) && (cp = rindex(line, ' ')) &&
  2597. !         (cp++) && strncmp(fname, cp, max((cpend-cp), strlen(fname))) == 0)
  2598.           continue;
  2599.       if (fputs(line, fpout) == EOF)
  2600.           error(1, "cannot write file %s", CVSADM_ENT);
  2601. diff -cb orig/set_lock.c src/set_lock.c
  2602. *** orig/set_lock.c    Sun Feb 23 15:02:38 1992
  2603. --- src/set_lock.c    Sun Feb 23 18:23:58 1992
  2604. ***************
  2605. *** 1,6 ****
  2606.   #ifndef lint
  2607.   static char rcsid[] = "$Id: set_lock.c,v 1.8 89/11/19 23:20:26 berliner Exp $";
  2608. ! #endif !lint
  2609.   
  2610.   /*
  2611.    *    Copyright (c) 1989, Brian Berliner
  2612. --- 1,6 ----
  2613.   #ifndef lint
  2614.   static char rcsid[] = "$Id: set_lock.c,v 1.8 89/11/19 23:20:26 berliner Exp $";
  2615. ! #endif 
  2616.   
  2617.   /*
  2618.    *    Copyright (c) 1989, Brian Berliner
  2619. ***************
  2620. *** 15,25 ****
  2621.    * Maybe some day, others will too.
  2622.    */
  2623.   
  2624. - #include <sys/param.h>
  2625.   #include <sys/types.h>
  2626.   #include <sys/stat.h>
  2627.   #include <signal.h>
  2628. ! #include <dirent.h>
  2629.   #include "cvs.h"
  2630.   
  2631.   static char lckdir[MAXPATHLEN], lckrfl[MAXPATHLEN], lckwfl[MAXPATHLEN];
  2632. --- 15,24 ----
  2633.    * Maybe some day, others will too.
  2634.    */
  2635.   
  2636.   #include <sys/types.h>
  2637.   #include <sys/stat.h>
  2638.   #include <signal.h>
  2639. ! #include "dir.h"
  2640.   #include "cvs.h"
  2641.   
  2642.   static char lckdir[MAXPATHLEN], lckrfl[MAXPATHLEN], lckwfl[MAXPATHLEN];
  2643. ***************
  2644. *** 68,84 ****
  2645.       time_t now;
  2646.       FILE *fp;
  2647.   
  2648. !     (void) sprintf(lckdir, "%s/%s", Repository, CVSLCK);
  2649. !     (void) sprintf(lckrfl, "%s/%s.%d", Repository, CVSTFL, getpid());
  2650. !     (void) signal(SIGHUP, Lock_Cleanup);
  2651.       (void) signal(SIGINT, Lock_Cleanup);
  2652. -     (void) signal(SIGQUIT, Lock_Cleanup);
  2653.       (void) signal(SIGTERM, Lock_Cleanup);
  2654.       if ((fp = fopen(lckrfl, "w+")) != NULL) {
  2655.       (void) fclose(fp);
  2656.       (void) unlink(lckrfl);
  2657.       set_lock(lckdir);
  2658. !     (void) sprintf(lckrfl, "%s/%s.%d", Repository, CVSRFL, getpid());
  2659.       if ((fp = fopen(lckrfl, "w+")) == NULL)
  2660.           warn(1, "cannot create read lock file %s", lckrfl);
  2661.       else
  2662. --- 67,82 ----
  2663.       time_t now;
  2664.       FILE *fp;
  2665.   
  2666. !     (void) sprintf(lckdir, "%s%c%s", Repository, DIRSEP, CVSLCK);
  2667. !     (void) sprintf(lckrfl, "%s%c%s%04x", Repository, DIRSEP, CVSTFL, getpid());
  2668.       (void) signal(SIGINT, Lock_Cleanup);
  2669.       (void) signal(SIGTERM, Lock_Cleanup);
  2670. +     (void) signal(SIGBREAK, Lock_Cleanup);
  2671.       if ((fp = fopen(lckrfl, "w+")) != NULL) {
  2672.       (void) fclose(fp);
  2673.       (void) unlink(lckrfl);
  2674.       set_lock(lckdir);
  2675. !     (void) sprintf(lckrfl, "%s%c%s%04x", Repository, DIRSEP, CVSRFL, getpid());
  2676.       if ((fp = fopen(lckrfl, "w+")) == NULL)
  2677.           warn(1, "cannot create read lock file %s", lckrfl);
  2678.       else
  2679. ***************
  2680. *** 113,130 ****
  2681.   {
  2682.       FILE *fp;
  2683.   
  2684. !     (void) sprintf(lckdir, "%s/%s", Repository, CVSLCK);
  2685. !     (void) sprintf(lckrfl, "%s/%s.%d", Repository, CVSTFL, getpid());
  2686. !     (void) sprintf(lckwfl, "%s/%s.%d", Repository, CVSWFL, getpid());
  2687. !     (void) signal(SIGHUP, Lock_Cleanup);
  2688.       (void) signal(SIGINT, Lock_Cleanup);
  2689. -     (void) signal(SIGQUIT, Lock_Cleanup);
  2690.       (void) signal(SIGTERM, Lock_Cleanup);
  2691.       if ((fp = fopen(lckrfl, "w+")) == NULL)
  2692.       error(1, "you have no write permission in %s", Repository);
  2693.       (void) fclose(fp);
  2694.       (void) unlink(lckrfl);
  2695. !     (void) sprintf(lckrfl, "%s/%s.%d", Repository, CVSRFL, getpid());
  2696.       set_lock(lckdir);
  2697.       if ((fp = fopen(lckwfl, "w+")) == NULL)
  2698.       warn(1, "cannot create write lock file %s", lckwfl);
  2699. --- 111,127 ----
  2700.   {
  2701.       FILE *fp;
  2702.   
  2703. !     (void) sprintf(lckdir, "%s%c%s", Repository, DIRSEP, CVSLCK);
  2704. !     (void) sprintf(lckrfl, "%s%c%s%04x", Repository, DIRSEP, CVSTFL, getpid());
  2705. !     (void) sprintf(lckwfl, "%s%c%s%04x", Repository, DIRSEP, CVSWFL, getpid());
  2706.       (void) signal(SIGINT, Lock_Cleanup);
  2707.       (void) signal(SIGTERM, Lock_Cleanup);
  2708. +     (void) signal(SIGBREAK, Lock_Cleanup);
  2709.       if ((fp = fopen(lckrfl, "w+")) == NULL)
  2710.       error(1, "you have no write permission in %s", Repository);
  2711.       (void) fclose(fp);
  2712.       (void) unlink(lckrfl);
  2713. !     (void) sprintf(lckrfl, "%s%c%s%04x", Repository, DIRSEP, CVSRFL, getpid());
  2714.       set_lock(lckdir);
  2715.       if ((fp = fopen(lckwfl, "w+")) == NULL)
  2716.       warn(1, "cannot create write lock file %s", lckwfl);
  2717. ***************
  2718. *** 175,181 ****
  2719.            * seconds ago, try to clean-up the lock file, and if
  2720.            * successful, re-open the directory and try again.
  2721.            */
  2722. !         (void) sprintf(line, "%s/%s", Repository, dp->d_name);
  2723.           if (stat(line, &sb) != -1 && now >= (sb.st_ctime + CVSLCKAGE)) {
  2724.           if (unlink(line) != -1) {
  2725.               (void) closedir(dirp);
  2726. --- 172,178 ----
  2727.            * seconds ago, try to clean-up the lock file, and if
  2728.            * successful, re-open the directory and try again.
  2729.            */
  2730. !         (void) sprintf(line, "%s%c%s", Repository, DIRSEP, dp->d_name);
  2731.           if (stat(line, &sb) != -1 && now >= (sb.st_ctime + CVSLCKAGE)) {
  2732.           if (unlink(line) != -1) {
  2733.               (void) closedir(dirp);
  2734. ***************
  2735. *** 231,234 ****
  2736. --- 228,232 ----
  2737.       }
  2738.       }
  2739.   }
  2740.   
  2741. diff -cb orig/status.c src/status.c
  2742. *** orig/status.c    Sun Feb 23 15:02:38 1992
  2743. --- src/status.c    Sun Jan 19 15:35:44 1992
  2744. ***************
  2745. *** 1,6 ****
  2746.   #ifndef lint
  2747.   static char rcsid[] = "$Id: status.c,v 1.13 89/11/19 23:40:44 berliner Exp $";
  2748. ! #endif !lint
  2749.   
  2750.   /*
  2751.    *    Copyright (c) 1989, Brian Berliner
  2752. --- 1,6 ----
  2753.   #ifndef lint
  2754.   static char rcsid[] = "$Id: status.c,v 1.13 89/11/19 23:40:44 berliner Exp $";
  2755. ! #endif 
  2756.   
  2757.   /*
  2758.    *    Copyright (c) 1989, Brian Berliner
  2759. diff -cb orig/subr.c src/subr.c
  2760. *** orig/subr.c    Sun Feb 23 15:02:40 1992
  2761. --- src/subr.c    Sun Jan 19 22:54:22 1992
  2762. ***************
  2763. *** 1,6 ****
  2764.   #ifndef lint
  2765.   static char rcsid[] = "$Id: subr.c,v 1.14.1.2 91/01/29 19:46:20 berliner Exp $";
  2766. ! #endif !lint
  2767.   
  2768.   /*
  2769.    *    Copyright (c) 1989, Brian Berliner
  2770. --- 1,6 ----
  2771.   #ifndef lint
  2772.   static char rcsid[] = "$Id: subr.c,v 1.14.1.2 91/01/29 19:46:20 berliner Exp $";
  2773. ! #endif
  2774.   
  2775.   /*
  2776.    *    Copyright (c) 1989, Brian Berliner
  2777. ***************
  2778. *** 13,20 ****
  2779.   
  2780.   #include <sys/types.h>
  2781.   #include <sys/stat.h>
  2782. ! #include <sys/file.h>
  2783. ! #include <varargs.h>
  2784.   #include "cvs.h"
  2785.   
  2786.   /*
  2787. --- 13,20 ----
  2788.   
  2789.   #include <sys/types.h>
  2790.   #include <sys/stat.h>
  2791. ! #include <fcntl.h>
  2792. ! #include <stdarg.h>
  2793.   #include "cvs.h"
  2794.   
  2795.   /*
  2796. ***************
  2797. *** 21,36 ****
  2798.    * Send a "printf" format string to stderr and die, calling the
  2799.    * defined exit function first, if necessary
  2800.    */
  2801. ! error(doperror, fmt, va_alist)
  2802.       int doperror;
  2803.       char *fmt;
  2804. -     va_dcl
  2805.   {
  2806. -     extern int errno;
  2807.       va_list x1;
  2808.       int err = errno;
  2809.   
  2810. !     va_start(x1);
  2811.       (void) fprintf(stderr, "%s: ", progname);
  2812.       (void) vfprintf(stderr, fmt, x1);
  2813.       if (doperror) {
  2814. --- 21,34 ----
  2815.    * Send a "printf" format string to stderr and die, calling the
  2816.    * defined exit function first, if necessary
  2817.    */
  2818. ! error(doperror, fmt, ...)
  2819.       int doperror;
  2820.       char *fmt;
  2821.   {
  2822.       va_list x1;
  2823.       int err = errno;
  2824.   
  2825. !     va_start(x1, fmt);
  2826.       (void) fprintf(stderr, "%s: ", progname);
  2827.       (void) vfprintf(stderr, fmt, x1);
  2828.       if (doperror) {
  2829. ***************
  2830. *** 49,64 ****
  2831.    * Like error() above, but just display the message to stderr,
  2832.    * without dying or running the exit function.
  2833.    */
  2834. ! warn(doperror, fmt, va_alist)
  2835.       int doperror;
  2836.       char *fmt;
  2837. -     va_dcl
  2838.   {
  2839. -     extern int errno;
  2840.       va_list x1;
  2841.       int err = errno;
  2842.   
  2843. !     va_start(x1);
  2844.       (void) fprintf(stderr, "%s: ", progname);
  2845.       (void) vfprintf(stderr, fmt, x1);
  2846.       if (doperror) {
  2847. --- 47,60 ----
  2848.    * Like error() above, but just display the message to stderr,
  2849.    * without dying or running the exit function.
  2850.    */
  2851. ! warn(doperror, fmt, ...)
  2852.       int doperror;
  2853.       char *fmt;
  2854.   {
  2855.       va_list x1;
  2856.       int err = errno;
  2857.   
  2858. !     va_start(x1, fmt);
  2859.       (void) fprintf(stderr, "%s: ", progname);
  2860.       (void) vfprintf(stderr, fmt, x1);
  2861.       if (doperror) {
  2862. ***************
  2863. *** 82,102 ****
  2864.       char *to;
  2865.   {
  2866.       struct stat sb;
  2867. !     int fdin, fdout;
  2868.       char *buf;
  2869.   
  2870. !     if ((fdin = open(from, O_RDONLY)) < 0)
  2871.       error(1, "cannot open %s for copying", from);
  2872.       if (fstat(fdin, &sb) < 0)
  2873.       error(1, "cannot fstat %s", from);
  2874. !     if ((fdout = creat(to, (int) sb.st_mode & 07777)) < 0)
  2875.       error(1, "cannot create %s for copying", to);
  2876.       if (sb.st_size > 0) {
  2877. !     buf = xmalloc((int)sb.st_size);
  2878. !     if (read(fdin, buf, (int)sb.st_size) != (int)sb.st_size)
  2879.               error(1, "cannot read file %s for copying", from);
  2880. !     if (write(fdout, buf, (int)sb.st_size) != (int)sb.st_size)
  2881.               error(1, "cannot write file %s for copying", to);
  2882.       free(buf);
  2883.       }
  2884.       (void) close(fdin);
  2885. --- 78,102 ----
  2886.       char *to;
  2887.   {
  2888.       struct stat sb;
  2889. !     int fdin, fdout, chunk;
  2890.       char *buf;
  2891.   
  2892. !     if ((fdin = open(from, O_RDONLY|O_BINARY)) < 0)
  2893.       error(1, "cannot open %s for copying", from);
  2894.       if (fstat(fdin, &sb) < 0)
  2895.       error(1, "cannot fstat %s", from);
  2896. !     if ((fdout = open(to, O_CREAT|O_EXCL|O_RDWR|O_BINARY,
  2897. !                       (int) sb.st_mode & 07777)) < 0)
  2898.       error(1, "cannot create %s for copying", to);
  2899.       if (sb.st_size > 0) {
  2900. !     buf = xmalloc(COPYBUFFER);
  2901. !         while ( (chunk = (int) min(sb.st_size, COPYBUFFER)) > 0 ) {
  2902. !         if (read(fdin, buf, chunk) != chunk)
  2903.               error(1, "cannot read file %s for copying", from);
  2904. !         if (write(fdout, buf, chunk) != chunk)
  2905.               error(1, "cannot write file %s for copying", to);
  2906. +             sb.st_size -= chunk;
  2907. +         }
  2908.       free(buf);
  2909.       }
  2910.       (void) close(fdin);
  2911. ***************
  2912. *** 199,205 ****
  2913.   xmalloc(bytes)
  2914.       int bytes;
  2915.   {
  2916. -     extern char *malloc();
  2917.       char *cp;
  2918.   
  2919.       if (bytes <= 0)
  2920. --- 199,204 ----
  2921. ***************
  2922. *** 239,251 ****
  2923.   /* Some UNIX distributions don't include these in their stat.h */
  2924.   #ifndef S_IWRITE
  2925.   #define    S_IWRITE    0000200        /* write permission, owner */
  2926. ! #endif !S_IWRITE
  2927.   #ifndef S_IWGRP
  2928.   #define    S_IWGRP        0000020        /* write permission, grougroup */
  2929. ! #endif !S_IWGRP
  2930.   #ifndef S_IWOTH
  2931.   #define    S_IWOTH        0000002        /* write permission, other */
  2932. ! #endif !S_IWOTH
  2933.   
  2934.   /*
  2935.    * Change the mode of a file, either adding write permissions, or
  2936. --- 238,250 ----
  2937.   /* Some UNIX distributions don't include these in their stat.h */
  2938.   #ifndef S_IWRITE
  2939.   #define    S_IWRITE    0000200        /* write permission, owner */
  2940. ! #endif
  2941.   #ifndef S_IWGRP
  2942.   #define    S_IWGRP        0000020        /* write permission, grougroup */
  2943. ! #endif
  2944.   #ifndef S_IWOTH
  2945.   #define    S_IWOTH        0000002        /* write permission, other */
  2946. ! #endif
  2947.   
  2948.   /*
  2949.    * Change the mode of a file, either adding write permissions, or
  2950. ***************
  2951. *** 261,267 ****
  2952.   
  2953.       if (stat(fname, &sb) < 0) {
  2954.       warn(1, "cannot stat %s", fname);
  2955. !     return;
  2956.       }
  2957.       if (writable) {
  2958.       oumask = umask(0);
  2959. --- 260,266 ----
  2960.   
  2961.       if (stat(fname, &sb) < 0) {
  2962.       warn(1, "cannot stat %s", fname);
  2963. !     return 0;
  2964.       }
  2965.       if (writable) {
  2966.       oumask = umask(0);
  2967. ***************
  2968. *** 281,286 ****
  2969. --- 280,286 ----
  2970.       char *from;
  2971.       char *to;
  2972.   {
  2973. +     (void) unlink(to);
  2974.       if (rename(from, to) < 0)
  2975.       error(1, "cannot rename file %s to %s", from, to);
  2976.   }
  2977. ***************
  2978. *** 300,310 ****
  2979.       register char *buf1, *buf2;
  2980.       struct stat sb;
  2981.       off_t size;
  2982. !     int ret, fd1, fd2;
  2983.   
  2984. !     if ((fd1 = open(file1, O_RDONLY)) < 0)
  2985.       error(1, "cannot open file %s for comparing", file1);
  2986. !     if ((fd2 = open(file2, O_RDONLY)) < 0)
  2987.       error(1, "cannot open file %s for comparing", file2);
  2988.       if (fstat(fd1, &sb) < 0)
  2989.       error(1, "cannot fstat %s", file1);
  2990. --- 300,310 ----
  2991.       register char *buf1, *buf2;
  2992.       struct stat sb;
  2993.       off_t size;
  2994. !     int ret, fd1, fd2, chunk;
  2995.   
  2996. !     if ((fd1 = open(file1, O_RDONLY|O_BINARY)) < 0)
  2997.       error(1, "cannot open file %s for comparing", file1);
  2998. !     if ((fd2 = open(file2, O_RDONLY|O_BINARY)) < 0)
  2999.       error(1, "cannot open file %s for comparing", file2);
  3000.       if (fstat(fd1, &sb) < 0)
  3001.       error(1, "cannot fstat %s", file1);
  3002. ***************
  3003. *** 315,327 ****
  3004.       if (size == 0)
  3005.           ret = 0;
  3006.       else {
  3007. !         buf1 = xmalloc((int)size);
  3008. !         buf2 = xmalloc((int)size);
  3009. !         if (read(fd1, buf1, (int)size) != (int)size)
  3010.               error(1, "cannot read file %s cor comparing", file1);
  3011. !         if (read(fd2, buf2, (int)size) != (int)size)
  3012.               error(1, "cannot read file %s for comparing", file2);
  3013. !         ret = bcmp(buf1, buf2, (int)size);
  3014.           free(buf1);
  3015.           free(buf2);
  3016.       }
  3017. --- 315,331 ----
  3018.       if (size == 0)
  3019.           ret = 0;
  3020.       else {
  3021. !         buf1 = xmalloc(COPYBUFFER);
  3022. !         buf2 = xmalloc(COPYBUFFER);
  3023. !             while ( (chunk = (int) min(sb.st_size, COPYBUFFER)) > 0 ) {
  3024. !             if (read(fd1, buf1, chunk) != chunk)
  3025.               error(1, "cannot read file %s cor comparing", file1);
  3026. !             if (read(fd2, buf2, chunk) != chunk)
  3027.               error(1, "cannot read file %s for comparing", file2);
  3028. !             if ( ret = bcmp(buf1, buf2, chunk) )
  3029. !                     break;
  3030. !                 sb.st_size -= chunk;
  3031. !             }
  3032.           free(buf1);
  3033.           free(buf2);
  3034.       }
  3035. ***************
  3036. *** 382,384 ****
  3037. --- 386,410 ----
  3038.       }
  3039.       return (dots);
  3040.   }
  3041. + #ifdef OS2
  3042. + char *index_sep(char *path)
  3043. + {
  3044. +   char *p1 = strchr(path, '\\');
  3045. +   char *p2 = strchr(path, '/');
  3046. +   if ( !p1 ) return p2;
  3047. +   if ( !p2 ) return p1;
  3048. +   return (p1 > p2) ? p2 : p1;
  3049. + }
  3050. + char *rindex_sep(char *path)
  3051. + {
  3052. +   char *p1 = strrchr(path, '\\');
  3053. +   char *p2 = strrchr(path, '/');
  3054. +   if ( !p1 ) return p2;
  3055. +   if ( !p2 ) return p1;
  3056. +   return (p1 > p2) ? p1 : p2;
  3057. + }
  3058. + #endif
  3059. diff -cb orig/tag.c src/tag.c
  3060. *** orig/tag.c    Sun Feb 23 15:02:40 1992
  3061. --- src/tag.c    Sun Feb 23 19:11:06 1992
  3062. ***************
  3063. *** 1,6 ****
  3064.   #ifndef lint
  3065.   static char rcsid[] = "$Id: tag.c,v 1.19.1.2 91/01/29 19:45:54 berliner Exp $";
  3066. ! #endif !lint
  3067.   
  3068.   /*
  3069.    *    Copyright (c) 1989, Brian Berliner
  3070. --- 1,6 ----
  3071.   #ifndef lint
  3072.   static char rcsid[] = "$Id: tag.c,v 1.19.1.2 91/01/29 19:45:54 berliner Exp $";
  3073. ! #endif 
  3074.   
  3075.   /*
  3076.    *    Copyright (c) 1989, Brian Berliner
  3077. ***************
  3078. *** 14,23 ****
  3079.    *    of RCS files.  Uses the modules database, if necessary.
  3080.    */
  3081.   
  3082. ! #include <sys/param.h>
  3083. ! #include <ndbm.h>
  3084. ! #include <dirent.h>
  3085.   #include <ctype.h>
  3086.   #include "cvs.h"
  3087.   
  3088.   extern char update_dir[];
  3089. --- 14,22 ----
  3090.    *    of RCS files.  Uses the modules database, if necessary.
  3091.    */
  3092.   
  3093. ! #include <sys/types.h>
  3094.   #include <ctype.h>
  3095. + #include "dir.h"
  3096.   #include "cvs.h"
  3097.   
  3098.   extern char update_dir[];
  3099. ***************
  3100. *** 26,32 ****
  3101.   
  3102.   static char *symtag;
  3103.   static char *numtag = "";        /* must be null string, not pointer */
  3104. ! static int delete = 0;            /* adding a tag by default */
  3105.   static int tag_recursive = 1;        /* recursive by default */
  3106.   
  3107.   tag(argc, argv)
  3108. --- 25,31 ----
  3109.   
  3110.   static char *symtag;
  3111.   static char *numtag = "";        /* must be null string, not pointer */
  3112. ! static int _delete = 0;            /* adding a tag by default */
  3113.   static int tag_recursive = 1;        /* recursive by default */
  3114.   
  3115.   tag(argc, argv)
  3116. ***************
  3117. *** 56,62 ****
  3118.           tag_recursive = 0;
  3119.           break;
  3120.       case 'd':
  3121. !         delete = 1;
  3122.           /* FALL THROUGH */
  3123.       case 'f':
  3124.           /*
  3125. --- 55,61 ----
  3126.           tag_recursive = 0;
  3127.           break;
  3128.       case 'd':
  3129. !         _delete = 1;
  3130.           /* FALL THROUGH */
  3131.       case 'f':
  3132.           /*
  3133. ***************
  3134. *** 124,133 ****
  3135.           } while ((dp = readdir(dirp)) != NULL) {
  3136.           if (strcmp(dp->d_name, ".") == 0 ||
  3137.               strcmp(dp->d_name, "..") == 0 ||
  3138. !             strcmp(dp->d_name, CVSLCK) == 0)
  3139.               continue;
  3140. !         if (strcmp(dp->d_name, CVSATTIC) == 0 &&
  3141. !             !delete && numtag[0] == '\0')
  3142.               continue;
  3143.           if (isdir(dp->d_name) && tag_recursive) {
  3144.               char cwd[MAXPATHLEN];
  3145. --- 123,132 ----
  3146.           } while ((dp = readdir(dirp)) != NULL) {
  3147.           if (strcmp(dp->d_name, ".") == 0 ||
  3148.               strcmp(dp->d_name, "..") == 0 ||
  3149. !             stricmp(dp->d_name, CVSLCK) == 0)
  3150.               continue;
  3151. !         if (stricmp(dp->d_name, CVSATTIC) == 0 &&
  3152. !             !_delete && numtag[0] == '\0')
  3153.               continue;
  3154.           if (isdir(dp->d_name) && tag_recursive) {
  3155.               char cwd[MAXPATHLEN];
  3156. ***************
  3157. *** 139,145 ****
  3158.               if (update_dir[0] == '\0') {
  3159.               (void) strcpy(update_dir, dp->d_name);
  3160.               } else {
  3161. !             (void) strcat(update_dir, "/");
  3162.               (void) strcat(update_dir, dp->d_name);
  3163.               }
  3164.               if (!quiet) {
  3165. --- 138,144 ----
  3166.               if (update_dir[0] == '\0') {
  3167.               (void) strcpy(update_dir, dp->d_name);
  3168.               } else {
  3169. !             (void) strcat(update_dir, DIRSEPSTR);
  3170.               (void) strcat(update_dir, dp->d_name);
  3171.               }
  3172.               if (!quiet) {
  3173. ***************
  3174. *** 151,157 ****
  3175.               continue;
  3176.               }
  3177.               err += tagit((char *)0);
  3178. !             if ((cp = rindex(update_dir, '/')) != NULL)
  3179.               *cp = '\0';
  3180.               else
  3181.               update_dir[0] = '\0';
  3182. --- 150,156 ----
  3183.               continue;
  3184.               }
  3185.               err += tagit((char *)0);
  3186. !             if ((cp = rindex_sep(update_dir)) != NULL)
  3187.               *cp = '\0';
  3188.               else
  3189.               update_dir[0] = '\0';
  3190. ***************
  3191. *** 200,206 ****
  3192.       }
  3193.   #endif
  3194.   
  3195. !     if (delete) {
  3196.       /*
  3197.        * If -d is specified, "force_tag_match" is set, so that this call
  3198.        * to Version_Number() will return a NULL version string if
  3199. --- 199,205 ----
  3200.       }
  3201.   #endif
  3202.   
  3203. !     if (_delete) {
  3204.       /*
  3205.        * If -d is specified, "force_tag_match" is set, so that this call
  3206.        * to Version_Number() will return a NULL version string if
  3207. ***************
  3208. *** 220,227 ****
  3209.       Version_Number(rcs, symtag, "", version);
  3210.       if (version[0] == '\0')
  3211.           return (0);
  3212. !     (void) sprintf(prog, "%s/%s -q -N%s %s 2>%s", Rcsbin, RCS,
  3213. !                symtag, rcs, DEVNULL);
  3214.       if (system(prog) != 0) {
  3215.           warn(0, "failed to remove tag %s for %s", symtag, rcs);
  3216.           return (1);
  3217. --- 219,225 ----
  3218.       Version_Number(rcs, symtag, "", version);
  3219.       if (version[0] == '\0')
  3220.           return (0);
  3221. !     (void) sprintf(prog, "%s -q -N%s %s 2>%s", RCS, symtag, rcs, DEVNULL);
  3222.       if (system(prog) != 0) {
  3223.           warn(0, "failed to remove tag %s for %s", symtag, rcs);
  3224.           return (1);
  3225. ***************
  3226. *** 245,252 ****
  3227.        */
  3228.       (void) strcpy(version, numtag);
  3229.       }
  3230. !     (void) sprintf(prog, "%s/%s -q -N%s:%s %s", Rcsbin, RCS, symtag,
  3231. !            version, rcs);
  3232.       if (system(prog) != 0) {
  3233.       warn(0, "failed to set tag %s to revision %s for %s",
  3234.            symtag, version, rcs);
  3235. --- 243,249 ----
  3236.        */
  3237.       (void) strcpy(version, numtag);
  3238.       }
  3239. !     (void) sprintf(prog, "%s -q -N%s:%s %s", RCS, symtag, version, rcs);
  3240.       if (system(prog) != 0) {
  3241.       warn(0, "failed to set tag %s to revision %s for %s",
  3242.            symtag, version, rcs);
  3243. diff -cb orig/update.c src/update.c
  3244. *** orig/update.c    Sun Feb 23 15:02:42 1992
  3245. --- src/update.c    Sun Feb 23 17:05:50 1992
  3246. ***************
  3247. *** 1,6 ****
  3248.   #ifndef lint
  3249.   static char rcsid[] = "$Id: update.c,v 1.27.1.2 91/02/06 18:30:07 berliner Exp $";
  3250. ! #endif !lint
  3251.   
  3252.   /*
  3253.    *    Copyright (c) 1989, Brian Berliner
  3254. --- 1,6 ----
  3255.   #ifndef lint
  3256.   static char rcsid[] = "$Id: update.c,v 1.27.1.2 91/02/06 18:30:07 berliner Exp $";
  3257. ! #endif 
  3258.   
  3259.   /*
  3260.    *    Copyright (c) 1989, Brian Berliner
  3261. ***************
  3262. *** 50,60 ****
  3263.    *    automatically created and updated as well.
  3264.    */
  3265.   
  3266. - #include <sys/param.h>
  3267.   #include <sys/types.h>
  3268.   #include <sys/stat.h>
  3269. ! #include <sys/wait.h>        /* UNOFFICIAL - bug fix */
  3270. ! #include <dirent.h>
  3271.   #include "cvs.h"
  3272.   
  3273.   char update_dir[MAXPATHLEN];
  3274. --- 50,58 ----
  3275.    *    automatically created and updated as well.
  3276.    */
  3277.   
  3278.   #include <sys/types.h>
  3279.   #include <sys/stat.h>
  3280. ! #include "dir.h"
  3281.   #include "cvs.h"
  3282.   
  3283.   char update_dir[MAXPATHLEN];
  3284. ***************
  3285. *** 201,207 ****
  3286.       update_Files = 1;
  3287.       (void) strcpy(User, cp);
  3288.       Locate_RCS();
  3289. !     (void) sprintf(backup, "%s/%s%s", CVSADM, CVSPREFIX, User);
  3290.       if (isreadable(User))
  3291.           rename_file(User, backup);
  3292.       else
  3293. --- 199,205 ----
  3294.       update_Files = 1;
  3295.       (void) strcpy(User, cp);
  3296.       Locate_RCS();
  3297. !     (void) sprintf(backup, "%s%c%s%s", CVSADM, DIRSEP, CVSPREFIX, User);
  3298.       if (isreadable(User))
  3299.           rename_file(User, backup);
  3300.       else
  3301. ***************
  3302. *** 208,217 ****
  3303.           (void) unlink(backup);
  3304.       if (Tag[0] != '\0' || Date[0] != '\0') {
  3305.           Version_Number(Rcs, Tag, Date, VN_Rcs);
  3306. !         (void) sprintf(prog, "%s/%s -q -r%s %s %s", Rcsbin, RCS_CO,
  3307. !                VN_Rcs, Rcs, User);
  3308.       } else {
  3309. !         (void) sprintf(prog, "%s/%s -q %s %s", Rcsbin, RCS_CO, Rcs, User);
  3310.       }
  3311.       if (system(prog) == 0) {
  3312.           if (cvswrite == TRUE)
  3313. --- 206,214 ----
  3314.           (void) unlink(backup);
  3315.       if (Tag[0] != '\0' || Date[0] != '\0') {
  3316.           Version_Number(Rcs, Tag, Date, VN_Rcs);
  3317. !         (void) sprintf(prog, "%s -q -r%s %s %s", RCS_CO, VN_Rcs, Rcs, User);
  3318.       } else {
  3319. !         (void) sprintf(prog, "%s -q %s %s", RCS_CO, Rcs, User);
  3320.       }
  3321.       if (system(prog) == 0) {
  3322.           if (cvswrite == TRUE)
  3323. ***************
  3324. *** 220,226 ****
  3325.           Register(User, VN_Rcs, TS_User);
  3326.           if (!really_quiet) {
  3327.           if (update_dir[0])
  3328. !             printf("U %s/%s\n", update_dir, User);
  3329.           else
  3330.               printf("U %s\n", User);
  3331.           }
  3332. --- 217,223 ----
  3333.           Register(User, VN_Rcs, TS_User);
  3334.           if (!really_quiet) {
  3335.           if (update_dir[0])
  3336. !             printf("U %s%c%s\n", update_dir, DIRSEP, User);
  3337.           else
  3338.               printf("U %s\n", User);
  3339.           }
  3340. ***************
  3341. *** 240,246 ****
  3342.       (void) strcpy(User, cp);
  3343.       if (!really_quiet) {
  3344.           if (update_dir[0])
  3345. !         printf("M %s/%s\n", update_dir, User);
  3346.           else
  3347.           printf("M %s\n", User);
  3348.       }
  3349. --- 237,243 ----
  3350.       (void) strcpy(User, cp);
  3351.       if (!really_quiet) {
  3352.           if (update_dir[0])
  3353. !         printf("M %s%c%s\n", update_dir, DIRSEP, User);
  3354.           else
  3355.           printf("M %s\n", User);
  3356.       }
  3357. ***************
  3358. *** 257,263 ****
  3359.       (void) strcpy(User, cp);
  3360.       if (!really_quiet) {
  3361.           if (update_dir[0])
  3362. !         printf("A %s/%s\n", update_dir, User);
  3363.           else
  3364.           printf("A %s\n", User);
  3365.       }
  3366. --- 254,260 ----
  3367.       (void) strcpy(User, cp);
  3368.       if (!really_quiet) {
  3369.           if (update_dir[0])
  3370. !         printf("A %s%c%s\n", update_dir, DIRSEP, User);
  3371.           else
  3372.           printf("A %s\n", User);
  3373.       }
  3374. ***************
  3375. *** 270,276 ****
  3376.       (void) strcpy(User, cp);
  3377.       if (!really_quiet) {
  3378.           if (update_dir[0])
  3379. !         printf("R %s/%s\n", update_dir, User);
  3380.           else
  3381.           printf("R %s\n", User);
  3382.       }
  3383. --- 267,273 ----
  3384.       (void) strcpy(User, cp);
  3385.       if (!really_quiet) {
  3386.           if (update_dir[0])
  3387. !         printf("R %s%c%s\n", update_dir, DIRSEP, User);
  3388.           else
  3389.           printf("R %s\n", User);
  3390.       }
  3391. ***************
  3392. *** 293,300 ****
  3393.       (void) unlink(backup);
  3394.       copy_file(User, backup);
  3395.       xchmod(User, 1);
  3396. !     (void) sprintf(prog, "%s/%s -r%s %s", Rcsbin, RCS_MERGE,
  3397. !                VN_User, Rcs);
  3398.   /* UNOFFICIAL CHANGE - original code commented out
  3399.       if (system(prog) != 0) {
  3400.   */
  3401. --- 290,296 ----
  3402.       (void) unlink(backup);
  3403.       copy_file(User, backup);
  3404.       xchmod(User, 1);
  3405. !     (void) sprintf(prog, "%s -r%s %s", RCS_MERGE, VN_User, Rcs);
  3406.   /* UNOFFICIAL CHANGE - original code commented out
  3407.       if (system(prog) != 0) {
  3408.   */
  3409. ***************
  3410. *** 324,330 ****
  3411.           warn(0, "conflicts found in %s", User);
  3412.           if (!really_quiet) {
  3413.           if (update_dir[0])
  3414. !             printf("C %s/%s\n", update_dir, User);
  3415.           else
  3416.               printf("C %s\n", User);
  3417.           }
  3418. --- 320,326 ----
  3419.           warn(0, "conflicts found in %s", User);
  3420.           if (!really_quiet) {
  3421.           if (update_dir[0])
  3422. !             printf("C %s%c%s\n", update_dir, DIRSEP, User);
  3423.           else
  3424.               printf("C %s\n", User);
  3425.           }
  3426. ***************
  3427. *** 331,337 ****
  3428.       } else {
  3429.           if (!really_quiet) {
  3430.           if (update_dir[0])
  3431. !             printf("M %s/%s\n", update_dir, User);
  3432.           else
  3433.               printf("M %s\n", User);
  3434.           }
  3435. --- 327,333 ----
  3436.       } else {
  3437.           if (!really_quiet) {
  3438.           if (update_dir[0])
  3439. !             printf("M %s%c%s\n", update_dir, DIRSEP, User);
  3440.           else
  3441.               printf("M %s\n", User);
  3442.           }
  3443. ***************
  3444. *** 379,389 ****
  3445.       } else while ((dp = readdir(dirp)) != NULL) {
  3446.           if (strcmp(dp->d_name, ".") == 0 ||
  3447.           strcmp(dp->d_name, "..") == 0 ||
  3448. !         strcmp(dp->d_name, CVSATTIC) == 0 ||
  3449. !         strcmp(dp->d_name, CVSLCK) == 0)
  3450.           continue;
  3451. !         (void) sprintf(fname, "%s/%s", Repository, dp->d_name);
  3452. !         (void) sprintf(tmp, "%s/%s", dp->d_name, CVSADM);
  3453.           if (!isdir(fname))
  3454.           continue;
  3455.           if (islink(dp->d_name) || isdir(tmp))
  3456. --- 375,385 ----
  3457.       } else while ((dp = readdir(dirp)) != NULL) {
  3458.           if (strcmp(dp->d_name, ".") == 0 ||
  3459.           strcmp(dp->d_name, "..") == 0 ||
  3460. !         stricmp(dp->d_name, CVSATTIC) == 0 ||
  3461. !         stricmp(dp->d_name, CVSLCK) == 0)
  3462.           continue;
  3463. !         (void) sprintf(fname, "%s%c%s", Repository, DIRSEP, dp->d_name);
  3464. !         (void) sprintf(tmp, "%s%c%s", dp->d_name, DIRSEP, CVSADM);
  3465.           if (!isdir(fname))
  3466.           continue;
  3467.           if (islink(dp->d_name) || isdir(tmp))
  3468. ***************
  3469. *** 454,460 ****
  3470.       char *cp;
  3471.       int err;
  3472.   
  3473. !     (void) sprintf(fname, "%s/%s", dir, CVSADM);
  3474.       if (!isdir(dir) || islink(dir) || !isdir(fname))
  3475.       return (0);
  3476.       if (getwd(cwd) == NULL) {
  3477. --- 450,456 ----
  3478.       char *cp;
  3479.       int err;
  3480.   
  3481. !     (void) sprintf(fname, "%s%c%s", dir, DIRSEP, CVSADM);
  3482.       if (!isdir(dir) || islink(dir) || !isdir(fname))
  3483.       return (0);
  3484.       if (getwd(cwd) == NULL) {
  3485. ***************
  3486. *** 464,470 ****
  3487.       if (update_dir[0] == '\0')
  3488.       (void) strcpy(update_dir, dir);
  3489.       else {
  3490. !     (void) strcat(update_dir, "/");
  3491.       (void) strcat(update_dir, dir);
  3492.       }
  3493.       if (!quiet)
  3494. --- 460,466 ----
  3495.       if (update_dir[0] == '\0')
  3496.       (void) strcpy(update_dir, dir);
  3497.       else {
  3498. !     (void) strcat(update_dir, DIRSEPSTR);
  3499.       (void) strcat(update_dir, dir);
  3500.       }
  3501.       if (!quiet)
  3502. ***************
  3503. *** 475,481 ****
  3504.       goto out;
  3505.       }
  3506.       err = update(0, (char **)0);
  3507. !     if ((cp = rindex(update_dir, '/')) != NULL)
  3508.       *cp = '\0';
  3509.       else
  3510.       update_dir[0] = '\0';
  3511. --- 471,477 ----
  3512.       goto out;
  3513.       }
  3514.       err = update(0, (char **)0);
  3515. !     if ((cp = rindex_sep(update_dir)) != NULL)
  3516.       *cp = '\0';
  3517.       else
  3518.       update_dir[0] = '\0';
  3519. ***************
  3520. *** 505,511 ****
  3521.       }
  3522.       while ((dp = readdir(dirp)) != NULL) {
  3523.           if (strcmp(dp->d_name, ".") != 0 && strcmp(dp->d_name, "..") != 0 &&
  3524. !             strcmp(dp->d_name, CVSADM) != 0) {
  3525.               (void) closedir(dirp);
  3526.               return (0);
  3527.           }
  3528. --- 501,507 ----
  3529.       }
  3530.       while ((dp = readdir(dirp)) != NULL) {
  3531.           if (strcmp(dp->d_name, ".") != 0 && strcmp(dp->d_name, "..") != 0 &&
  3532. !             stricmp(dp->d_name, CVSADM) != 0) {
  3533.               (void) closedir(dirp);
  3534.               return (0);
  3535.           }
  3536. diff -cb orig/version_number.c src/version_number.c
  3537. *** orig/version_number.c    Sun Feb 23 15:02:42 1992
  3538. --- src/version_number.c    Sun Jan 19 22:05:04 1992
  3539. ***************
  3540. *** 1,6 ****
  3541.   #ifndef lint
  3542.   static char rcsid[] = "$Id: version_number.c,v 1.16.1.2 91/01/29 07:20:26 berliner Exp $";
  3543. ! #endif !lint
  3544.   
  3545.   /*
  3546.    *    Copyright (c) 1989, Brian Berliner
  3547. --- 1,6 ----
  3548.   #ifndef lint
  3549.   static char rcsid[] = "$Id: version_number.c,v 1.16.1.2 91/01/29 07:20:26 berliner Exp $";
  3550. ! #endif 
  3551.   
  3552.   /*
  3553.    *    Copyright (c) 1989, Brian Berliner
  3554. ***************
  3555. *** 40,46 ****
  3556.        * is already nulled.
  3557.        */
  3558.       if ((fpin = fopen(rcs, "r")) == NULL)
  3559. !     return;
  3560.       get_version(fpin, tag, date, rev, vers);
  3561.       if (vers[0] == '\0' && tag[0] != '\0') {
  3562.       if (!isdigit(tag[0])) {
  3563. --- 40,46 ----
  3564.        * is already nulled.
  3565.        */
  3566.       if ((fpin = fopen(rcs, "r")) == NULL)
  3567. !     return 0;
  3568.       get_version(fpin, tag, date, rev, vers);
  3569.       if (vers[0] == '\0' && tag[0] != '\0') {
  3570.       if (!isdigit(tag[0])) {
  3571. ***************
  3572. *** 51,58 ****
  3573.           strncmp(rcs, CVSroot, strlen(CVSroot)) == 0) {
  3574.           cp = rcs + strlen(CVSroot) + 1;
  3575.           } else {
  3576. !         if ((cp = index(rcs, '/')) == NULL && update_dir[0] != '\0') {
  3577. !             (void) sprintf(temp, "%s/%s", update_dir, rcs);
  3578.               cp = temp;
  3579.           } else {
  3580.               cp = rcs;
  3581. --- 51,58 ----
  3582.           strncmp(rcs, CVSroot, strlen(CVSroot)) == 0) {
  3583.           cp = rcs + strlen(CVSroot) + 1;
  3584.           } else {
  3585. !         if ((cp = index_sep(rcs)) == NULL && update_dir[0] != '\0') {
  3586. !             (void) sprintf(temp, "%s%c%s", update_dir, DIRSEP, rcs);
  3587.               cp = temp;
  3588.           } else {
  3589.               cp = rcs;
  3590. ***************
  3591. *** 99,113 ****
  3592.        * Assumption here is that the "head" line is always first.
  3593.        */
  3594.       if (fgets(line, sizeof(line), fp) == NULL)
  3595. !     return;
  3596.       if (strncmp(line, RCSHEAD, sizeof(RCSHEAD) - 1) != 0 ||
  3597.       !isspace(line[sizeof(RCSHEAD) - 1]) ||
  3598.       (cp = rindex(line, ';')) == NULL)
  3599. !     return;
  3600.       *cp = '\0';                /* strip the ';' */
  3601.       if ((cp = rindex(line, ' ')) == NULL &&
  3602.       (cp = rindex(line, '\t')) == NULL)
  3603. !     return;
  3604.       cp++;
  3605.       (void) strcpy(rev, cp);
  3606.       /*
  3607. --- 99,113 ----
  3608.        * Assumption here is that the "head" line is always first.
  3609.        */
  3610.       if (fgets(line, sizeof(line), fp) == NULL)
  3611. !     return 0;
  3612.       if (strncmp(line, RCSHEAD, sizeof(RCSHEAD) - 1) != 0 ||
  3613.       !isspace(line[sizeof(RCSHEAD) - 1]) ||
  3614.       (cp = rindex(line, ';')) == NULL)
  3615. !     return 0;
  3616.       *cp = '\0';                /* strip the ';' */
  3617.       if ((cp = rindex(line, ' ')) == NULL &&
  3618.       (cp = rindex(line, '\t')) == NULL)
  3619. !     return 0;
  3620.       cp++;
  3621.       (void) strcpy(rev, cp);
  3622.       /*
  3623. ***************
  3624. *** 119,125 ****
  3625.        * it is an old format RCS file, and blow it off.
  3626.        */
  3627.       if (fgets(line, sizeof(line), fp) == NULL)
  3628. !     return;
  3629.       if (strncmp(line, RCSBRANCH, sizeof(RCSBRANCH) - 1) == 0 &&
  3630.       isspace(line[sizeof(RCSBRANCH) - 1]) &&
  3631.       (cp = rindex(line, ';')) != NULL) {
  3632. --- 119,125 ----
  3633.        * it is an old format RCS file, and blow it off.
  3634.        */
  3635.       if (fgets(line, sizeof(line), fp) == NULL)
  3636. !     return 0;
  3637.       if (strncmp(line, RCSBRANCH, sizeof(RCSBRANCH) - 1) == 0 &&
  3638.       isspace(line[sizeof(RCSBRANCH) - 1]) &&
  3639.       (cp = rindex(line, ';')) != NULL) {
  3640. ***************
  3641. *** 126,134 ****
  3642.       *cp = '\0';            /* strip the ';' */
  3643.       if ((cp = rindex(line, ' ')) == NULL &&
  3644.           (cp = rindex(line, '\t')) == NULL)
  3645. !         return;
  3646.       cp++;
  3647. !     if (*cp != NULL)
  3648.           (void) strcpy(rev, cp);
  3649.       }
  3650.       /*
  3651. --- 126,134 ----
  3652.       *cp = '\0';            /* strip the ';' */
  3653.       if ((cp = rindex(line, ' ')) == NULL &&
  3654.           (cp = rindex(line, '\t')) == NULL)
  3655. !         return 0;
  3656.       cp++;
  3657. !     if (*cp != 0)
  3658.           (void) strcpy(rev, cp);
  3659.       }
  3660.       /*
  3661. ***************
  3662. *** 139,150 ****
  3663.        */
  3664.       if (date[0] != '\0') {
  3665.       get_date(fp, date, rev, vers);
  3666. !     return;
  3667.       }
  3668.       if (tag[0] != '\0') {
  3669.       /* return of 0 means we found an exact match, or there was an error */
  3670.       if ((symtag_matched = get_tag(fp, tag, rev, vers)) == 0)
  3671. !         return;
  3672.       }
  3673.       /*
  3674.        * "rev" now contains either the "head" value, or the tag value,
  3675. --- 139,150 ----
  3676.        */
  3677.       if (date[0] != '\0') {
  3678.       get_date(fp, date, rev, vers);
  3679. !     return 0;
  3680.       }
  3681.       if (tag[0] != '\0') {
  3682.       /* return of 0 means we found an exact match, or there was an error */
  3683.       if ((symtag_matched = get_tag(fp, tag, rev, vers)) == 0)
  3684. !         return 0;
  3685.       }
  3686.       /*
  3687.        * "rev" now contains either the "head" value, or the tag value,
  3688. ***************
  3689. *** 271,282 ****
  3690.       int len, dots = numdots(rev);
  3691.   
  3692.       if ((dots & 1) != 0)
  3693. !     return;
  3694.       (void) sprintf(branch, "%s.", rev);
  3695.       len = strlen(branch);
  3696.       while (fgets(line, sizeof(line), fp) != NULL) {
  3697.       if (strncmp(line, RCSDESC, sizeof(RCSDESC) - 1) == 0)
  3698. !         return;
  3699.       if (isdigit(line[0])) {
  3700.           if ((cp = rindex(line, '\n')) != NULL)
  3701.           *cp = '\0';        /* strip the newline */
  3702. --- 271,282 ----
  3703.       int len, dots = numdots(rev);
  3704.   
  3705.       if ((dots & 1) != 0)
  3706. !     return 0;
  3707.       (void) sprintf(branch, "%s.", rev);
  3708.       len = strlen(branch);
  3709.       while (fgets(line, sizeof(line), fp) != NULL) {
  3710.       if (strncmp(line, RCSDESC, sizeof(RCSDESC) - 1) == 0)
  3711. !         return 0;
  3712.       if (isdigit(line[0])) {
  3713.           if ((cp = rindex(line, '\n')) != NULL)
  3714.           *cp = '\0';        /* strip the newline */
  3715. ***************
  3716. *** 348,354 ****
  3717.       date_dots = numdots(rev);
  3718.       while (fgets(line, sizeof(line), fp) != NULL) {
  3719.       if (strncmp(line, RCSDESC, sizeof(RCSDESC) - 1) == 0)
  3720. !         return;
  3721.       if (isdigit(line[0])) {
  3722.           if ((cp = rindex(line, '\n')) != NULL)
  3723.           *cp = '\0';        /* strip the newline */
  3724. --- 348,354 ----
  3725.       date_dots = numdots(rev);
  3726.       while (fgets(line, sizeof(line), fp) != NULL) {
  3727.       if (strncmp(line, RCSDESC, sizeof(RCSDESC) - 1) == 0)
  3728. !         return 0;
  3729.       if (isdigit(line[0])) {
  3730.           if ((cp = rindex(line, '\n')) != NULL)
  3731.           *cp = '\0';        /* strip the newline */
  3732. diff -cb orig/version_ts.c src/version_ts.c
  3733. *** orig/version_ts.c    Sun Feb 23 15:02:42 1992
  3734. --- src/version_ts.c    Sun Jan 19 15:35:44 1992
  3735. ***************
  3736. *** 1,6 ****
  3737.   #ifndef lint
  3738.   static char rcsid[] = "$Id: version_ts.c,v 1.8 89/11/20 09:51:12 berliner Exp $";
  3739. ! #endif !lint
  3740.   
  3741.   /*
  3742.    *    Copyright (c) 1989, Brian Berliner
  3743. --- 1,6 ----
  3744.   #ifndef lint
  3745.   static char rcsid[] = "$Id: version_ts.c,v 1.8 89/11/20 09:51:12 berliner Exp $";
  3746. ! #endif 
  3747.   
  3748.   /*
  3749.    *    Copyright (c) 1989, Brian Berliner
  3750. ***************
  3751. *** 32,40 ****
  3752.   #include <sys/timeb.h>
  3753.   #include <sys/stat.h>
  3754.   #include <ctype.h>
  3755. - #include <grp.h>
  3756. - #include <pwd.h>
  3757. - #include <utmp.h>
  3758.   #include "cvs.h"
  3759.   
  3760.   /*
  3761. --- 32,37 ----
  3762. ***************
  3763. *** 93,105 ****
  3764.   /* Some UNIX distributions don't include these in their stat.h */
  3765.   #ifndef S_IWRITE
  3766.   #define    S_IWRITE    0000200        /* write permission, owner */
  3767. ! #endif !S_IWRITE
  3768.   #ifndef S_IWGRP
  3769.   #define    S_IWGRP        0000020        /* write permission, grougroup */
  3770. ! #endif !S_IWGRP
  3771.   #ifndef S_IWOTH
  3772.   #define    S_IWOTH        0000002        /* write permission, other */
  3773. ! #endif !S_IWOTH
  3774.   
  3775.   /*
  3776.    * Gets the time-stamp for the file "file" and puts it in the already
  3777. --- 90,102 ----
  3778.   /* Some UNIX distributions don't include these in their stat.h */
  3779.   #ifndef S_IWRITE
  3780.   #define    S_IWRITE    0000200        /* write permission, owner */
  3781. ! #endif
  3782.   #ifndef S_IWGRP
  3783.   #define    S_IWGRP        0000020        /* write permission, grougroup */
  3784. ! #endif
  3785.   #ifndef S_IWOTH
  3786.   #define    S_IWOTH        0000002        /* write permission, other */
  3787. ! #endif
  3788.   
  3789.   /*
  3790.    * Gets the time-stamp for the file "file" and puts it in the already
  3791.