1 /* merge - three-way file merge */
3 /* Copyright 1991, 1992, 1993, 1994, 1995 Paul Eggert
4 Distributed under license by the Free Software Foundation, Inc.
6 This file is part of RCS.
8 RCS is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 RCS is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with RCS; see the file COPYING.
20 If not, write to the Free Software Foundation,
21 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 Report problems and direct all questions to:
25 rcs-bugs@cs.purdue.edu
31 static void badoption P((char const*));
33 static char const usage[] =
34 "\nmerge: usage: merge [-AeEpqxX3] [-L lab [-L lab [-L lab]]] file1 file2 file3";
40 error("unknown option: %s%s", a, usage);
44 mainProg(mergeId, "merge", "$FreeBSD$")
46 register char const *a;
47 char const *arg[3], *label[3], *edarg = 0;
53 for (; (a = *++argv) && *a++ == '-'; --argc) {
55 case 'A': case 'E': case 'e':
56 if (edarg && edarg[1] != (*argv)[1])
57 error("%s and %s are incompatible",
63 case 'p': tostdout = true; break;
64 case 'q': quietflag = true; break;
68 faterror("too many -L options");
69 if (!(label[labels++] = *++argv))
70 faterror("-L needs following argument");
75 printf("RCS version %s\n", RCS_version_string);
87 faterror("%s arguments%s",
88 argc<4 ? "not enough" : "too many", usage
91 /* This copy keeps us `const'-clean. */
96 for (; labels < 3; labels++)
97 label[labels] = arg[labels];
101 exitmain(merge(tostdout, edarg, label, arg));
106 # define exiterr mergeExit