summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarchie <archie@FreeBSD.org>1999-11-02 22:50:34 +0000
committerarchie <archie@FreeBSD.org>1999-11-02 22:50:34 +0000
commit379a856804bca45181540d407b067f13b50206fa (patch)
treeab819ec57aa1f139619750c38ba931be5abe584f
parent71ff24eb062b0e46efa862cb9769dd91357344e4 (diff)
downloadFreeBSD-src-379a856804bca45181540d407b067f13b50206fa.zip
FreeBSD-src-379a856804bca45181540d407b067f13b50206fa.tar.gz
Consolidate some of the various ctype(3) macros in one location.
-rw-r--r--sys/dev/speaker/spkr.c2
-rw-r--r--sys/i386/isa/spkr.c2
-rw-r--r--sys/kern/subr_scanf.c8
-rw-r--r--sys/pc98/pc98/spkr.c2
-rw-r--r--sys/sys/systm.h13
5 files changed, 13 insertions, 14 deletions
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c
index 10cc4a1..7054b27 100644
--- a/sys/dev/speaker/spkr.c
+++ b/sys/dev/speaker/spkr.c
@@ -151,8 +151,6 @@ typedef int bool;
#define TRUE 1
#define FALSE 0
-#define toupper(c) ((c) - ' ' * (((c) >= 'a') && ((c) <= 'z')))
-#define isdigit(c) (((c) >= '0') && ((c) <= '9'))
#define dtoi(c) ((c) - '0')
static int octave; /* currently selected octave */
diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c
index 10cc4a1..7054b27 100644
--- a/sys/i386/isa/spkr.c
+++ b/sys/i386/isa/spkr.c
@@ -151,8 +151,6 @@ typedef int bool;
#define TRUE 1
#define FALSE 0
-#define toupper(c) ((c) - ' ' * (((c) >= 'a') && ((c) <= 'z')))
-#define isdigit(c) (((c) >= '0') && ((c) <= '9'))
#define dtoi(c) ((c) - '0')
static int octave; /* currently selected octave */
diff --git a/sys/kern/subr_scanf.c b/sys/kern/subr_scanf.c
index cd6d5af..d15fe10 100644
--- a/sys/kern/subr_scanf.c
+++ b/sys/kern/subr_scanf.c
@@ -84,14 +84,6 @@
#define CT_INT 3 /* integer, i.e., strtoq or strtouq */
typedef u_quad_t (*ccfntype)(const char *, const char **, int);
-#define isspace(c) ((c) == ' ' || (c) == '\t' || \
- (c) == '\r' || (c) == '\n')
-#define isascii(c) (((c) & ~0x7f) == 0)
-#define isupper(c) ((c) >= 'A' && (c) <= 'Z')
-#define islower(c) ((c) >= 'a' && (c) <= 'z')
-#define isalpha(c) (isupper(c) || (islower(c)))
-#define isdigit(c) ((c) >= '0' && (c) <= '9')
-
static const u_char *__sccl(char *, const u_char *);
int
diff --git a/sys/pc98/pc98/spkr.c b/sys/pc98/pc98/spkr.c
index 3a2098e..f66a5ad 100644
--- a/sys/pc98/pc98/spkr.c
+++ b/sys/pc98/pc98/spkr.c
@@ -184,8 +184,6 @@ typedef int bool;
#define TRUE 1
#define FALSE 0
-#define toupper(c) ((c) - ' ' * (((c) >= 'a') && ((c) <= 'z')))
-#define isdigit(c) (((c) >= '0') && ((c) <= '9'))
#define dtoi(c) ((c) - '0')
static int octave; /* currently selected octave */
diff --git a/sys/sys/systm.h b/sys/sys/systm.h
index 19ca7bc..25fcb27 100644
--- a/sys/sys/systm.h
+++ b/sys/sys/systm.h
@@ -81,6 +81,19 @@ extern int bootverbose; /* nonzero to print verbose messages */
#define KASSERT(exp,msg)
#endif
+#define isspace(c) ((c) == ' ' || ((c) >= '\t' && (c) <= '\r'))
+#define isascii(c) (((c) & ~0x7f) == 0)
+#define isupper(c) ((c) >= 'A' && (c) <= 'Z')
+#define islower(c) ((c) >= 'a' && (c) <= 'z')
+#define isalpha(c) (isupper(c) || islower(c))
+#define isdigit(c) ((c) >= '0' && (c) <= '9')
+#define isxdigit(c) (isdigit(c) \
+ || ((c) >= 'A' && (c) <= 'F') \
+ || ((c) >= 'a' && (c) <= 'f'))
+
+#define toupper(c) ((c) - 0x20 * (((c) >= 'a') && ((c) <= 'z')))
+#define tolower(c) ((c) + 0x20 * (((c) >= 'A') && ((c) <= 'Z')))
+
/*
* General function declarations.
*/
OpenPOWER on IntegriCloud