From: Ondrej Oprala Date: Mon, 23 Sep 2013 13:39:22 +0000 (+0200) Subject: hexdump: simplify newsyntax arguments X-Git-Tag: v2.25-rc1~758 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f83c8f032f71fb6ab5d01ad81e805e078dd7fd8;p=thirdparty%2Futil-linux.git hexdump: simplify newsyntax arguments Signed-off-by: Ondrej Oprala --- diff --git a/text-utils/hexdump.c b/text-utils/hexdump.c index d5b9992e0d..47853a882d 100644 --- a/text-utils/hexdump.c +++ b/text-utils/hexdump.c @@ -64,7 +64,7 @@ int main(int argc, char **argv) atexit(close_stdout); if (!(c = strrchr(argv[0], 'o')) || strcmp(c, "od")) { - newsyntax(argc, &argv); + argv += newsyntax(argc, argv); } else errx(EXIT_FAILURE, _("calling hexdump as od has been deprecated " "in favour to GNU coreutils od.")); diff --git a/text-utils/hexdump.h b/text-utils/hexdump.h index f81b3bd13b..3fc3b64019 100644 --- a/text-utils/hexdump.h +++ b/text-utils/hexdump.h @@ -91,4 +91,4 @@ void __attribute__((__noreturn__)) usage(FILE *out); void conv_c(PR *, u_char *); void conv_u(PR *, u_char *); int next(char **); -void newsyntax(int, char ***); +int newsyntax(int, char **); diff --git a/text-utils/hexsyntax.c b/text-utils/hexsyntax.c index f7a96c5b7f..83f6870173 100644 --- a/text-utils/hexsyntax.c +++ b/text-utils/hexsyntax.c @@ -51,11 +51,10 @@ off_t skip; /* bytes to skip */ -void -newsyntax(int argc, char ***argvp) +int +newsyntax(int argc, char **argv) { int ch; - char **argv; char *hex_offt = "\"%07.7_Ax\n\""; static const struct option longopts[] = { @@ -75,7 +74,6 @@ newsyntax(int argc, char ***argvp) {NULL, no_argument, NULL, 0} }; - argv = *argvp; while ((ch = getopt_long(argc, argv, "bcCde:f:n:os:vxhV", longopts, NULL)) != -1) { switch (ch) { case 'b': @@ -134,7 +132,7 @@ newsyntax(int argc, char ***argvp) add("\"%07.7_ax \" 8/2 \"%04x \" \"\\n\""); } - *argvp += optind; + return optind; } void __attribute__((__noreturn__)) usage(FILE *out)