diff options
author | Mike Frysinger <vapier@gentoo.org> | 2024-01-24 21:52:41 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2024-01-24 21:52:41 -0500 |
commit | 5243cb017a7847f53caaa7c89b8e7f3abf1e5e40 (patch) | |
tree | 561a5e6541a217132f473318d0936c087eda8040 /dumpelf.c | |
parent | pspax: switch from fgets to getline (diff) | |
download | pax-utils-5243cb017a7847f53caaa7c89b8e7f3abf1e5e40.tar.gz pax-utils-5243cb017a7847f53caaa7c89b8e7f3abf1e5e40.tar.bz2 pax-utils-5243cb017a7847f53caaa7c89b8e7f3abf1e5e40.zip |
unify usage() output across all the tools
The scanelf --help output is the best & most flexible, so move that
to common code so the rest of the tools can benefit from it.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'dumpelf.c')
-rw-r--r-- | dumpelf.c | 20 |
1 files changed, 7 insertions, 13 deletions
@@ -507,7 +507,6 @@ static void dump_dyn(const elfobj *elf, const void *dyn_void, size_t dyn_cnt) /* usage / invocation handling functions */ #define PARSE_FLAGS "vhV" -#define a_argument required_argument static struct option const long_opts[] = { {"verbose", no_argument, NULL, 'v'}, {"help", no_argument, NULL, 'h'}, @@ -524,18 +523,13 @@ static const char * const opts_help[] = { /* display usage and exit */ static void usage(int status) { - size_t i; - printf("* Dump internal ELF structure\n\n" - "Usage: %s <file1> [file2 fileN ...]\n\n", argv0); - printf("Options:\n"); - for (i = 0; long_opts[i].name; ++i) - if (long_opts[i].has_arg == no_argument) - printf(" -%c, --%-13s* %s\n", long_opts[i].val, - long_opts[i].name, opts_help[i]); - else - printf(" -%c, --%-6s <arg> * %s\n", long_opts[i].val, - long_opts[i].name, opts_help[i]); - exit(status); + pax_usage( + "Dump internal ELF structure", + "<file1> [file2 fileN ...]", + PARSE_FLAGS, + long_opts, + opts_help, + status); } /* parse command line arguments and perform needed actions */ |