From d179df1b06718b950b54963c0c11b619e28ba016 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 7 Dec 1992 04:54:04 +0000 Subject: Remove inclusion of and definitions of is* ctype macros to system.h. Change a few more uses of is* ctype macros to (protected) upper case versions. --- src/csplit.c | 3 +-- src/cut.c | 13 ++----------- src/expand.c | 13 ++----------- src/fold.c | 7 ++----- src/head.c | 7 ------- src/join.c | 15 ++------------- src/od.c | 9 --------- src/pr.c | 10 +--------- src/sort.c | 21 +++------------------ src/split.c | 3 +-- src/tail.c | 7 ------- src/tr.c | 27 --------------------------- src/unexpand.c | 13 ++----------- src/uniq.c | 9 +++------ 14 files changed, 19 insertions(+), 138 deletions(-) diff --git a/src/csplit.c b/src/csplit.c index ec8d2ed51..7b2165e5f 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -20,7 +20,6 @@ #include #include -#include #include #include #include "regex.h" @@ -1051,7 +1050,7 @@ string_to_number (result, num) while ((ch = *num++)) { - if (!isdigit (ch)) + if (!ISDIGIT (ch)) return FALSE; val = val * 10 + ch - '0'; } diff --git a/src/cut.c b/src/cut.c index 1069a6400..6e95f0a15 100644 --- a/src/cut.c +++ b/src/cut.c @@ -59,21 +59,12 @@ /* Get isblank from GNU libc. */ #define _GNU_SOURCE -#include -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif + #include #include #include #include "system.h" -#ifdef isascii -#define ISDIGIT(c) (isascii ((c)) && isdigit ((c))) -#else -#define ISDIGIT(c) (isdigit ((c))) -#endif - char *xmalloc (); char *xrealloc (); void error (); @@ -286,7 +277,7 @@ set_fields (fieldstr) else initial = 1; } - else if (*fieldstr == ',' || isblank (*fieldstr) || *fieldstr == '\0') + else if (*fieldstr == ',' || ISBLANK (*fieldstr) || *fieldstr == '\0') { /* Ending the string, or this field/byte sublist. */ if (dash_found) diff --git a/src/expand.c b/src/expand.c index a4fb1af5b..17d215b43 100644 --- a/src/expand.c +++ b/src/expand.c @@ -35,21 +35,12 @@ /* Get isblank from GNU libc. */ #define _GNU_SOURCE -#include -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif + #include #include #include #include "system.h" -#ifdef isascii -#define ISDIGIT(c) (isascii ((c)) && isdigit ((c))) -#else -#define ISDIGIT(c) (isdigit ((c))) -#endif - /* The number of bytes added at a time to the amount of memory allocated for the output line. */ #define OUTPUT_BLOCK 256 @@ -187,7 +178,7 @@ parse_tabstops (stops) for (; *stops; stops++) { - if (*stops == ',' || isblank (*stops)) + if (*stops == ',' || ISBLANK (*stops)) { add_tabstop (tabval); tabval = -1; diff --git a/src/fold.c b/src/fold.c index 3cd471596..fcdd885b1 100644 --- a/src/fold.c +++ b/src/fold.c @@ -19,10 +19,7 @@ /* Get isblank from GNU libc. */ #define _GNU_SOURCE -#include -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif + #include #include #include @@ -169,7 +166,7 @@ fold_file (filename, width) for (logical_end = offset_out - 1; logical_end >= 0; logical_end--) - if (isblank (line_out[logical_end])) + if (ISBLANK (line_out[logical_end])) break; if (logical_end >= 0) { diff --git a/src/head.c b/src/head.c index b0719c826..c818c6612 100644 --- a/src/head.c +++ b/src/head.c @@ -35,16 +35,9 @@ #include #include -#include #include #include "system.h" -#ifdef isascii -#define ISDIGIT(c) (isascii ((c)) && isdigit ((c))) -#else -#define ISDIGIT(c) (isdigit ((c))) -#endif - /* Number of lines/chars/blocks to head. */ #define DEFAULT_NUMBER 10 diff --git a/src/join.c b/src/join.c index 2399ad4ac..c826df824 100644 --- a/src/join.c +++ b/src/join.c @@ -19,23 +19,12 @@ /* Get isblank from GNU libc. */ #define _GNU_SOURCE -#include -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif + #include #include #include #include "system.h" -#ifdef isascii -#define ISSPACE(c) (isascii(c) && isspace(c)) -#define ISDIGIT(c) (isascii(c) && isdigit(c)) -#else -#define ISSPACE(c) isspace(c) -#define ISDIGIT(c) isdigit(c) -#endif - char *xmalloc (); char *xrealloc (); void error (); @@ -526,7 +515,7 @@ add_field_list (str) for (; *str; str++) { - if (*str == ',' || isblank (*str)) + if (*str == ',' || ISBLANK (*str)) { added += add_field (file, field); file = field = -1; diff --git a/src/od.c b/src/od.c index eb6ffed31..ae2c3da3b 100644 --- a/src/od.c +++ b/src/od.c @@ -33,20 +33,11 @@ char *alloca (); #endif /* not __GNUC__ */ #include -#include #include #include #include #include "system.h" -#ifdef isascii -#define ISPRINT(c) (isascii (c) && isprint (c)) -#define ISDIGIT(c) (isascii (c) && isdigit (c)) -#else -#define ISPRINT(c) isprint (c) -#define ISDIGIT(c) isdigit (c) -#endif - #if defined(__GNUC__) || defined(STDC_HEADERS) #include #endif diff --git a/src/pr.c b/src/pr.c index fe65c7659..c49819d80 100644 --- a/src/pr.c +++ b/src/pr.c @@ -93,21 +93,13 @@ -w width Set the page width to WIDTH characters. */ + #include #include -#include #include #include #include "system.h" -#ifdef isascii -#define ISPRINT(c) (isascii (c) && isprint (c)) -#define ISDIGIT(c) (isascii (c) && isdigit (c)) -#else -#define ISPRINT(c) isprint (c) -#define ISDIGIT(c) isdigit (c) -#endif - char *xmalloc (); char *xrealloc (); void error (); diff --git a/src/sort.c b/src/sort.c index c2f15ec8b..e514284b8 100644 --- a/src/sort.c +++ b/src/sort.c @@ -21,10 +21,7 @@ /* Get isblank from GNU libc. */ #define _GNU_SOURCE -#include -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif + #include #include #include @@ -49,18 +46,6 @@ static void usage (); #define UCHAR_LIM (UCHAR_MAX + 1) #define UCHAR(c) ((unsigned char) (c)) -#ifdef isascii -#define ISALNUM(c) (isascii(c) && isalnum(c)) -#define ISDIGIT(c) (isascii(c) && isdigit(c)) -#define ISPRINT(c) (isascii(c) && isprint(c)) -#define ISLOWER(c) (isascii(c) && islower(c)) -#else -#define ISALNUM(c) isalnum(c) -#define ISDIGIT(c) isdigit(c) -#define ISPRINT(c) isprint(c) -#define ISLOWER(c) islower(c) -#endif - /* The kind of blanks for '-b' to skip in various options. */ enum blanktype { bl_start, bl_end, bl_both }; @@ -353,13 +338,13 @@ inittables () for (i = 0; i < UCHAR_LIM; ++i) { - if (isblank (i)) + if (ISBLANK (i)) blanks[i] = 1; if (ISDIGIT (i)) digits[i] = 1; if (!ISPRINT (i)) nonprinting[i] = 1; - if (!ISALNUM (i) && !isblank (i)) + if (!ISALNUM (i) && !ISBLANK (i)) nondictionary[i] = 1; if (ISLOWER (i)) fold_toupper[i] = toupper (i); diff --git a/src/split.c b/src/split.c index a2aee897b..980edf310 100644 --- a/src/split.c +++ b/src/split.c @@ -23,7 +23,6 @@ #include #include -#include #include #include "system.h" @@ -262,7 +261,7 @@ isdigits (str) { do { - if (!isdigit (*str)) + if (!ISDIGIT (*str)) return 0; str++; } diff --git a/src/tail.c b/src/tail.c index 969488b7b..a94ac9c63 100644 --- a/src/tail.c +++ b/src/tail.c @@ -47,17 +47,10 @@ #include #include -#include #include #include #include "system.h" -#ifdef isascii -#define ISDIGIT(c) (isascii ((c)) && isdigit ((c))) -#else -#define ISDIGIT(c) (isdigit ((c))) -#endif - /* Number of items to tail. */ #define DEFAULT_NUMBER 10 diff --git a/src/tr.c b/src/tr.c index e943903f8..8ba07d0a7 100644 --- a/src/tr.c +++ b/src/tr.c @@ -19,33 +19,6 @@ /* Get isblank from GNU libc. */ #define _GNU_SOURCE -#include - -#ifndef isascii -#define isascii(c) 1 -#endif - -#ifdef isblank -#define ISBLANK(c) (isascii (c) isblank (c)) -#else -#define ISBLANK(c) ((c) == ' ' || (c) == '\t') -#endif -#ifdef isgraph -#define ISGRAPH(c) (isascii (c) isgraph (c)) -#else -#define ISGRAPH(c) (isascii (c) isprint (c) && !isspace (c)) -#endif - -#define ISPRINT(c) (isascii (c) isprint (c)) -#define ISDIGIT(c) (isascii (c) isdigit (c)) -#define ISALNUM(c) (isascii (c) isalnum (c)) -#define ISALPHA(c) (isascii (c) isalpha (c)) -#define ISCNTRL(c) (isascii (c) iscntrl (c)) -#define ISLOWER(c) (isascii (c) islower (c)) -#define ISPUNCT(c) (isascii (c) ispunct (c)) -#define ISSPACE(c) (isascii (c) isspace (c)) -#define ISUPPER(c) (isascii (c) isupper (c)) -#define ISXDIGIT(c) (isascii (c) isxdigit (c)) #include #include diff --git a/src/unexpand.c b/src/unexpand.c index e3de5e709..01dc41762 100644 --- a/src/unexpand.c +++ b/src/unexpand.c @@ -37,21 +37,12 @@ /* Get isblank from GNU libc. */ #define _GNU_SOURCE -#include -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif + #include #include #include #include "system.h" -#ifdef isascii -#define ISDIGIT(c) (isascii((c)) && isdigit((c))) -#else -#define ISDIGIT(c) (isdigit((c))) -#endif - /* The number of bytes added at a time to the amount of memory allocated for the output line. */ #define OUTPUT_BLOCK 256 @@ -189,7 +180,7 @@ parse_tabstops (stops) for (; *stops; stops++) { - if (*stops == ',' || isblank (*stops)) + if (*stops == ',' || ISBLANK (*stops)) { add_tabstop (tabval); tabval = -1; diff --git a/src/uniq.c b/src/uniq.c index 1b8e8e4d3..944727f81 100644 --- a/src/uniq.c +++ b/src/uniq.c @@ -19,10 +19,7 @@ /* Get isblank from GNU libc. */ #define _GNU_SOURCE -#include -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif + #include #include #include @@ -249,9 +246,9 @@ find_field (line) for (count = 0; count < skip_fields && i < size; count++) { - while (i < size && isblank (lp[i])) + while (i < size && ISBLANK (lp[i])) i++; - while (i < size && !isblank (lp[i])) + while (i < size && !ISBLANK (lp[i])) i++; } -- cgit v1.2.3-70-g09d2