As discussed on the mailing list. We fix all places
where the non-working define STRTOXX_EXIT_CODE was used.
Regarding tunelp, also see
7e3c80a7.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
#include "c.h"
#include "fileutils.h"
#include "monotonic.h"
-
-#define STRTOXX_EXIT_CODE FSCK_EX_USAGE
#include "strutils.h"
#define XALLOC_EXIT_CODE FSCK_EX_ERROR
textdomain(PACKAGE);
atexit(close_stdout);
+ strutils_set_exitcode(FSCK_EX_USAGE);
mnt_init_debug(0); /* init libmount debug mask */
mntcache = mnt_new_cache(); /* no fatal error if failed */
#include <stdio.h>
#include <errno.h>
-/* default strtoxx_or_err() exit code */
-#ifndef STRTOXX_EXIT_CODE
-# define STRTOXX_EXIT_CODE EXIT_FAILURE
-#endif
-
+/* initialize a custom exit code for all *_or_err functions */
+extern void strutils_set_exitcode(int exit_code);
extern int parse_size(const char *str, uintmax_t *res, int *power);
extern int strtosize(const char *str, uintmax_t *res);
#include "strutils.h"
#include "bitops.h"
+static int STRTOXX_EXIT_CODE = EXIT_FAILURE;
+
+void strutils_set_exitcode(int ex) {
+ STRTOXX_EXIT_CODE = ex;
+}
+
static int do_scale_by_power (uintmax_t *x, int base, int power)
{
while (power--) {
#include "ismounted.h"
-#define STRTOXX_EXIT_CODE BLKID_EXIT_OTHER /* strtoxx_or_err() */
#include "strutils.h"
#define OPTUTILS_EXIT_CODE BLKID_EXIT_OTHER /* exclusive_option() */
#include "optutils.h"
textdomain(PACKAGE);
atexit(close_stdout);
+ strutils_set_exitcode(BLKID_EXIT_OTHER);
+
while ((c = getopt_long (argc, argv,
"c:dghilL:n:ko:O:ps:S:t:u:U:w:Vv", longopts, NULL)) != -1) {
#include "lp.h"
#include "nls.h"
#include "closestream.h"
+#include "strutils.h"
#define EXIT_LP_MALLOC 2
-#define STRTOXX_EXIT_CODE 3
+#define EXIT_LP_BADVAL 3
#define EXIT_LP_IO_ERR 4
-#include "strutils.h"
-
#define XALLOC_EXIT_CODE EXIT_LP_MALLOC
#include "xalloc.h"
textdomain(PACKAGE);
atexit(close_stdout);
+ strutils_set_exitcode(EXIT_LP_BADVAL);
+
if (argc < 2)
print_usage(stderr);