summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoris <joris@openbsd.org>2005-03-07 19:41:07 +0000
committerjoris <joris@openbsd.org>2005-03-07 19:41:07 +0000
commita51c8b74f8611bda3f297594d12aa74d44428794 (patch)
tree1f08add62efe81520f3d0963e4f489d9ca02019d
parentprint ASIC ID in hex too incase only the "superclass" of the ASIC is (diff)
downloadwireguard-openbsd-a51c8b74f8611bda3f297594d12aa74d44428794.tar.xz
wireguard-openbsd-a51c8b74f8611bda3f297594d12aa74d44428794.zip
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@
-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");