summaryrefslogtreecommitdiff
path: root/usr.bin/cvs
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2005-03-07 19:41:08 +0000
committerJoris Vink <joris@cvs.openbsd.org>2005-03-07 19:41:08 +0000
commit7e26a82d8c9ab5e1c3a2a81b8d4002b400517c3b (patch)
treeaebc4ad07b58f5aeecad9bc07be8e26f9cc44597 /usr.bin/cvs
parentc3c2d5372de521f697103d4382015678a9f9d4ef (diff)
use rcs_kflag_get() and RCS_KWEXP_INVAL() to check for valid
RCS keyword expansion modes, also call rcs_kflag_usage() when an invalid mode is specified. ok jfb@
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r--usr.bin/cvs/admin.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/usr.bin/cvs/admin.c b/usr.bin/cvs/admin.c
index c93d2ad5a2e..6f96856242d 100644
--- a/usr.bin/cvs/admin.c
+++ b/usr.bin/cvs/admin.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: admin.c,v 1.2 2005/03/07 16:25:48 joris Exp $ */
+/* $OpenBSD: admin.c,v 1.3 2005/03/07 19:41:07 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
@@ -61,8 +61,7 @@ int
cvs_admin(int argc, char **argv)
{
int i, ch, flags;
- int runflags;
- int lockrev, strictlock;
+ int runflags, kflag, lockrev, strictlock;
char *q;
char *comment, *replace_msg;
char *alist, *subst, *lockrev_arg, *unlockrev_arg;
@@ -104,6 +103,13 @@ cvs_admin(int argc, char **argv)
break;
case 'k':
subst = optarg;
+ kflag = rcs_kflag_get(subst);
+ if (RCS_KWEXP_INVAL(kflag)) {
+ cvs_log(LP_ERR,
+ "invalid RCS keyword expansion mode");
+ rcs_kflag_usage();
+ return (EX_USAGE);
+ }
break;
case 'l':
lockrev |= LOCK_SET;
@@ -169,14 +175,6 @@ cvs_admin(int argc, char **argv)
rcsnum_free(rcs);
}
- if (subst != NULL) {
- if (strcmp(subst, "kv") && strcmp(subst, "kvl") &&
- *subst != 'o' && *subst != 'b' && *subst != 'v') {
- cvs_log(LP_ERR, "invalid RCS keyword expansion mode");
- return (EX_USAGE);
- }
- }
-
if (replace_msg != NULL) {
if ((q = strchr(replace_msg, ':')) == NULL) {
cvs_log(LP_ERR, "invalid option for -m");