| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
#if 2 <= __GLIBC__ && 2 <= __GLIBC_MINOR__ |
| 20 |
# if ! defined _SYS_TYPES_H |
| 21 |
you must include <sys/types.h> before including this file |
| 22 |
# endif |
| 23 |
#endif |
| 24 |
|
| 25 |
#include <sys/stat.h> |
| 26 |
|
| 27 |
#if HAVE_SYS_PARAM_H |
| 28 |
# include <sys/param.h> |
| 29 |
#endif |
| 30 |
|
| 31 |
#include <unistd.h> |
| 32 |
#include <limits.h> |
| 33 |
#include <time.h> |
| 34 |
#include <string.h> |
| 35 |
#include <errno.h> |
| 36 |
#include "configmake.h" |
| 37 |
|
| 38 |
#include <stdbool.h> |
| 39 |
#include <stdlib.h> |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
enum |
| 44 |
{ |
| 45 |
EXIT_FAIL = 1, |
| 46 |
EXIT_CANNOT_INVOKE = 126, |
| 47 |
EXIT_ENOENT = 127 |
| 48 |
}; |
| 49 |
|
| 50 |
#include "exitfail.h" |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
#ifndef initialize_main |
| 55 |
# define initialize_main(ac, av) |
| 56 |
#endif |
| 57 |
|
| 58 |
#include "stat-macros.h" |
| 59 |
#include <inttypes.h> |
| 60 |
#include <ctype.h> |
| 61 |
|
| 62 |
#if ! (defined isblank || HAVE_DECL_ISBLANK) |
| 63 |
# define isblank(c) ((c) == ' ' || (c) == '\t') |
| 64 |
#endif |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9) |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
static inline unsigned char to_uchar (char ch) { return ch; } |
| 79 |
|
| 80 |
#include <locale.h> |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
#include "gettext.h" |
| 85 |
#if ! ENABLE_NLS |
| 86 |
# undef textdomain |
| 87 |
# define textdomain(Domainname) |
| 88 |
# undef bindtextdomain |
| 89 |
# define bindtextdomain(Domainname, Dirname) |
| 90 |
#endif |
| 91 |
|
| 92 |
#define _(msgid) gettext (msgid) |
| 93 |
#define N_(msgid) msgid |
| 94 |
|
| 95 |
#define STREQ(a, b) (strcmp ((a), (b)) == 0) |
| 96 |
|
| 97 |
#include "xalloc.h" |
| 98 |
#include "verify.h" |
| 99 |
|
| 100 |
#include "unlocked-io.h" |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
enum |
| 108 |
{ |
| 109 |
GETOPT_HELP_CHAR = (CHAR_MIN - 2), |
| 110 |
GETOPT_VERSION_CHAR = (CHAR_MIN - 3) |
| 111 |
}; |
| 112 |
|
| 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 |
| 117 |
|
| 118 |
#define case_GETOPT_HELP_CHAR \ |
| 119 |
case GETOPT_HELP_CHAR: \ |
| 120 |
usage (EXIT_SUCCESS); \ |
| 121 |
break; |
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
#define USAGE_BUILTIN_WARNING \ |
| 126 |
_("\n" \ |
| 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") |
| 130 |
|
| 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") |
| 135 |
|
| 136 |
#include "closeout.h" |
| 137 |
#include "version-etc.h" |
| 138 |
|
| 139 |
#define case_GETOPT_VERSION_CHAR(Program_name, Authors) \ |
| 140 |
case GETOPT_VERSION_CHAR: \ |
| 141 |
version_etc (stdout, Program_name, PACKAGE_NAME, VERSION, Authors, \ |
| 142 |
(char *) NULL); \ |
| 143 |
exit (EXIT_SUCCESS); \ |
| 144 |
break; |
| 145 |
|
| 146 |
#ifndef MAX |
| 147 |
# define MAX(a, b) ((a) > (b) ? (a) : (b)) |
| 148 |
#endif |
| 149 |
|
| 150 |
#ifndef MIN |
| 151 |
# define MIN(a,b) (((a) < (b)) ? (a) : (b)) |
| 152 |
#endif |
| 153 |
|
| 154 |
#include "progname.h" |
| 155 |
#include "intprops.h" |
| 156 |
|
| 157 |
#ifndef SSIZE_MAX |
| 158 |
# define SSIZE_MAX TYPE_MAXIMUM (ssize_t) |
| 159 |
#endif |
| 160 |
|
| 161 |
#ifndef OFF_T_MIN |
| 162 |
# define OFF_T_MIN TYPE_MINIMUM (off_t) |
| 163 |
#endif |
| 164 |
|
| 165 |
#ifndef OFF_T_MAX |
| 166 |
# define OFF_T_MAX TYPE_MAXIMUM (off_t) |
| 167 |
#endif |
| 168 |
|
| 169 |
#ifndef UID_T_MAX |
| 170 |
# define UID_T_MAX TYPE_MAXIMUM (uid_t) |
| 171 |
#endif |
| 172 |
|
| 173 |
#ifndef GID_T_MAX |
| 174 |
# define GID_T_MAX TYPE_MAXIMUM (gid_t) |
| 175 |
#endif |
| 176 |
|
| 177 |
#ifndef PID_T_MAX |
| 178 |
# define PID_T_MAX TYPE_MAXIMUM (pid_t) |
| 179 |
#endif |
| 180 |
|
| 181 |
|
| 182 |
#ifdef lint |
| 183 |
# define IF_LINT(Code) Code |
| 184 |
#else |
| 185 |
# define IF_LINT(Code) |
| 186 |
#endif |
| 187 |
|
| 188 |
#ifndef __attribute__ |
| 189 |
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ |
| 190 |
# define __attribute__(x) |
| 191 |
# endif |
| 192 |
#endif |
| 193 |
|
| 194 |
#ifndef ATTRIBUTE_NORETURN |
| 195 |
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) |
| 196 |
#endif |
| 197 |
|
| 198 |
#ifndef ATTRIBUTE_UNUSED |
| 199 |
# define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) |
| 200 |
#endif |