lkml.org 
[lkml]   [2017]   [Oct]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] objtool: Print top level commands on incorrect usage
Date
Print top-level objtool commands, along with the error on incorrect
command line usage. Objtool command line parser exit's with code 129,
for incorrect usage. Convert the cmd_usage() exit code also, to maintain
consistency across objtool.

After the patch:
$ ./objtool -j
Unknown option: -j

usage: objtool COMMAND [ARGS]

Commands:
check Perform stack metadata validation on an object file
orc Generate in-place ORC unwind tables for an object file

$ echo $?
129

Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
---
v2:
- Changes to commit message only.

tools/objtool/objtool.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/objtool/objtool.c b/tools/objtool/objtool.c
index 31e0f91..07f3299 100644
--- a/tools/objtool/objtool.c
+++ b/tools/objtool/objtool.c
@@ -70,7 +70,7 @@ static void cmd_usage(void)

printf("\n");

- exit(1);
+ exit(129);
}

static void handle_options(int *argc, const char ***argv)
@@ -86,9 +86,7 @@ static void handle_options(int *argc, const char ***argv)
break;
} else {
fprintf(stderr, "Unknown option: %s\n", cmd);
- fprintf(stderr, "\n Usage: %s\n",
- objtool_usage_string);
- exit(1);
+ cmd_usage();
}

(*argv)++;
--
2.7.4
\
 
 \ /
  Last update: 2017-10-14 16:48    [W:0.053 / U:1.580 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site