1 /* system-dependent definitions; derived from those of coreutils
2 Copyright (C) 1989, 1991-2008, 2010-2013 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 /* Include sys/types.h before this file. */
19 #if 2 <= __GLIBC__ && 2 <= __GLIBC_MINOR__
20 # if ! defined _SYS_TYPES_H
21 you must include
<sys
/types
.h
> before including
this file
28 # include <sys/param.h>
36 #include "configmake.h"
41 /* Exit statuses for programs like 'env' that exec other programs.
42 EXIT_FAILURE might not be 1, so use EXIT_FAIL in such programs. */
46 EXIT_CANNOT_INVOKE
= 126,
52 /* Redirection and wildcarding when done by the utility itself.
53 Generally a noop, but used in particular for native VMS. */
54 #ifndef initialize_main
55 # define initialize_main(ac, av)
58 #include "stat-macros.h"
62 #if ! (defined isblank || HAVE_DECL_ISBLANK)
63 # define isblank(c) ((c) == ' ' || (c) == '\t')
66 /* ISDIGIT differs from isdigit, as follows:
67 - Its arg may be any int or unsigned int; it need not be an unsigned char
69 - It's typically faster.
70 POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
71 isdigit unless it's important to use the locale's definition
72 of `digit' even when the host does not conform to POSIX. */
73 #define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
75 /* Convert a possibly-signed character to an unsigned character. This is
76 a bit safer than casting to unsigned char, since it catches some type
77 errors that the cast doesn't. */
78 static inline unsigned char to_uchar (char ch
) { return ch
; }
82 /* Take care of NLS matters. */
87 # define textdomain(Domainname) /* empty */
88 # undef bindtextdomain
89 # define bindtextdomain(Domainname, Dirname) /* empty */
92 #define _(msgid) gettext (msgid)
93 #define N_(msgid) msgid
95 #define STREQ(a, b) (strcmp ((a), (b)) == 0)
100 #include "unlocked-io.h"
102 /* Factor out some of the common --help and --version processing code. */
104 /* These enum values cannot possibly conflict with the option values
105 ordinarily used by commands, including CHAR_MAX + 1, etc. Avoid
106 CHAR_MIN - 1, as it may equal -1, the getopt end-of-options value. */
109 GETOPT_HELP_CHAR
= (CHAR_MIN
- 2),
110 GETOPT_VERSION_CHAR
= (CHAR_MIN
- 3)
113 #define GETOPT_HELP_OPTION_DECL \
114 "help", no_argument, NULL, GETOPT_HELP_CHAR
115 #define GETOPT_VERSION_OPTION_DECL \
116 "version", no_argument, NULL, GETOPT_VERSION_CHAR
118 #define case_GETOPT_HELP_CHAR \
119 case GETOPT_HELP_CHAR: \
120 usage (EXIT_SUCCESS); \
123 /* Program_name must be a literal string.
124 Usually it is just PROGRAM_NAME. */
125 #define USAGE_BUILTIN_WARNING \
127 "NOTE: your shell may have its own version of %s, which usually supersedes\n" \
128 "the version described here. Please refer to your shell's documentation\n" \
129 "for details about the options it supports.\n")
131 #define HELP_OPTION_DESCRIPTION \
132 _(" --help display this help and exit\n")
133 #define VERSION_OPTION_DESCRIPTION \
134 _(" --version output version information and exit\n")
136 #include "closeout.h"
137 #include "version-etc.h"
139 #define case_GETOPT_VERSION_CHAR(Program_name, Authors) \
140 case GETOPT_VERSION_CHAR: \
141 version_etc (stdout, Program_name, PACKAGE_NAME, VERSION, Authors, \
143 exit (EXIT_SUCCESS); \
147 # define MAX(a, b) ((a) > (b) ? (a) : (b))
151 # define MIN(a,b) (((a) < (b)) ? (a) : (b))
154 #include "progname.h"
155 #include "intprops.h"
158 # define SSIZE_MAX TYPE_MAXIMUM (ssize_t)
162 # define OFF_T_MIN TYPE_MINIMUM (off_t)
166 # define OFF_T_MAX TYPE_MAXIMUM (off_t)
170 # define UID_T_MAX TYPE_MAXIMUM (uid_t)
174 # define GID_T_MAX TYPE_MAXIMUM (gid_t)
178 # define PID_T_MAX TYPE_MAXIMUM (pid_t)
181 /* Use this to suppress gcc's `...may be used before initialized' warnings. */
183 # define IF_LINT(Code) Code
185 # define IF_LINT(Code) /* empty */
188 #ifndef __attribute__
189 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
190 # define __attribute__(x) /* empty */
194 #ifndef ATTRIBUTE_NORETURN
195 # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
198 #ifndef ATTRIBUTE_UNUSED
199 # define ATTRIBUTE_UNUSED __attribute__ ((__unused__))