head	1.2;
branch	1.2.1;
access;
symbols
	HWGRCSP12F:1.2.1.2
	HWGRCSP11F:1.2.1.2
	HWGRCSP10F:1.2.1.2
	HWGRCSP9:1.2.1.2
	HWGRCSP8F:1.2.1.2
	HWGRCSP7F:1.2.1.1
	HWGRCSP6F:1.2.1.1
	HWGRCSP5F:1.2.1.1
	HWGRCSp4:1.2.1.1
	HWGRCSp3:1.2.1
	HWGRCS_Fish:1.2.1
	HWGRCS:1.2.1;
locks; strict;
comment	@ * @;


1.2
date	91.08.19.03.13.55;	author eggert;	state Exp;
branches
	1.2.1.1;
next	;

1.2.1.1
date	93.01.18.14.37.36;	author heinz;	state Exp;
branches;
next	1.2.1.2;

1.2.1.2
date	94.02.14.19.29.45;	author heinz;	state Exp;
branches;
next	;


desc
@Checked in with -k 16.jan.93 HWG
@


1.2
log
@checked in with -k by heinz at 1993/01/17 01:53:17
@
text
@/* merge - three-way file merge */

/* Copyright 1991 by Paul Eggert
   Distributed under license by the Free Software Foundation, Inc.

This file is part of RCS.

RCS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.

RCS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with RCS; see the file COPYING.  If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

Report problems and direct all questions to:

    rcs-bugs@@cs.purdue.edu

*/

#include "rcsbase.h"


static char const usage[] =
 "\nmerge: usage: merge [-p] [-q] [-L label1 [-L label3]] file1 file2 file3\n";

	static exiting void
badoption(a)
	char const *a;
{
	faterror("unknown option: %s%s", a-2, usage);
}


mainProg(mergeId, "merge", "$Id: merge.c,v 1.2 1991/08/19 03:13:55 eggert Exp $")
{
	register char const *a;
	char const *label[2], *arg[3];
	int labels, tostdout;

	labels = 0;
	tostdout = false;

	while ((a = *++argv)  &&  *a++ == '-') {
		switch (*a++) {
			case 'p': tostdout = true; break;
			case 'q': quietflag = true; break;
			case 'L':
				if (1<labels)
					faterror("too many -L options");
				if (!(label[labels++] = *++argv))
					faterror("-L needs following argument");
				--argc;
				break;
			default:
				badoption(a);
		}
		if (*a)
			badoption(a);
		--argc;
	}

	if (argc != 4)
		faterror("%s arguments%s",
			argc<4 ? "not enough" : "too many",  usage
		);

	/* This copy keeps us `const'-clean.  */
	arg[0] = argv[0];
	arg[1] = argv[1];
	arg[2] = argv[2];

	switch (labels) {
		case 0: label[0] = arg[0]; /* fall into */
		case 1: label[1] = arg[2];
	}

	exitmain(merge(tostdout, label, arg));
}


#if lint
#	define exiterr mergeExit
#endif
	exiting void
exiterr()
{
	tempunlink();
	_exit(DIFF_TROUBLE);
}
@


1.2.1.1
log
@Start of the AMIGA port of RCS 5.6. I call it HWGRCS now ;^)
@
text
@@


1.2.1.2
log
@First version of Amiga keywords implemented. Ugly, but acceptable for now.
@
text
@d34 1
a34 1
        static exiting void
d36 1
a36 1
        char const *a;
d38 1
a38 1
        faterror("unknown option: %s%s", a-2, usage);
d42 1
a42 4
#ifdef _AMIGA
char HWGversion[] = "$" "VER: " PRGPREFIX "merge " PRGVERSION "." PRGREVISION " (" PRGDATE ")" PRGVERTEXT;
#endif /* _AMIGA */
mainProg(mergeId, "merge", "$Id: merge.c,v 1.2.1.1 1993/01/18 14:37:36 heinz Exp heinz $")
d44 40
a83 40
        register char const *a;
        char const *label[2], *arg[3];
        int labels, tostdout;

        labels = 0;
        tostdout = false;

        while ((a = *++argv)  &&  *a++ == '-') {
                switch (*a++) {
                        case 'p': tostdout = true; break;
                        case 'q': quietflag = true; break;
                        case 'L':
                                if (1<labels)
                                        faterror("too many -L options");
                                if (!(label[labels++] = *++argv))
                                        faterror("-L needs following argument");
                                --argc;
                                break;
                        default:
                                badoption(a);
                }
                if (*a)
                        badoption(a);
                --argc;
        }

        if (argc != 4)
                faterror("%s arguments%s",
                        argc<4 ? "not enough" : "too many",  usage
                );

        /* This copy keeps us `const'-clean.  */
        arg[0] = argv[0];
        arg[1] = argv[1];
        arg[2] = argv[2];

        switch (labels) {
                case 0: label[0] = arg[0]; /* fall into */
                case 1: label[1] = arg[2];
        }
d85 1
a85 1
        exitmain(merge(tostdout, label, arg));
d90 1
a90 1
#       define exiterr mergeExit
d92 1
a92 1
        exiting void
d95 2
a96 2
        tempunlink();
        _exit(DIFF_TROUBLE);
@
