summaryrefslogtreecommitdiff
path: root/usr.bin/less
diff options
context:
space:
mode:
authormmcc <mmcc@cvs.openbsd.org>2015-11-12 18:46:51 +0000
committermmcc <mmcc@cvs.openbsd.org>2015-11-12 18:46:51 +0000
commit83cb9a347c6a2d099c58cd9d3af51231d1192e12 (patch)
tree459e99b3d19932cbb802b0f99bbf8cf1f81901e0 /usr.bin/less
parentd7ee32551043146ed52094b9bb6cc6d75e7e7944 (diff)
Back out of is_optchar() removal. daniel@ was not a fan.
Diffstat (limited to 'usr.bin/less')
-rw-r--r--usr.bin/less/opttbl.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/usr.bin/less/opttbl.c b/usr.bin/less/opttbl.c
index 1e9ac28ebc4..144c1e7af4b 100644
--- a/usr.bin/less/opttbl.c
+++ b/usr.bin/less/opttbl.c
@@ -466,6 +466,18 @@ findopt(int c)
}
/*
+ *
+ */
+static int
+is_optchar(unsigned char c)
+{
+ if (isupper(c) || islower(c) || c == '-')
+ return (1);
+ else
+ return (0);
+}
+
+/*
* Find an option in the option table, given its option name.
* p_optname is the (possibly partial) name to look for, and
* is updated to point after the matched name.
@@ -500,10 +512,7 @@ findopt_name(char **p_optname, char **p_oname, int *p_err)
*/
for (uppercase = 0; uppercase <= 1; uppercase++) {
len = sprefix(optname, oname->oname, uppercase);
- if (len <= 0 ||
- isupper((unsigned char)optname[len]) ||
- islower((unsigned char)optname[len]) ||
- optname[len] == '-') {
+ if (len <= 0 || is_optchar(optname[len])) {
/*
* We didn't use all of the option name.
*/