diff options
author | Jim Meyering <jim@meyering.net> | 1992-12-07 04:54:04 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1992-12-07 04:54:04 +0000 |
commit | d179df1b06718b950b54963c0c11b619e28ba016 (patch) | |
tree | dc0cab0f46a3bf082ae42a20d8eeeea84bb7aece | |
parent | 57e56eb7ecaf708b248af8faebd972a0ce6f03c1 (diff) | |
download | coreutils-d179df1b06718b950b54963c0c11b619e28ba016.tar.xz |
Remove inclusion of <ctype.h> and definitions of is* ctype macros to system.h.
Change a few more uses of is* ctype macros to (protected) upper case versions.
-rw-r--r-- | src/csplit.c | 3 | ||||
-rw-r--r-- | src/cut.c | 13 | ||||
-rw-r--r-- | src/expand.c | 13 | ||||
-rw-r--r-- | src/fold.c | 7 | ||||
-rw-r--r-- | src/head.c | 7 | ||||
-rw-r--r-- | src/join.c | 15 | ||||
-rw-r--r-- | src/od.c | 9 | ||||
-rw-r--r-- | src/pr.c | 10 | ||||
-rw-r--r-- | src/sort.c | 21 | ||||
-rw-r--r-- | src/split.c | 3 | ||||
-rw-r--r-- | src/tail.c | 7 | ||||
-rw-r--r-- | src/tr.c | 27 | ||||
-rw-r--r-- | src/unexpand.c | 13 | ||||
-rw-r--r-- | 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 <stdio.h> #include <getopt.h> -#include <ctype.h> #include <sys/types.h> #include <signal.h> #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'; } @@ -59,21 +59,12 @@ /* Get isblank from GNU libc. */ #define _GNU_SOURCE -#include <ctype.h> -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif + #include <stdio.h> #include <getopt.h> #include <sys/types.h> #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 <ctype.h> -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif + #include <stdio.h> #include <getopt.h> #include <sys/types.h> #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 <ctype.h> -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif + #include <stdio.h> #include <getopt.h> #include <sys/types.h> @@ -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 <stdio.h> #include <getopt.h> -#include <ctype.h> #include <sys/types.h> #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 <ctype.h> -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif + #include <stdio.h> #include <sys/types.h> #include <getopt.h> #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; @@ -33,20 +33,11 @@ char *alloca (); #endif /* not __GNUC__ */ #include <stdio.h> -#include <ctype.h> #include <assert.h> #include <getopt.h> #include <sys/types.h> #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 <float.h> #endif @@ -93,21 +93,13 @@ -w width Set the page width to WIDTH characters. */ + #include <stdio.h> #include <getopt.h> -#include <ctype.h> #include <sys/types.h> #include <time.h> #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 <ctype.h> -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif + #include <sys/types.h> #include <signal.h> #include <stdio.h> @@ -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 <stdio.h> #include <getopt.h> -#include <ctype.h> #include <sys/types.h> #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 <stdio.h> #include <getopt.h> -#include <ctype.h> #include <sys/types.h> #include <signal.h> #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 @@ -19,33 +19,6 @@ /* Get isblank from GNU libc. */ #define _GNU_SOURCE -#include <ctype.h> - -#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 <stdio.h> #include <assert.h> 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 <ctype.h> -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif + #include <stdio.h> #include <getopt.h> #include <sys/types.h> #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 <ctype.h> -#ifndef isblank -#define isblank(c) ((c) == ' ' || (c) == '\t') -#endif + #include <stdio.h> #include <getopt.h> #include <sys/types.h> @@ -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++; } |