tegrarcm: Add version command
PATCH 1/1 tegrarcm: Add version command
Add command line option "--version" that prints the version number and exits.
--- src/main.c | 11 +++++++++++ src/tegrarcm.1.in | 3 +++ 2 files changed, 14 insertions(+)
src/main.c +11 -0
@@ -46,6 +46,7 @@#include "aes-cmac.h" #include "rcm.h" #include "debug.h" +#include "config.h" // tegra20 miniloader #include "tegra20-miniloader.h"
@@ -71,9 +72,15 @@ enum cmdline_opts {OPT_LOADADDR ,OPT_ENTRYADDR ,OPT_HELP , +OPT_VERSION , OPT_END, }; +static void print_version (char *progname) +{ +fprintf (stderr,"%s %s\n" ,PACKAGE_NAME ,PACKAGE_VERSION ); +} +static void usage (char *progname) {fprintf (stderr,"usage: %s --bct=bctfile --bootloader=blfile --loadaddr=<loadaddr> --entryaddr=<entryaddr>\n" , progname);
@@ -111,6 +118,7 @@ int main(int argc, char **argv) [OPT_LOADADDR] = {"loadaddr", 1, 0, 0}, [OPT_ENTRYADDR] = {"entryaddr", 1, 0, 0}, [OPT_HELP] = {"help", 0, 0, 0}, + [OPT_VERSION] = {"version", 0, 0, 0}, [OPT_END ] = {0 ,0 ,0 ,0 } };
@@ -136,6 +144,9 @@ int main(int argc, char **argv)case OPT_ENTRYADDR : entryaddr =strtoul (optarg,NULL ,0 );break ; +case OPT_VERSION : +print_version (argv[0 ]); +exit (0 );case OPT_HELP :default :usage (argv[0 ]);
src/tegrarcm.1.in +3 -0
@@ -59,6 +59,9 @@ specified in hex and is typically 0x108000 for a Tegra20 device or Specify the entry address that control will be passed to after the firmware is loaded. This should be specified in hex. If this option is omitted it is assumed to be the same as the load address. +.TP +.B \-\-version +Print the version number and exit. .SH EXAMPLE To download u-boot firmware to a Tegra20 seaboard:
Signature · 1 line
1.8.1.5
A message that is not in the archive (sent off-list or not yet received): 1371525867-2551-1-git-send-email-amartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org
Stephen Warren
Acked-byQuoted 2 lines · Allen Martin
Add command line option "--version" that prints the version number and exits.
I assume you'll apply all these.
Although...
src/main.c enum cmdline_opts { · line 82
Quoted 4 lines
src/main.c +4
-0+static void print_version (char *progname) +{ +fprintf (stderr,"%s %s\n" ,PACKAGE_NAME ,PACKAGE_VERSION ); +}
I wonder if that shouldn't print to stdout; it's the requested output of the command, not some error message.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Stephen Warren
Quoted 2 lines · Allen Martin
Add command line option "--version" that prints the version number and exits.
Acked-by Stephen Warren <[email protected]>I assume you'll apply all these.
yes
Quoted 10 lines
Although...
src/main.c enum cmdline_opts { · line 82
Quoted 4 lines
src/main.c +4
-0+static void print_version (char *progname) +{ +fprintf (stderr,"%s %s\n" ,PACKAGE_NAME ,PACKAGE_VERSION ); +}I wonder if that shouldn't print to stdout; it's the requested output of the command, not some error message.
Sounds reasonable.
-Allen
Signature · 1 line
nvpublic