From 53f504711dbc2feaeae139df3e0c28b960168ccf Mon Sep 17 00:00:00 2001 From: Paul Moore Date: Wed, 12 Aug 2015 21:33:49 -0400 Subject: tools: eliminate the shared exit_usage() function I'm still not quite sure why this was shared in the first place. Signed-off-by: Paul Moore --- tools/scmp_bpf_disasm.c | 13 +++++++++++++ tools/scmp_bpf_sim.c | 18 +++++++++++++++++- tools/util.c | 16 ---------------- tools/util.h | 2 -- 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/tools/scmp_bpf_disasm.c b/tools/scmp_bpf_disasm.c index 911fd85..d0fb16d 100644 --- a/tools/scmp_bpf_disasm.c +++ b/tools/scmp_bpf_disasm.c @@ -37,6 +37,19 @@ #define _OP_FMT "%-3s" +/** + * Print the usage information to stderr and exit + * @param program the name of the current program being invoked + * + * Print the usage information and exit with EINVAL. + * + */ +static void exit_usage(const char *program) +{ + fprintf(stderr, "usage: %s -a [-d] [-h]\n", program); + exit(EINVAL); +} + /** * Decode the BPF operand * @param bpf the BPF instruction diff --git a/tools/scmp_bpf_sim.c b/tools/scmp_bpf_sim.c index a53b4fd..6b70105 100644 --- a/tools/scmp_bpf_sim.c +++ b/tools/scmp_bpf_sim.c @@ -51,6 +51,22 @@ struct bpf_program { static unsigned int opt_verbose = 0; +/** + * Print the usage information to stderr and exit + * @param program the name of the current program being invoked + * + * Print the usage information and exit with EINVAL. + * + */ +static void exit_usage(const char *program) +{ + fprintf(stderr, + "usage: %s -f [-v] [-h]" + " -a -s [-0 ] ... [-5 ]\n", + program); + exit(EINVAL); +} + /** * Handle a simulator fault * @param rc the error or return code @@ -224,7 +240,7 @@ int main(int argc, char *argv[]) memset(&sys_data, 0, sizeof(sys_data)); /* parse the command line */ - while ((opt = getopt(argc, argv, "a:f:h:s:v0:1:2:3:4:5:")) > 0) { + while ((opt = getopt(argc, argv, "a:f:hs:v0:1:2:3:4:5:")) > 0) { switch (opt) { case 'a': if (strcmp(optarg, "x86") == 0) diff --git a/tools/util.c b/tools/util.c index b45de3b..a52c865 100644 --- a/tools/util.c +++ b/tools/util.c @@ -77,22 +77,6 @@ /* default to the native arch */ uint32_t arch = ARCH_NATIVE; -/** - * Print the usage information to stderr and exit - * @param program the name of the current program being invoked - * - * Print the usage information and exit with EINVAL. - * - */ -void exit_usage(const char *program) -{ - fprintf(stderr, - "usage: %s -f [-v]" - " -a -s [-0 ] ... [-5 ]\n", - program); - exit(EINVAL); -} - /** * Convert a 16-bit target integer into the host's endianess * @param arch the architecture token diff --git a/tools/util.h b/tools/util.h index 2fed617..92bff91 100644 --- a/tools/util.h +++ b/tools/util.h @@ -74,8 +74,6 @@ extern uint32_t arch; -void exit_usage(const char *program); - uint16_t ttoh16(uint32_t arch, uint16_t val); uint32_t ttoh32(uint32_t arch, uint32_t val); -- cgit v1.2.1