diff options
author | mmcc <mmcc@cvs.openbsd.org> | 2015-11-12 04:04:32 +0000 |
---|---|---|
committer | mmcc <mmcc@cvs.openbsd.org> | 2015-11-12 04:04:32 +0000 |
commit | 95c7d027a8eff24e868e5694eb60e1c22960f39d (patch) | |
tree | 33c13ee3d9cbe80f047b4cbf3f10816f3440f775 /bin/ksh | |
parent | d94a8e4edbe2fe499941cfa18fc38a7974af3d0b (diff) |
Use isdigit() instead of ksh's homebrewed alternative.
ok nicm@. Also discussed with millert@ and guenther@.
Diffstat (limited to 'bin/ksh')
-rw-r--r-- | bin/ksh/c_sh.c | 3 | ||||
-rw-r--r-- | bin/ksh/c_ulimit.c | 3 | ||||
-rw-r--r-- | bin/ksh/eval.c | 3 | ||||
-rw-r--r-- | bin/ksh/jobs.c | 3 | ||||
-rw-r--r-- | bin/ksh/lex.c | 6 | ||||
-rw-r--r-- | bin/ksh/misc.c | 3 | ||||
-rw-r--r-- | bin/ksh/sh.h | 8 | ||||
-rw-r--r-- | bin/ksh/shf.c | 3 | ||||
-rw-r--r-- | bin/ksh/trap.c | 3 |
9 files changed, 20 insertions, 15 deletions
diff --git a/bin/ksh/c_sh.c b/bin/ksh/c_sh.c index 153716cab2b..6ac00e851f2 100644 --- a/bin/ksh/c_sh.c +++ b/bin/ksh/c_sh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: c_sh.c,v 1.54 2015/11/01 15:38:53 mmcc Exp $ */ +/* $OpenBSD: c_sh.c,v 1.55 2015/11/12 04:04:31 mmcc Exp $ */ /* * built-in Bourne commands @@ -8,6 +8,7 @@ #include <sys/stat.h> #include <sys/time.h> +#include <ctype.h> #include <string.h> #include "sh.h" diff --git a/bin/ksh/c_ulimit.c b/bin/ksh/c_ulimit.c index 8d3124e2764..0333e750786 100644 --- a/bin/ksh/c_ulimit.c +++ b/bin/ksh/c_ulimit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: c_ulimit.c,v 1.22 2015/10/19 14:42:16 mmcc Exp $ */ +/* $OpenBSD: c_ulimit.c,v 1.23 2015/11/12 04:04:31 mmcc Exp $ */ /* ulimit -- handle "ulimit" builtin @@ -20,6 +20,7 @@ #include <sys/resource.h> +#include <ctype.h> #include <string.h> #include "sh.h" diff --git a/bin/ksh/eval.c b/bin/ksh/eval.c index 3dd83a9f4cb..86f8fee1423 100644 --- a/bin/ksh/eval.c +++ b/bin/ksh/eval.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eval.c,v 1.46 2015/10/19 17:15:53 mmcc Exp $ */ +/* $OpenBSD: eval.c,v 1.47 2015/11/12 04:04:31 mmcc Exp $ */ /* * Expansion - quoting, separation, substitution, globbing @@ -6,6 +6,7 @@ #include <sys/stat.h> +#include <ctype.h> #include <dirent.h> #include <pwd.h> #include <string.h> diff --git a/bin/ksh/jobs.c b/bin/ksh/jobs.c index 09d073028da..8f50774c36d 100644 --- a/bin/ksh/jobs.c +++ b/bin/ksh/jobs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: jobs.c,v 1.50 2015/10/19 14:42:16 mmcc Exp $ */ +/* $OpenBSD: jobs.c,v 1.51 2015/11/12 04:04:31 mmcc Exp $ */ /* * Process and job control @@ -20,6 +20,7 @@ #include <sys/time.h> #include <sys/wait.h> +#include <ctype.h> #include <limits.h> #include <string.h> diff --git a/bin/ksh/lex.c b/bin/ksh/lex.c index f4e30aa72f7..029d8dc5340 100644 --- a/bin/ksh/lex.c +++ b/bin/ksh/lex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lex.c,v 1.62 2015/11/01 15:38:53 mmcc Exp $ */ +/* $OpenBSD: lex.c,v 1.63 2015/11/12 04:04:31 mmcc Exp $ */ /* * lexical analysis and source input @@ -399,12 +399,12 @@ yylex(int cf) Xcheck(ws, wp); *wp++ = c; c = getsc(); - } while (ctype(c, C_ALPHA|C_DIGIT)); + } while (ctype(c, C_ALPHA) || digit(c)); *wp++ = '\0'; *wp++ = CSUBST; *wp++ = 'X'; ungetsc(c); - } else if (ctype(c, C_DIGIT|C_VAR1)) { + } else if (ctype(c, C_VAR1) || digit(c)) { Xcheck(ws, wp); *wp++ = OSUBST; *wp++ = 'X'; diff --git a/bin/ksh/misc.c b/bin/ksh/misc.c index 7e23257007b..c8e2c4653ff 100644 --- a/bin/ksh/misc.c +++ b/bin/ksh/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.50 2015/10/19 17:15:53 mmcc Exp $ */ +/* $OpenBSD: misc.c,v 1.51 2015/11/12 04:04:31 mmcc Exp $ */ /* * Miscellaneous functions @@ -44,7 +44,6 @@ initctypes(void) for (c = 'A'; c <= 'Z'; c++) ctypes[c] |= C_ALPHA; ctypes['_'] |= C_ALPHA; - setctypes("0123456789", C_DIGIT); setctypes(" \t\n|&;<>()", C_LEX1); /* \0 added automatically */ setctypes("*@#!$-?", C_VAR1); setctypes(" \t\n", C_IFSWS); diff --git a/bin/ksh/sh.h b/bin/ksh/sh.h index fd36627b7c0..ecab6e79261 100644 --- a/bin/ksh/sh.h +++ b/bin/ksh/sh.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sh.h,v 1.52 2015/11/07 20:48:28 mmcc Exp $ */ +/* $OpenBSD: sh.h,v 1.53 2015/11/12 04:04:31 mmcc Exp $ */ /* * Public Domain Bourne/Korn shell @@ -282,7 +282,7 @@ extern int really_exit; * fast character classes */ #define C_ALPHA BIT(0) /* a-z_A-Z */ -#define C_DIGIT BIT(1) /* 0-9 */ +/* was C_DIGIT */ #define C_LEX1 BIT(2) /* \0 \t\n|&;<>() */ #define C_VAR1 BIT(3) /* *@#!$-? */ #define C_IFSWS BIT(4) /* \t \n (IFS white space) */ @@ -295,8 +295,8 @@ extern short ctypes []; #define ctype(c, t) !!(ctypes[(unsigned char)(c)]&(t)) #define letter(c) ctype(c, C_ALPHA) -#define digit(c) ctype(c, C_DIGIT) -#define letnum(c) ctype(c, C_ALPHA|C_DIGIT) +#define digit(c) isdigit((unsigned char)(c)) +#define letnum(c) (ctype(c, C_ALPHA) || isdigit((unsigned char)(c))) extern int ifs0; /* for "$*" */ diff --git a/bin/ksh/shf.c b/bin/ksh/shf.c index dbd0c309af6..989f8db44af 100644 --- a/bin/ksh/shf.c +++ b/bin/ksh/shf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: shf.c,v 1.28 2015/11/01 23:31:54 mmcc Exp $ */ +/* $OpenBSD: shf.c,v 1.29 2015/11/12 04:04:31 mmcc Exp $ */ /* * Shell file I/O routines @@ -6,6 +6,7 @@ #include <sys/stat.h> +#include <ctype.h> #include <limits.h> #include <string.h> diff --git a/bin/ksh/trap.c b/bin/ksh/trap.c index e8b6f3bb26a..bf6d240472c 100644 --- a/bin/ksh/trap.c +++ b/bin/ksh/trap.c @@ -1,9 +1,10 @@ -/* $OpenBSD: trap.c,v 1.27 2015/10/19 14:42:16 mmcc Exp $ */ +/* $OpenBSD: trap.c,v 1.28 2015/11/12 04:04:31 mmcc Exp $ */ /* * signal handling */ +#include <ctype.h> #include <string.h> #include "sh.h" |