home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / dev / misc / hwgrcs / src / rcs.rcsfiles / merge.c,v < prev    next >
Encoding:
Text File  |  1995-06-25  |  4.8 KB  |  232 lines

  1. head    1.2;
  2. branch    1.2.1;
  3. access;
  4. symbols
  5.     HWGRCSP12F:1.2.1.2
  6.     HWGRCSP11F:1.2.1.2
  7.     HWGRCSP10F:1.2.1.2
  8.     HWGRCSP9:1.2.1.2
  9.     HWGRCSP8F:1.2.1.2
  10.     HWGRCSP7F:1.2.1.1
  11.     HWGRCSP6F:1.2.1.1
  12.     HWGRCSP5F:1.2.1.1
  13.     HWGRCSp4:1.2.1.1
  14.     HWGRCSp3:1.2.1
  15.     HWGRCS_Fish:1.2.1
  16.     HWGRCS:1.2.1;
  17. locks; strict;
  18. comment    @ * @;
  19.  
  20.  
  21. 1.2
  22. date    91.08.19.03.13.55;    author eggert;    state Exp;
  23. branches
  24.     1.2.1.1;
  25. next    ;
  26.  
  27. 1.2.1.1
  28. date    93.01.18.14.37.36;    author heinz;    state Exp;
  29. branches;
  30. next    1.2.1.2;
  31.  
  32. 1.2.1.2
  33. date    94.02.14.19.29.45;    author heinz;    state Exp;
  34. branches;
  35. next    ;
  36.  
  37.  
  38. desc
  39. @Checked in with -k 16.jan.93 HWG
  40. @
  41.  
  42.  
  43. 1.2
  44. log
  45. @checked in with -k by heinz at 1993/01/17 01:53:17
  46. @
  47. text
  48. @/* merge - three-way file merge */
  49.  
  50. /* Copyright 1991 by Paul Eggert
  51.    Distributed under license by the Free Software Foundation, Inc.
  52.  
  53. This file is part of RCS.
  54.  
  55. RCS is free software; you can redistribute it and/or modify
  56. it under the terms of the GNU General Public License as published by
  57. the Free Software Foundation; either version 2, or (at your option)
  58. any later version.
  59.  
  60. RCS is distributed in the hope that it will be useful,
  61. but WITHOUT ANY WARRANTY; without even the implied warranty of
  62. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  63. GNU General Public License for more details.
  64.  
  65. You should have received a copy of the GNU General Public License
  66. along with RCS; see the file COPYING.  If not, write to
  67. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  68.  
  69. Report problems and direct all questions to:
  70.  
  71.     rcs-bugs@@cs.purdue.edu
  72.  
  73. */
  74.  
  75. #include "rcsbase.h"
  76.  
  77.  
  78. static char const usage[] =
  79.  "\nmerge: usage: merge [-p] [-q] [-L label1 [-L label3]] file1 file2 file3\n";
  80.  
  81.     static exiting void
  82. badoption(a)
  83.     char const *a;
  84. {
  85.     faterror("unknown option: %s%s", a-2, usage);
  86. }
  87.  
  88.  
  89. mainProg(mergeId, "merge", "$Id: merge.c,v 1.2 1991/08/19 03:13:55 eggert Exp $")
  90. {
  91.     register char const *a;
  92.     char const *label[2], *arg[3];
  93.     int labels, tostdout;
  94.  
  95.     labels = 0;
  96.     tostdout = false;
  97.  
  98.     while ((a = *++argv)  &&  *a++ == '-') {
  99.         switch (*a++) {
  100.             case 'p': tostdout = true; break;
  101.             case 'q': quietflag = true; break;
  102.             case 'L':
  103.                 if (1<labels)
  104.                     faterror("too many -L options");
  105.                 if (!(label[labels++] = *++argv))
  106.                     faterror("-L needs following argument");
  107.                 --argc;
  108.                 break;
  109.             default:
  110.                 badoption(a);
  111.         }
  112.         if (*a)
  113.             badoption(a);
  114.         --argc;
  115.     }
  116.  
  117.     if (argc != 4)
  118.         faterror("%s arguments%s",
  119.             argc<4 ? "not enough" : "too many",  usage
  120.         );
  121.  
  122.     /* This copy keeps us `const'-clean.  */
  123.     arg[0] = argv[0];
  124.     arg[1] = argv[1];
  125.     arg[2] = argv[2];
  126.  
  127.     switch (labels) {
  128.         case 0: label[0] = arg[0]; /* fall into */
  129.         case 1: label[1] = arg[2];
  130.     }
  131.  
  132.     exitmain(merge(tostdout, label, arg));
  133. }
  134.  
  135.  
  136. #if lint
  137. #    define exiterr mergeExit
  138. #endif
  139.     exiting void
  140. exiterr()
  141. {
  142.     tempunlink();
  143.     _exit(DIFF_TROUBLE);
  144. }
  145. @
  146.  
  147.  
  148. 1.2.1.1
  149. log
  150. @Start of the AMIGA port of RCS 5.6. I call it HWGRCS now ;^)
  151. @
  152. text
  153. @@
  154.  
  155.  
  156. 1.2.1.2
  157. log
  158. @First version of Amiga keywords implemented. Ugly, but acceptable for now.
  159. @
  160. text
  161. @d34 1
  162. a34 1
  163.         static exiting void
  164. d36 1
  165. a36 1
  166.         char const *a;
  167. d38 1
  168. a38 1
  169.         faterror("unknown option: %s%s", a-2, usage);
  170. d42 1
  171. a42 4
  172. #ifdef _AMIGA
  173. char HWGversion[] = "$" "VER: " PRGPREFIX "merge " PRGVERSION "." PRGREVISION " (" PRGDATE ")" PRGVERTEXT;
  174. #endif /* _AMIGA */
  175. mainProg(mergeId, "merge", "$Id: merge.c,v 1.2.1.1 1993/01/18 14:37:36 heinz Exp heinz $")
  176. d44 40
  177. a83 40
  178.         register char const *a;
  179.         char const *label[2], *arg[3];
  180.         int labels, tostdout;
  181.  
  182.         labels = 0;
  183.         tostdout = false;
  184.  
  185.         while ((a = *++argv)  &&  *a++ == '-') {
  186.                 switch (*a++) {
  187.                         case 'p': tostdout = true; break;
  188.                         case 'q': quietflag = true; break;
  189.                         case 'L':
  190.                                 if (1<labels)
  191.                                         faterror("too many -L options");
  192.                                 if (!(label[labels++] = *++argv))
  193.                                         faterror("-L needs following argument");
  194.                                 --argc;
  195.                                 break;
  196.                         default:
  197.                                 badoption(a);
  198.                 }
  199.                 if (*a)
  200.                         badoption(a);
  201.                 --argc;
  202.         }
  203.  
  204.         if (argc != 4)
  205.                 faterror("%s arguments%s",
  206.                         argc<4 ? "not enough" : "too many",  usage
  207.                 );
  208.  
  209.         /* This copy keeps us `const'-clean.  */
  210.         arg[0] = argv[0];
  211.         arg[1] = argv[1];
  212.         arg[2] = argv[2];
  213.  
  214.         switch (labels) {
  215.                 case 0: label[0] = arg[0]; /* fall into */
  216.                 case 1: label[1] = arg[2];
  217.         }
  218. d85 1
  219. a85 1
  220.         exitmain(merge(tostdout, label, arg));
  221. d90 1
  222. a90 1
  223. #       define exiterr mergeExit
  224. d92 1
  225. a92 1
  226.         exiting void
  227. d95 2
  228. a96 2
  229.         tempunlink();
  230.         _exit(DIFF_TROUBLE);
  231. @
  232.