However, some of the programs documented here do produce
other exit status values and a few associate different
meanings with the values @samp{0} and @samp{1}.
-Here are some of the exceptions:
-@command{chroot}, @command{env}, @command{expr}, @command{nice},
-@command{nohup}, @command{numfmt}, @command{printenv}, @command{sort},
-@command{stdbuf}, @command{test}, @command{timeout}, @command{tty}.
+Here are the exceptions:
+@c You can generate the following list with:
+@c grep initialize_exit_failure src/*.c | cut -f1 -d: |
+@c sed -n 's|src/\(.*\)\.c|@command{\1},|p' | sort | fmt
+@command{chroot}, @command{env}, @command{expr}, @command{ls},
+@command{nice}, @command{nohup}, @command{numfmt}, @command{printenv},
+@command{runcon}, @command{sort}, @command{stdbuf}, @command{test},
+@command{timeout}, @command{tty}.
@node Backup options
\n\
If no command is given, run '\"$SHELL\" -i' (default: '/bin/sh -i').\n\
"), stdout);
+ emit_exec_status (PROGRAM_NAME);
emit_ancillary_info (PROGRAM_NAME);
}
exit (status);
Without SIG, all known signals are included. Multiple signals can be\n\
comma-separated. An empty SIG argument is a no-op.\n\
"), stdout);
+ emit_exec_status (PROGRAM_NAME);
emit_ancillary_info (PROGRAM_NAME);
}
exit (status);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME);
+ emit_exec_status (PROGRAM_NAME);
emit_ancillary_info (PROGRAM_NAME);
}
exit (status);
To save output to FILE, use '%s COMMAND > FILE'.\n"),
program_name);
printf (USAGE_BUILTIN_WARNING, PROGRAM_NAME);
+ emit_exec_status (PROGRAM_NAME);
emit_ancillary_info (PROGRAM_NAME);
}
exit (status);
#define AUTHORS proper_name ("Assaf Gordon")
/* Exit code when some numbers fail to convert. */
-enum { EXIT_CONVERSION_WARNINGS = 2 };
+enum { TIMEOUT_FAILURE = 1, EXIT_CONVERSION_WARNINGS = 2 };
enum
{
decimal_point = ".";
decimal_point_length = strlen (decimal_point);
+ initialize_exit_failure (TIMEOUT_FAILURE);
atexit (close_stdout);
while (true)
"), stdout);
fputs (HELP_OPTION_DESCRIPTION, stdout);
fputs (VERSION_OPTION_DESCRIPTION, stdout);
+ emit_exec_status (PROGRAM_NAME);
emit_ancillary_info (PROGRAM_NAME);
}
exit (status);
Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O,\n\
and are thus unaffected by 'stdbuf' settings.\n\
"), stdout);
+ emit_exec_status (PROGRAM_NAME);
emit_ancillary_info (PROGRAM_NAME);
}
exit (status);
"), stdout);
}
+static inline void
+emit_exec_status (char const *program)
+{
+ printf (_("\n\
+Exit status:\n\
+ 125 if the %s command itself fails\n\
+ 126 if COMMAND is found but cannot be invoked\n\
+ 127 if COMMAND cannot be found\n\
+ - the exit status of COMMAND otherwise\n\
+"), program);
+}
+
static inline void
emit_ancillary_info (char const *program)
{
\n"), stdout);
fputs (_("\n\
-EXIT status:\n\
+Exit status:\n\
124 if COMMAND times out, and --preserve-status is not specified\n\
125 if the timeout command itself fails\n\
126 if COMMAND is found but cannot be invoked\n\