Message ID | 20160504173517.GA21576@mcvlad-wk.rb.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, 04 May 2016, Marius Vlad <marius.c.vlad@intel.com> wrote: > Care to add this usage for it as well? Pushed the entire series, with the strtoul in patch 4 fixed, and added this usage patch, with a few minor tweaks. BR, Jani. > > Signed-off-by: Marius Vlad <marius.c.vlad@intel.com> > --- > tools/intel_bios_reader.c | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/tools/intel_bios_reader.c b/tools/intel_bios_reader.c > index de90f5d..4192919 100644 > --- a/tools/intel_bios_reader.c > +++ b/tools/intel_bios_reader.c > @@ -1414,8 +1414,22 @@ enum opt { > OPT_ALL_PANELS, > OPT_HEXDUMP, > OPT_BLOCK, > + OPT_USAGE > }; > > +static void usage(const char *toolname) > +{ > + fprintf(stderr, "usage %s:", toolname); > + fprintf(stderr, " --file=<rom file>" > + " [--devid=<device_id>]" > + " [--panel-type=<panel_type>]" > + " [--all-panels]" > + " [--hexdump]" > + " [--block=<block_no>]" > + " [--help]\n"); > + > +} > + > int main(int argc, char **argv) > { > uint8_t *VBIOS; > @@ -1443,6 +1457,7 @@ int main(int argc, char **argv) > { "all-panels", no_argument, NULL, OPT_ALL_PANELS }, > { "hexdump", no_argument, NULL, OPT_HEXDUMP }, > { "block", required_argument, NULL, OPT_BLOCK }, > + { "help", no_argument, NULL, OPT_USAGE }, > { 0 } > }; > > @@ -1484,7 +1499,9 @@ int main(int argc, char **argv) > break; > case OPT_END: > break; > + case OPT_USAGE: /* fall-through */ > case OPT_UNKNOWN: > + usage(toolname); > return EXIT_FAILURE; > } > } > @@ -1497,7 +1514,7 @@ int main(int argc, char **argv) > /* for backwards compatibility */ > filename = argv[0]; > } else { > - printf("usage: %s --file=<rom file>\n", toolname); > + usage(toolname); > return EXIT_FAILURE; > } > }
diff --git a/tools/intel_bios_reader.c b/tools/intel_bios_reader.c index de90f5d..4192919 100644 --- a/tools/intel_bios_reader.c +++ b/tools/intel_bios_reader.c @@ -1414,8 +1414,22 @@ enum opt { OPT_ALL_PANELS, OPT_HEXDUMP, OPT_BLOCK, + OPT_USAGE }; +static void usage(const char *toolname) +{ + fprintf(stderr, "usage %s:", toolname); + fprintf(stderr, " --file=<rom file>" + " [--devid=<device_id>]" + " [--panel-type=<panel_type>]" + " [--all-panels]" + " [--hexdump]" + " [--block=<block_no>]" + " [--help]\n"); + +} + int main(int argc, char **argv) { uint8_t *VBIOS; @@ -1443,6 +1457,7 @@ int main(int argc, char **argv) { "all-panels", no_argument, NULL, OPT_ALL_PANELS }, { "hexdump", no_argument, NULL, OPT_HEXDUMP }, { "block", required_argument, NULL, OPT_BLOCK }, + { "help", no_argument, NULL, OPT_USAGE }, { 0 } }; @@ -1484,7 +1499,9 @@ int main(int argc, char **argv) break; case OPT_END: break; + case OPT_USAGE: /* fall-through */ case OPT_UNKNOWN: + usage(toolname); return EXIT_FAILURE; } } @@ -1497,7 +1514,7 @@ int main(int argc, char **argv) /* for backwards compatibility */ filename = argv[0]; } else { - printf("usage: %s --file=<rom file>\n", toolname); + usage(toolname); return EXIT_FAILURE; } }
Care to add this usage for it as well? Signed-off-by: Marius Vlad <marius.c.vlad@intel.com> --- tools/intel_bios_reader.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)