diff options
author | Paul Moore <pmoore@redhat.com> | 2015-08-12 21:33:49 -0400 |
---|---|---|
committer | Paul Moore <pmoore@redhat.com> | 2015-08-12 21:33:49 -0400 |
commit | 53f504711dbc2feaeae139df3e0c28b960168ccf (patch) | |
tree | 0577f7bebaee174caa8a1f1d76c08bc5469b8eb5 /tools | |
parent | 641cc809f5699fede96a76821de6fed8b7375c73 (diff) | |
download | libseccomp-53f504711dbc2feaeae139df3e0c28b960168ccf.tar.gz |
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 <pmoore@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/scmp_bpf_disasm.c | 13 | ||||
-rw-r--r-- | tools/scmp_bpf_sim.c | 18 | ||||
-rw-r--r-- | tools/util.c | 16 | ||||
-rw-r--r-- | 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 @@ -38,6 +38,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 <arch> [-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 @@ -52,6 +52,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 <bpf_file> [-v] [-h]" + " -a <arch> -s <syscall_num> [-0 <a0>] ... [-5 <a5>]\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 @@ -78,22 +78,6 @@ 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 <bpf_file> [-v]" - " -a <arch> -s <syscall_num> [-0 <a0>] ... [-5 <a5>]\n", - program); - exit(EINVAL); -} - -/** * Convert a 16-bit target integer into the host's endianess * @param arch the architecture token * @param val the 16-bit integer 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); |