1 /* $NetBSD: merge.c,v 1.1.1.2 1996/10/13 21:57:34 veego Exp $ */
3 /* merge - three-way file merge */
5 /* Copyright 1991, 1992, 1993, 1994, 1995 Paul Eggert
6 Distributed under license by the Free Software Foundation, Inc.
8 This file is part of RCS.
10 RCS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
15 RCS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with RCS; see the file COPYING.
22 If not, write to the Free Software Foundation,
23 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 Report problems and direct all questions to:
27 rcs-bugs@cs.purdue.edu
33 static void badoption
P((char const*));
35 static char const usage
[] =
36 "\nmerge: usage: merge [-AeEpqxX3] [-L lab [-L lab [-L lab]]] file1 file2 file3";
42 error("unknown option: %s%s", a
, usage
);
46 mainProg(mergeId
, "merge", "Id: merge.c,v 1.8 1995/06/16 06:19:24 eggert Exp")
48 register char const *a
;
49 char const *arg
[3], *label
[3], *edarg
= 0;
55 for (; (a
= *++argv
) && *a
++ == '-'; --argc
) {
57 case 'A': case 'E': case 'e':
58 if (edarg
&& edarg
[1] != (*argv
)[1])
59 error("%s and %s are incompatible",
65 case 'p': tostdout
= true; break;
66 case 'q': quietflag
= true; break;
70 faterror("too many -L options");
71 if (!(label
[labels
++] = *++argv
))
72 faterror("-L needs following argument");
77 printf("RCS version %s\n", RCS_version_string
);
89 faterror("%s arguments%s",
90 argc
<4 ? "not enough" : "too many", usage
93 /* This copy keeps us `const'-clean. */
98 for (; labels
< 3; labels
++)
99 label
[labels
] = arg
[labels
];
103 exitmain(merge(tostdout
, edarg
, label
, arg
));
108 # define exiterr mergeExit