mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Do not use exit() with a magic number
This commit is contained in:
parent
ee5b28367c
commit
087e17be1c
@ -1,3 +1,17 @@
|
||||
2014-06-10 Giuseppe Scrivano <gscrivan@redhat.com>
|
||||
|
||||
* exits.c: Move WGET_EXIT_* definitions to...
|
||||
* exits.h: ...here. Add WGET_EXIT_GENERIC_ERROR, WGET_EXIT_PARSE_ERROR.
|
||||
Remove WGET_EXIT_MINIMUM.
|
||||
* init.c: Fix calls to exit().
|
||||
* log.c: Likewise.
|
||||
* main.c: Likewise.
|
||||
* mswindows.c: Likewise.
|
||||
* netrc.c: Likewise.
|
||||
* utils.c: Likewise.
|
||||
* warc.c: Likewise.
|
||||
* Test-stdouterr.px: Likewise.
|
||||
|
||||
2014-06-08 Giuseppe Scrivano <gscrivan@redhat.com>
|
||||
|
||||
* main.c: Make `program_name' not static.
|
||||
|
18
src/exits.c
18
src/exits.c
@ -20,24 +20,6 @@
|
||||
#include "wget.h"
|
||||
#include "exits.h"
|
||||
|
||||
/* Final exit code possibilities. Exit codes 1 and 2 are reserved
|
||||
* for situations that lead to direct exits from Wget, not using the
|
||||
* value of final_exit_status. */
|
||||
enum
|
||||
{
|
||||
WGET_EXIT_SUCCESS = 0,
|
||||
|
||||
WGET_EXIT_MINIMUM = 3,
|
||||
WGET_EXIT_IO_FAIL = WGET_EXIT_MINIMUM,
|
||||
WGET_EXIT_NETWORK_FAIL = 4,
|
||||
WGET_EXIT_SSL_AUTH_FAIL = 5,
|
||||
WGET_EXIT_SERVER_AUTH_FAIL = 6,
|
||||
WGET_EXIT_PROTOCOL_ERROR = 7,
|
||||
WGET_EXIT_SERVER_ERROR = 8,
|
||||
|
||||
WGET_EXIT_UNKNOWN
|
||||
};
|
||||
|
||||
static int final_exit_status = WGET_EXIT_SUCCESS;
|
||||
|
||||
/* XXX: I don't like that newly-added uerr_t codes will doubtless fall
|
||||
|
17
src/exits.h
17
src/exits.h
@ -21,6 +21,23 @@ along with Wget. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include "wget.h"
|
||||
|
||||
/* Final exit code possibilities. Exit codes 1 and 2 are reserved
|
||||
* for situations that lead to direct exits from Wget, not using the
|
||||
* value of final_exit_status. */
|
||||
enum
|
||||
{
|
||||
WGET_EXIT_SUCCESS = 0,
|
||||
WGET_EXIT_GENERIC_ERROR = 1,
|
||||
WGET_EXIT_PARSE_ERROR = 2,
|
||||
WGET_EXIT_IO_FAIL = 3,
|
||||
WGET_EXIT_NETWORK_FAIL = 4,
|
||||
WGET_EXIT_SSL_AUTH_FAIL = 5,
|
||||
WGET_EXIT_SERVER_AUTH_FAIL = 6,
|
||||
WGET_EXIT_PROTOCOL_ERROR = 7,
|
||||
WGET_EXIT_SERVER_ERROR = 8,
|
||||
|
||||
WGET_EXIT_UNKNOWN
|
||||
};
|
||||
|
||||
void inform_exit_status (uerr_t err);
|
||||
|
||||
|
14
src/init.c
14
src/init.c
@ -488,7 +488,7 @@ wgetrc_env_file_name (void)
|
||||
{
|
||||
fprintf (stderr, _("%s: WGETRC points to %s, which doesn't exist.\n"),
|
||||
exec_name, env);
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
return xstrdup (env);
|
||||
}
|
||||
@ -660,7 +660,7 @@ initialize (void)
|
||||
Parsing system wgetrc file (env SYSTEM_WGETRC) failed. Please check\n\
|
||||
'%s',\n\
|
||||
or specify a different file using --config.\n"), env_sysrc);
|
||||
exit (2);
|
||||
exit (WGET_EXIT_PARSE_ERROR);
|
||||
}
|
||||
}
|
||||
/* Otherwise, if SYSTEM_WGETRC is defined, use it. */
|
||||
@ -675,7 +675,7 @@ or specify a different file using --config.\n"), env_sysrc);
|
||||
Parsing system wgetrc file failed. Please check\n\
|
||||
'%s',\n\
|
||||
or specify a different file using --config.\n"), SYSTEM_WGETRC);
|
||||
exit (2);
|
||||
exit (WGET_EXIT_PARSE_ERROR);
|
||||
}
|
||||
#endif
|
||||
/* Override it with your own, if one exists. */
|
||||
@ -697,7 +697,7 @@ or specify a different file using --config.\n"), SYSTEM_WGETRC);
|
||||
|
||||
/* If there were errors processing either `.wgetrc', abort. */
|
||||
if (!ok)
|
||||
exit (2);
|
||||
exit (WGET_EXIT_PARSE_ERROR);
|
||||
|
||||
xfree (file);
|
||||
return;
|
||||
@ -856,7 +856,7 @@ setoptval (const char *com, const char *val, const char *optname)
|
||||
|
||||
assert (val != NULL);
|
||||
if (!setval_internal (command_by_name (com), dd_optname, val))
|
||||
exit (2);
|
||||
exit (WGET_EXIT_PARSE_ERROR);
|
||||
}
|
||||
|
||||
/* Parse OPT into command and value and run it. For example,
|
||||
@ -872,14 +872,14 @@ run_command (const char *cmdopt)
|
||||
{
|
||||
case line_ok:
|
||||
if (!setval_internal (comind, com, val))
|
||||
exit (2);
|
||||
exit (WGET_EXIT_PARSE_ERROR);
|
||||
xfree (com);
|
||||
xfree (val);
|
||||
break;
|
||||
default:
|
||||
fprintf (stderr, _("%s: Invalid --execute command %s\n"),
|
||||
exec_name, quote (cmdopt));
|
||||
exit (2);
|
||||
exit (WGET_EXIT_PARSE_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ as that of the covered work. */
|
||||
#include <errno.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "exits.h"
|
||||
#include "log.h"
|
||||
|
||||
/* 2005-10-25 SMS.
|
||||
@ -547,7 +548,7 @@ logprintf (enum log_options o, const char *fmt, ...)
|
||||
va_end (args);
|
||||
|
||||
if (done && errno == EPIPE)
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
while (!done);
|
||||
}
|
||||
@ -591,7 +592,7 @@ log_init (const char *file, bool appendp)
|
||||
if (!logfp)
|
||||
{
|
||||
fprintf (stderr, "%s: %s: %s\n", exec_name, file, strerror (errno));
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
88
src/main.c
88
src/main.c
@ -783,15 +783,15 @@ Recursive accept/reject:\n"),
|
||||
|
||||
if (printf (_("GNU Wget %s, a non-interactive network retriever.\n"),
|
||||
version_string) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
if (print_usage (0) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
|
||||
for (i = 0; i < countof (help); i++)
|
||||
if (fputs (_(help[i]), stdout) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
|
||||
exit (0);
|
||||
exit (WGET_EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
/* Return a human-readable printed representation of INTERVAL,
|
||||
@ -890,7 +890,7 @@ print_version (void)
|
||||
int i;
|
||||
|
||||
if (printf (_("GNU Wget %s built on %s.\n\n"), version_string, OS_TYPE) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
|
||||
for (i = 0; compiled_features[i] != NULL; )
|
||||
{
|
||||
@ -898,83 +898,83 @@ print_version (void)
|
||||
while ((line_length > 0) && (compiled_features[i] != NULL))
|
||||
{
|
||||
if (printf ("%s ", compiled_features[i]) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
line_length -= strlen (compiled_features[i]) + 2;
|
||||
i++;
|
||||
}
|
||||
if (printf ("\n") < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
}
|
||||
if (printf ("\n") < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
|
||||
/* Handle the case when $WGETRC is unset and $HOME/.wgetrc is
|
||||
absent. */
|
||||
if (printf ("%s\n", wgetrc_title) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
|
||||
env_wgetrc = wgetrc_env_file_name ();
|
||||
if (env_wgetrc && *env_wgetrc)
|
||||
{
|
||||
if (printf (_(" %s (env)\n"), env_wgetrc) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
xfree (env_wgetrc);
|
||||
}
|
||||
user_wgetrc = wgetrc_user_file_name ();
|
||||
if (user_wgetrc)
|
||||
{
|
||||
if (printf (_(" %s (user)\n"), user_wgetrc) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
xfree (user_wgetrc);
|
||||
}
|
||||
#ifdef SYSTEM_WGETRC
|
||||
if (printf (_(" %s (system)\n"), SYSTEM_WGETRC) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
if (format_and_print_line (locale_title,
|
||||
LOCALEDIR,
|
||||
MAX_CHARS_PER_LINE) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
#endif /* def ENABLE_NLS */
|
||||
|
||||
if (compilation_string != NULL)
|
||||
if (format_and_print_line (compile_title,
|
||||
compilation_string,
|
||||
MAX_CHARS_PER_LINE) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
|
||||
if (link_string != NULL)
|
||||
if (format_and_print_line (link_title,
|
||||
link_string,
|
||||
MAX_CHARS_PER_LINE) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
|
||||
if (printf ("\n") < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
|
||||
/* TRANSLATORS: When available, an actual copyright character
|
||||
(circle-c) should be used in preference to "(C)". */
|
||||
if (printf (_("\
|
||||
Copyright (C) %s Free Software Foundation, Inc.\n"), "2014") < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
if (fputs (_("\
|
||||
License GPLv3+: GNU GPL version 3 or later\n\
|
||||
<http://www.gnu.org/licenses/gpl.html>.\n\
|
||||
This is free software: you are free to change and redistribute it.\n\
|
||||
There is NO WARRANTY, to the extent permitted by law.\n"), stdout) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
/* TRANSLATORS: When available, please use the proper diacritics for
|
||||
names such as this one. See en_US.po for reference. */
|
||||
if (fputs (_("\nOriginally written by Hrvoje Niksic <hniksic@xemacs.org>.\n"),
|
||||
stdout) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
if (fputs (_("Please send bug reports and questions to <bug-wget@gnu.org>.\n"),
|
||||
stdout) < 0)
|
||||
exit (3);
|
||||
exit (WGET_EXIT_IO_FAIL);
|
||||
|
||||
exit (0);
|
||||
exit (WGET_EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
char *program_name; /* Needed by lib/error.c. */
|
||||
@ -1022,7 +1022,7 @@ main (int argc, char **argv)
|
||||
if (p == NULL)
|
||||
{
|
||||
fprintf (stderr, _("Memory allocation problem\n"));
|
||||
exit (2);
|
||||
exit (WGET_EXIT_PARSE_ERROR);
|
||||
}
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
@ -1073,7 +1073,7 @@ main (int argc, char **argv)
|
||||
else
|
||||
{
|
||||
fprintf (stderr, _("Exiting due to error in %s\n"), optarg);
|
||||
exit (2);
|
||||
exit (WGET_EXIT_PARSE_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1103,7 +1103,7 @@ main (int argc, char **argv)
|
||||
fprintf (stderr, "\n");
|
||||
fprintf (stderr, _("Try `%s --help' for more options.\n"),
|
||||
exec_name);
|
||||
exit (2);
|
||||
exit (WGET_EXIT_PARSE_ERROR);
|
||||
}
|
||||
/* Find the short option character in the mapping. */
|
||||
longindex = optmap[ret - 32];
|
||||
@ -1173,7 +1173,7 @@ main (int argc, char **argv)
|
||||
fprintf (stderr, "\n");
|
||||
fprintf (stderr, _("Try `%s --help' for more options.\n"),
|
||||
exec_name);
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1254,14 +1254,14 @@ main (int argc, char **argv)
|
||||
{
|
||||
fprintf (stderr, _("Can't be verbose and quiet at the same time.\n"));
|
||||
print_usage (1);
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
if (opt.timestamping && opt.noclobber)
|
||||
{
|
||||
fprintf (stderr, _("\
|
||||
Can't timestamp and not clobber old files at the same time.\n"));
|
||||
print_usage (1);
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
#ifdef ENABLE_IPV6
|
||||
if (opt.ipv4_only && opt.ipv6_only)
|
||||
@ -1269,7 +1269,7 @@ Can't timestamp and not clobber old files at the same time.\n"));
|
||||
fprintf (stderr,
|
||||
_("Cannot specify both --inet4-only and --inet6-only.\n"));
|
||||
print_usage (1);
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
#endif
|
||||
if (opt.output_document)
|
||||
@ -1281,7 +1281,7 @@ Can't timestamp and not clobber old files at the same time.\n"));
|
||||
Cannot specify both -k and -O if multiple URLs are given, or in combination\n\
|
||||
with -p or -r. See the manual for details.\n\n"), stderr);
|
||||
print_usage (1);
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
if (opt.page_requisites
|
||||
|| opt.recursive)
|
||||
@ -1303,7 +1303,7 @@ for details.\n\n"));
|
||||
logprintf (LOG_VERBOSE,
|
||||
_("File `%s' already there; not retrieving.\n"),
|
||||
opt.output_document);
|
||||
exit(1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1327,7 +1327,7 @@ for details.\n\n"));
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("WARC output does not work with --spider.\n"));
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
if (opt.always_rest || opt.start_pos >= 0)
|
||||
{
|
||||
@ -1354,7 +1354,7 @@ for details.\n\n"));
|
||||
fprintf (stderr,
|
||||
_("Cannot specify both --ask-password and --password.\n"));
|
||||
print_usage (1);
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
|
||||
if (opt.start_pos >= 0 && opt.always_rest)
|
||||
@ -1374,7 +1374,7 @@ for details.\n\n"));
|
||||
/* #### Something nicer should be printed here -- similar to the
|
||||
pre-1.5 `--help' page. */
|
||||
fprintf (stderr, _("Try `%s --help' for more options.\n"), exec_name);
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
|
||||
/* Compile the regular expressions. */
|
||||
@ -1397,26 +1397,26 @@ for details.\n\n"));
|
||||
{
|
||||
opt.acceptregex = opt.regex_compile_fun (opt.acceptregex_s);
|
||||
if (!opt.acceptregex)
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
if (opt.rejectregex_s)
|
||||
{
|
||||
opt.rejectregex = opt.regex_compile_fun (opt.rejectregex_s);
|
||||
if (!opt.rejectregex)
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
if (opt.post_data || opt.post_file_name)
|
||||
{
|
||||
if (opt.post_data && opt.post_file_name)
|
||||
{
|
||||
fprintf (stderr, _("You cannot specify both --post-data and --post-file.\n"));
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
else if (opt.method)
|
||||
{
|
||||
fprintf (stderr, _("You cannot use --post-data or --post-file along with --method. "
|
||||
"--method expects data through --body-data and --body-file options"));
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
}
|
||||
if (opt.body_data || opt.body_file)
|
||||
@ -1425,12 +1425,12 @@ for details.\n\n"));
|
||||
{
|
||||
fprintf (stderr, _("You must specify a method through --method=HTTPMethod "
|
||||
"to use with --body-data or --body-file.\n"));
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
else if (opt.body_data && opt.body_file)
|
||||
{
|
||||
fprintf (stderr, _("You cannot specify both --body-data and --body-file.\n"));
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1482,7 +1482,7 @@ for details.\n\n"));
|
||||
{
|
||||
/* sXXXav : be more specific... */
|
||||
fprintf (stderr, _("This version does not have support for IRIs\n"));
|
||||
exit(1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1491,7 +1491,7 @@ for details.\n\n"));
|
||||
opt.passwd = prompt_for_password ();
|
||||
|
||||
if (opt.passwd == NULL || opt.passwd[0] == '\0')
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
|
||||
#ifdef USE_WATT32
|
||||
@ -1513,7 +1513,7 @@ for details.\n\n"));
|
||||
if (url == NULL)
|
||||
{
|
||||
fprintf (stderr, _("Memory allocation problem\n"));
|
||||
exit (2);
|
||||
exit (WGET_EXIT_PARSE_ERROR);
|
||||
}
|
||||
for (i = 0; i < nurl; i++, optind++)
|
||||
{
|
||||
@ -1574,7 +1574,7 @@ for details.\n\n"));
|
||||
if (output_stream == NULL)
|
||||
{
|
||||
perror (opt.output_document);
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
if (fstat (fileno (output_stream), &st) == 0 && S_ISREG (st.st_mode))
|
||||
output_stream_regular = true;
|
||||
@ -1584,7 +1584,7 @@ for details.\n\n"));
|
||||
fprintf (stderr, _("-k can be used together with -O only if \
|
||||
outputting to a regular file.\n"));
|
||||
print_usage (1);
|
||||
exit(1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,7 @@ as that of the covered work. */
|
||||
|
||||
#include "utils.h"
|
||||
#include "url.h"
|
||||
#include "exits.h"
|
||||
|
||||
#ifndef ES_SYSTEM_REQUIRED
|
||||
#define ES_SYSTEM_REQUIRED 0x00000001
|
||||
@ -308,7 +309,7 @@ cleanup:
|
||||
|
||||
/* We're the parent. If all is well, terminate. */
|
||||
if (rv)
|
||||
exit (0);
|
||||
exit (WGET_EXIT_SUCCESS);
|
||||
|
||||
/* We failed, return. */
|
||||
}
|
||||
@ -461,7 +462,7 @@ ws_startup (void)
|
||||
{
|
||||
fprintf (stderr, _("%s: Couldn't find usable socket driver.\n"),
|
||||
exec_name);
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
|
||||
if (data.wVersion < requested)
|
||||
@ -469,7 +470,7 @@ ws_startup (void)
|
||||
fprintf (stderr, _("%s: Couldn't find usable socket driver.\n"),
|
||||
exec_name);
|
||||
WSACleanup ();
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
|
||||
atexit (ws_cleanup);
|
||||
|
10
src/netrc.c
10
src/netrc.c
@ -448,7 +448,7 @@ main (int argc, char **argv)
|
||||
if (argc < 2 || argc > 3)
|
||||
{
|
||||
fprintf (stderr, _("Usage: %s NETRC [HOSTNAME]\n"), argv[0]);
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
|
||||
program_name = argv[0];
|
||||
@ -459,7 +459,7 @@ main (int argc, char **argv)
|
||||
{
|
||||
fprintf (stderr, _("%s: cannot stat %s: %s\n"), argv[0], file,
|
||||
strerror (errno));
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
|
||||
head = parse_netrc (file);
|
||||
@ -498,14 +498,14 @@ main (int argc, char **argv)
|
||||
|
||||
/* Exit if we found the target. */
|
||||
if (target)
|
||||
exit (0);
|
||||
exit (WGET_EXIT_SUCCESS);
|
||||
a = a->next;
|
||||
}
|
||||
|
||||
/* Exit with failure if we had a target, success otherwise. */
|
||||
if (target)
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
|
||||
exit (0);
|
||||
exit (WGET_EXIT_SUCCESS);
|
||||
}
|
||||
#endif /* STANDALONE */
|
||||
|
@ -100,6 +100,8 @@ as that of the covered work. */
|
||||
#include "test.h"
|
||||
#endif
|
||||
|
||||
#include "exits.h"
|
||||
|
||||
static void
|
||||
memfatal (const char *context, long attempted_size)
|
||||
{
|
||||
@ -123,7 +125,7 @@ memfatal (const char *context, long attempted_size)
|
||||
exec_name, context, attempted_size);
|
||||
}
|
||||
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
|
||||
/* Character property table for (re-)escaping VMS ODS5 extended file
|
||||
@ -471,7 +473,7 @@ fork_to_background (void)
|
||||
{
|
||||
/* parent, error */
|
||||
perror ("fork");
|
||||
exit (1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
else if (pid != 0)
|
||||
{
|
||||
@ -479,7 +481,7 @@ fork_to_background (void)
|
||||
printf (_("Continuing in background, pid %d.\n"), (int) pid);
|
||||
if (logfile_changed)
|
||||
printf (_("Output will be written to %s.\n"), quote (opt.lfilename));
|
||||
exit (0); /* #### should we use _exit()? */
|
||||
exit (WGET_EXIT_SUCCESS); /* #### should we use _exit()? */
|
||||
}
|
||||
|
||||
/* child: give up the privileges and keep running. */
|
||||
|
13
src/warc.c
13
src/warc.c
@ -56,6 +56,7 @@ as that of the covered work. */
|
||||
#endif
|
||||
|
||||
#include "warc.h"
|
||||
#include "exits.h"
|
||||
|
||||
#ifndef O_TEMPORARY
|
||||
#define O_TEMPORARY 0
|
||||
@ -1038,7 +1039,7 @@ warc_init (void)
|
||||
logprintf (LOG_NOTQUIET,
|
||||
_("Could not read CDX file %s for deduplication.\n"),
|
||||
quote (opt.warc_cdx_dedup_filename));
|
||||
exit(1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1047,7 +1048,7 @@ warc_init (void)
|
||||
{
|
||||
logprintf (LOG_NOTQUIET,
|
||||
_("Could not open temporary WARC manifest file.\n"));
|
||||
exit(1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
|
||||
if (opt.warc_keep_log)
|
||||
@ -1057,7 +1058,7 @@ warc_init (void)
|
||||
{
|
||||
logprintf (LOG_NOTQUIET,
|
||||
_("Could not open temporary WARC log file.\n"));
|
||||
exit(1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
log_set_warc_log_fp (warc_log_fp);
|
||||
}
|
||||
@ -1066,7 +1067,7 @@ warc_init (void)
|
||||
if (! warc_start_new_file (false))
|
||||
{
|
||||
logprintf (LOG_NOTQUIET, _("Could not open WARC file.\n"));
|
||||
exit(1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
|
||||
if (opt.warc_cdx_enabled)
|
||||
@ -1075,7 +1076,7 @@ warc_init (void)
|
||||
{
|
||||
logprintf (LOG_NOTQUIET,
|
||||
_("Could not open CDX file for output.\n"));
|
||||
exit(1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1103,7 +1104,7 @@ warc_write_metadata (void)
|
||||
if (warc_tmp_fp == NULL)
|
||||
{
|
||||
logprintf (LOG_NOTQUIET, _("Could not open temporary WARC file.\n"));
|
||||
exit(1);
|
||||
exit (WGET_EXIT_GENERIC_ERROR);
|
||||
}
|
||||
fflush (warc_tmp_fp);
|
||||
fprintf (warc_tmp_fp, "%s\n", program_argstring);
|
||||
|
@ -21,7 +21,7 @@ my %urls = (
|
||||
);
|
||||
|
||||
unless(-e "/dev/full") {
|
||||
exit(2); # skip
|
||||
exit 2; # skip
|
||||
}
|
||||
|
||||
my $cmdline = $WgetTest::WGETPATH . " -c http://localhost:{{port}}/somefile.txt -O /dev/full";
|
||||
|
Loading…
Reference in New Issue
Block a user