summaryrefslogtreecommitdiff
path: root/futility/futility.c
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2015-03-06 12:40:11 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-03-11 07:50:27 +0000
commitd7e1e4f0befdda52ad48e5a8eb5fc49dbee40247 (patch)
treea5c02398817dd05b6db210dc86ffad48e95e9cca /futility/futility.c
parent36bc59140c9d3d4110b3d1c4b7c6b0b84875e81e (diff)
downloadvboot-d7e1e4f0befdda52ad48e5a8eb5fc49dbee40247.tar.gz
futility: Make --debug a global option
Some commands look for a --debug option, others don't. The feature is implemented globally, so let's parse it as a global option. BUG=none BRANCH=none TEST=make runtests Change-Id: I3b169e4a1b93443786913276651113d1c915a834 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/258500 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'futility/futility.c')
-rw-r--r--futility/futility.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/futility/futility.c b/futility/futility.c
index 02f61af9..e11cbadf 100644
--- a/futility/futility.c
+++ b/futility/futility.c
@@ -176,9 +176,6 @@ static void log_args(int argc, char *argv[])
/******************************************************************************/
-/* Default is to support everything we can */
-enum vboot_version vboot_version = VBOOT_VERSION_ALL;
-
static const char *const usage = "\n"
"Usage: " MYNAME " [options] COMMAND [args...]\n"
"\n"
@@ -196,6 +193,7 @@ static const char *const options =
"\n"
" --vb1 Use only vboot v1.0 binary formats\n"
" --vb21 Use only vboot v2.1 binary formats\n"
+" --debug Be noisy about what's going on\n"
"\n";
static const struct futil_cmd_t *find_command(const char *name)
@@ -271,7 +269,7 @@ DECLARE_FUTIL_COMMAND(version, do_version, VBOOT_VERSION_ALL,
"Show the futility source revision and build date",
NULL);
-int run_command(const struct futil_cmd_t *cmd, int argc, char *argv[])
+static int run_command(const struct futil_cmd_t *cmd, int argc, char *argv[])
{
/* Handle the "CMD --help" case ourselves */
if (2 == argc && 0 == strcmp(argv[1], "--help")) {
@@ -302,8 +300,9 @@ int main(int argc, char *argv[], char *envp[])
int i, errorcnt = 0;
int vb_ver = VBOOT_VERSION_ALL;
struct option long_opts[] = {
- {"vb1" , 0, &vb_ver, VBOOT_VERSION_1_0},
- {"vb21", 0, &vb_ver, VBOOT_VERSION_2_1},
+ {"debug", 0, &debugging_enabled, 1},
+ {"vb1" , 0, &vb_ver, VBOOT_VERSION_1_0},
+ {"vb21", 0, &vb_ver, VBOOT_VERSION_2_1},
{ 0, 0, 0, 0},
};