diff options
author | Joris Vink <joris@cvs.openbsd.org> | 2005-10-10 23:38:22 +0000 |
---|---|---|
committer | Joris Vink <joris@cvs.openbsd.org> | 2005-10-10 23:38:22 +0000 |
commit | 84fda661a2bede6fee3618d564755fe193e9c2ba (patch) | |
tree | efa5552f41d7011af332c88860273482a68ceaae | |
parent | c1819158b42f80389ff9a6937b6309e7d8897d22 (diff) |
support -mrevision:logmessage; used to set a log message of a revision
to the specified value;
ok niallo@
-rw-r--r-- | usr.bin/rcs/rcsprog.c | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c index 9c99544a623..077f9ceedc3 100644 --- a/usr.bin/rcs/rcsprog.c +++ b/usr.bin/rcs/rcsprog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsprog.c,v 1.23 2005/10/10 14:37:59 niallo Exp $ */ +/* $OpenBSD: rcsprog.c,v 1.24 2005/10/10 23:38:21 joris Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -129,8 +129,8 @@ void rcs_usage(void) { fprintf(stderr, - "usage: %s [-hiLMUV] [-a users] [-b [rev]] [-c string] " - "[-e users] [-k opt] file ...\n", __progname); + "usage: %s [-hiLMUV] [-a users] [-b [rev]] [-c string]\n" + "[-e users] [-k opt] [-m rev:log] file ...\n", __progname); } /* @@ -144,16 +144,18 @@ rcs_main(int argc, char **argv) { int i, ch, flags, kflag, lkmode; char fpath[MAXPATHLEN]; + char *logstr, *logmsg; char *oldfile, *alist, *comment, *elist, *unp, *sp; mode_t fmode; RCSFILE *file; + RCSNUM *logrev; kflag = lkmode = -1; fmode = 0; flags = RCS_RDWR; - oldfile = alist = comment = elist = NULL; + logstr = oldfile = alist = comment = elist = NULL; - while ((ch = getopt(argc, argv, "A:a:b::c:e::hik:LMqUV")) != -1) { + while ((ch = getopt(argc, argv, "A:a:b::c:e::hik:Lm:MqUV")) != -1) { switch (ch) { case 'A': oldfile = optarg; @@ -187,6 +189,12 @@ rcs_main(int argc, char **argv) cvs_log(LP_WARN, "-U overriden by -L"); lkmode = RCS_LOCK_STRICT; break; + case 'm': + if ((logstr = strdup(optarg)) == NULL) { + cvs_log(LP_ERRNO, "failed to copy logstring"); + exit(1); + } + break; case 'M': /* ignore for the moment */ break; @@ -223,6 +231,31 @@ rcs_main(int argc, char **argv) if (file == NULL) continue; + if (logstr != NULL) { + if ((logmsg = strchr(logstr, ':')) == NULL) { + cvs_log(LP_ERR, "missing log message"); + rcs_close(file); + continue; + } + + *logmsg++ = '\0'; + if ((logrev = rcsnum_parse(logstr)) == NULL) { + cvs_log(LP_ERR, "'%s' bad revision number", logstr); + rcs_close(file); + continue; + } + + if (rcs_rev_setlog(file, logrev, logmsg) < 0) { + cvs_log(LP_ERR, + "failed to set logmsg for '%s' to '%s'", + logstr, logmsg); + rcs_close(file); + continue; + } + + rcsnum_free(logrev); + } + /* entries to add to the access list */ if (alist != NULL) { unp = alist; @@ -252,5 +285,8 @@ rcs_main(int argc, char **argv) printf("done\n"); } + if (logstr != NULL) + free(logstr); + return (0); } |