summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Santolaria <xsa@cvs.openbsd.org>2005-11-12 09:42:30 +0000
committerXavier Santolaria <xsa@cvs.openbsd.org>2005-11-12 09:42:30 +0000
commit294e4c69c7c0607786d5a2368a1e99c42965064a (patch)
treeba9a23f1808909b744f1ae4a5305c5aa08e494b3
parent01e3da8e0d7d1f0f70fecd1a0123d47e6d99c93d (diff)
support for `-Aoldfile'; joris ok
-rw-r--r--usr.bin/rcs/rcsprog.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c
index d47cceed504..90ab49d065d 100644
--- a/usr.bin/rcs/rcsprog.c
+++ b/usr.bin/rcs/rcsprog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsprog.c,v 1.38 2005/11/04 08:19:42 xsa Exp $ */
+/* $OpenBSD: rcsprog.c,v 1.39 2005/11/12 09:42:29 xsa Exp $ */
/*
* Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -258,7 +258,7 @@ void
rcs_usage(void)
{
fprintf(stderr,
- "usage: rcs [-hiLMUV] [-ausers] [-b[rev]] [-cstring]\n"
+ "usage: rcs [-hiLMUV] [-Aoldfile] [-ausers] [-b[rev]] [-cstring]\n"
" [-eusers] [-kmode] [-mrev:log] file ...\n");
}
@@ -272,22 +272,24 @@ int
rcs_main(int argc, char **argv)
{
int i, ch, flags, kflag, lkmode;
- char fpath[MAXPATHLEN];
+ char fpath[MAXPATHLEN], ofpath[MAXPATHLEN];
char *logstr, *logmsg;
- char *oldfile, *alist, *comment, *elist, *unp, *sp;
+ char *alist, *comment, *elist, *unp, *sp;
mode_t fmode;
- RCSFILE *file;
+ RCSFILE *file, *oldfile;
RCSNUM *logrev;
+ struct rcs_access *acp;
kflag = lkmode = -1;
fmode = 0;
flags = RCS_RDWR;
- logstr = oldfile = alist = comment = elist = NULL;
+ logstr = alist = comment = elist = NULL;
while ((ch = rcs_getopt(argc, argv, "A:a:b::c:e::hik:Lm:MqUV")) != -1) {
switch (ch) {
case 'A':
- oldfile = rcs_optarg;
+ if (rcs_statfile(rcs_optarg, ofpath, sizeof(ofpath)) < 0)
+ exit(1);
break;
case 'a':
alist = rcs_optarg;
@@ -389,6 +391,18 @@ rcs_main(int argc, char **argv)
rcsnum_free(logrev);
}
+ /* entries to add from <oldfile> */
+ if (ofpath != NULL) {
+ /* XXX */
+ if ((oldfile = rcs_open(ofpath, RCS_READ)) == NULL)
+ exit(1);
+
+ TAILQ_FOREACH(acp, &(oldfile->rf_access), ra_list)
+ rcs_access_add(file, acp->ra_name);
+
+ rcs_close(oldfile);
+ }
+
/* entries to add to the access list */
if (alist != NULL) {
unp = alist;