summaryrefslogtreecommitdiff
path: root/usr.bin/rcs/rcsprog.c
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2005-10-18 01:22:15 +0000
committerJoris Vink <joris@cvs.openbsd.org>2005-10-18 01:22:15 +0000
commit3e3f56b0a6c8f5f053f6a2a188676a5e1ed64295 (patch)
tree708d9f91a84c1eed0b7c7c6e641379d1f96bf874 /usr.bin/rcs/rcsprog.c
parentca9e031aa8f1babfe7e3a3579d5b02e315ff433c (diff)
use rcs_set_rev() instead of duplicating code all over the
place to set a variable to the given revision number;
Diffstat (limited to 'usr.bin/rcs/rcsprog.c')
-rw-r--r--usr.bin/rcs/rcsprog.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c
index 39c14379a90..b1edc119367 100644
--- a/usr.bin/rcs/rcsprog.c
+++ b/usr.bin/rcs/rcsprog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcsprog.c,v 1.30 2005/10/16 00:25:14 joris Exp $ */
+/* $OpenBSD: rcsprog.c,v 1.31 2005/10/18 01:22:14 joris Exp $ */
/*
* Copyright (c) 2005 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -64,6 +64,18 @@ struct rcs_prog {
{ "ident", ident_main, ident_usage },
};
+void
+rcs_set_rev(const char *str, RCSNUM **rev)
+{
+ if (*rev != RCS_HEAD_REV)
+ cvs_log(LP_WARN, "redefinition of revision number");
+
+ if ((*rev = rcsnum_parse(str)) == NULL) {
+ cvs_log(LP_ERR, "bad revision number '%s'", str);
+ exit (1);
+ }
+}
+
int
rcs_init(char *envstr, char **argv, int argvlen)
{