1 /* WARNING -- this file is temporary. It is shared between the
2 sh-utils, fileutils, and textutils packages. Once I find a little
3 more time, I'll merge the remaining things in system.h and everything
4 in this file will go back there. */
7 # define RETSIGTYPE void
31 /* Jim Meyering writes:
33 "... Some ctype macros are valid only for character codes that
34 isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when
35 using /bin/cc or gcc but without giving an ansi option). So, all
36 ctype uses should be through macros like ISPRINT... If
37 STDC_HEADERS is defined, then autoconf has verified that the ctype
38 macros don't need to be guarded with references to isascii. ...
39 Defining isascii to 1 should let any compiler worth its salt
40 eliminate the && through constant folding."
44 "... Furthermore, isupper(c) etc. have an undefined result if c is
45 outside the range -1 <= c <= 255. One is tempted to write isupper(c)
46 with c being of type `char', but this is wrong if c is an 8-bit
47 character >= 128 which gets sign-extended to a negative value.
48 The macro ISUPPER protects against this as well." */
50 #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
51 # define IN_CTYPE_DOMAIN(c) 1
53 # define IN_CTYPE_DOMAIN(c) isascii(c)
57 # define ISBLANK(c) (IN_CTYPE_DOMAIN (c) && isblank (c))
59 # define ISBLANK(c) ((c) == ' ' || (c) == '\t')
62 # define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isgraph (c))
64 # define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isprint (c) && !isspace (c))
67 #define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
68 #define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c))
69 #define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
70 #define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c))
71 #define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
72 #define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (c))
73 #define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
74 #define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
75 #define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
76 #define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
78 /* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
79 - Its arg may be any int or unsigned int; it need not be an unsigned char.
80 - It's guaranteed to evaluate its argument exactly once.
81 - It's typically faster.
82 Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
83 only '0' through '9' are digits. Prefer ISDIGIT to ISDIGIT_LOCALE unless
84 it's important to use the locale's definition of `digit' even when the
85 host does not conform to Posix. */
86 #define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
90 # define PARAMS(Args) Args
92 # define PARAMS(Args) ()
96 /* Take care of NLS matters. */
102 # define setlocale(Category, Locale) /* empty */
106 # include <libintl.h>
107 # define _(Text) gettext (Text)
109 # undef bindtextdomain
110 # define bindtextdomain(Domain, Directory) /* empty */
112 # define textdomain(Domain) /* empty */
113 # define _(Text) Text
115 #define N_(Text) Text
117 #define STREQ(a,b) (strcmp((a), (b)) == 0)
119 #ifndef HAVE_DECL_FREE
123 #ifndef HAVE_DECL_MALLOC
127 #ifndef HAVE_DECL_MEMCHR
131 #ifndef HAVE_DECL_REALLOC
135 #ifndef HAVE_DECL_STPCPY
141 #ifndef HAVE_DECL_STRSTR
145 #ifndef HAVE_DECL_GETENV
149 #ifndef HAVE_DECL_LSEEK
156 /* Be CAREFUL that there are no side effects in N. */
157 # define mempcpy(D, S, N) ((void *) ((char *) memcpy (D, S, N) + (N)))