]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hexdump: simplify newsyntax arguments
authorOndrej Oprala <ooprala@redhat.com>
Mon, 23 Sep 2013 13:39:22 +0000 (15:39 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 8 Nov 2013 11:54:53 +0000 (12:54 +0100)
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
text-utils/hexdump.c
text-utils/hexdump.h
text-utils/hexsyntax.c

index d5b9992e0d422f08668073c1c912ba2c6db1c1e4..47853a882de29dc5d50499334d395c95ec29ad48 100644 (file)
@@ -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."));
index f81b3bd13b8a508b883b1aaf4d823767035b1c98..3fc3b6401947afd2458bf89f64cb8acdf7fcbe17 100644 (file)
@@ -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 **);
index f7a96c5b7f96a825acf8448f70b4d4fb8e731ac7..83f6870173c9af642e2c7273fb19c09ce043798b 100644 (file)
 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)