diff options
author | 2005-10-18 16:16:39 +0000 | |
---|---|---|
committer | 2005-10-18 16:16:39 +0000 | |
commit | 8ff001c5e7c2f29a21c01057fc23eb3a53131ec4 (patch) | |
tree | 7173aab490050d8222669691524731cf19d8182f | |
parent | Simplify code a bit. OK norby@ (diff) | |
download | wireguard-openbsd-8ff001c5e7c2f29a21c01057fc23eb3a53131ec4.tar.xz wireguard-openbsd-8ff001c5e7c2f29a21c01057fc23eb3a53131ec4.zip |
skeletons for rcsmerge(1);
-rw-r--r-- | usr.bin/rcs/rcsmerge.1 | 89 | ||||
-rw-r--r-- | usr.bin/rcs/rcsmerge.c | 110 |
2 files changed, 199 insertions, 0 deletions
diff --git a/usr.bin/rcs/rcsmerge.1 b/usr.bin/rcs/rcsmerge.1 new file mode 100644 index 00000000000..133c15413a4 --- /dev/null +++ b/usr.bin/rcs/rcsmerge.1 @@ -0,0 +1,89 @@ +.\" $OpenBSD: rcsmerge.1,v 1.1 2005/10/18 16:16:39 xsa Exp $ +.\" +.\" Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org> +.\" All rights reserved. +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.Dd October 12, 2005 +.Dt RCSMERGE 1 +.Os +.Sh NAME +.Nm rcsmerge +.Nd merge RCS revisions +.Sh SYNOPSIS +.Nm +.Bk -words +.Op Fl AEepqTV +.Op Fl k Ns Ar mode +.Op Fl r Ns Ar rev +.Op Fl x Ns Ar suffixes +.Op Fl z Ns Ar tz +.Ar file ... +.Ek +.Sh DESCRIPTION +The +.Nm +program merges changes between two revisions of an RCS file into +the corresponding working file. +.Pp +The following options are supported: +.Bl -tag -width Ds +.It Fl A +Most verbose output. +.It Fl E +Less information than +.Fl A . +This is the default. +See +.Xr diff3 1 +for details. +.It Fl e +Same as +.Fl E +but does not warn about conflicts. +.It Fl k Ns Ar mode +Specify the keyword substitution mode. +.It Fl p +Print result to standard output. +.It Fl q +Be quiet about reporting. +.It Fl r Ns Ar rev +Merge with respect to revision +.Ar rev . +.It Fl T +No effect. +For compatibility. +.It Fl V +Print RCS's version number. +.It Fl x Ns Ar suffixes +Specify the suffixes for RCS files. +Suffixes should be separated by the +.Sq / +character. +.It Fl z Ns Ar tz +Specify the time zone for keyword substitution. +.El +.Sh ENVIRONMENT +.Bl -tag -width RCSINIT +.It Ev RCSINIT +If set, this variable should contain a list of space-delimited options that +are prepended to the argument list. +.El +.Sh SEE ALSO +.Xr ci 1 , +.Xr co 1 , +.Xr ident 1 , +.Xr rcs 1 , +.Xr rcsclean 1 , +.Xr rcsdiff 1 , +.Xr rlog 1 diff --git a/usr.bin/rcs/rcsmerge.c b/usr.bin/rcs/rcsmerge.c new file mode 100644 index 00000000000..edcb09e9b5b --- /dev/null +++ b/usr.bin/rcs/rcsmerge.c @@ -0,0 +1,110 @@ +/* $OpenBSD: rcsmerge.c,v 1.1 2005/10/18 16:16:39 xsa Exp $ */ +/* + * Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/param.h> +#include <sys/stat.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include "log.h" +#include "rcs.h" +#include "diff.h" +#include "rcsprog.h" + + +static int kflag = RCS_KWEXP_ERR; + +int +rcsmerge_main(int argc, char **argv) +{ + int i, ch; + char fpath[MAXPATHLEN]; + RCSFILE *file; + RCSNUM *rev; + + rev = RCS_HEAD_REV; + + while ((ch = rcs_getopt(argc, argv, "k:qr:TV")) != -1) { + switch (ch) { + case 'k': + kflag = rcs_kflag_get(rcs_optarg); + if (RCS_KWEXP_INVAL(kflag)) { + cvs_log(LP_ERR, + "invalid RCS keyword expansion mode"); + (usage)(); + exit(1); + } + break; + case 'q': + verbose = 0; + break; + case 'r': + rcs_set_rev(rcs_optarg, &rev); + break; + case 'T': + /* + * kept for compatibility + */ + break; + case 'V': + printf("%s\n", rcs_version); + exit(0); + default: + break; + } + } + + argc -= rcs_optind; + argv += rcs_optind; + + if (argc < 0) { + cvs_log(LP_ERR, "no input file"); + (usage)(); + exit(1); + } + + for (i = 0; i < argc; i++) { + if (rcs_statfile(argv[i], fpath, sizeof(fpath)) < 0) + continue; + + if ((file = rcs_open(fpath, RCS_READ)) == NULL) + continue; + + rcs_close(file); + } + + return (0); +} + +void +rcsmerge_usage(void) +{ + fprintf(stderr, + "usage: rcsmerge [-qTV] [-kmode] [-rrev] file ...\n"); +} |