Patchwork [U-Boot] mkimage: add "-V" option to print version information

login
register
mail settings
Submitter Wolfgang Denk
Date Feb. 11, 2011, 8:56 a.m.
Message ID <1297414591-12987-1-git-send-email-wd@denx.de>
Download mbox | patch
Permalink /patch/82723/
State Superseded
Headers show

Comments

Wolfgang Denk - Feb. 11, 2011, 8:56 a.m.
Signed-off-by: Wolfgang Denk <wd@denx.de>
---
 tools/mkimage.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Albert ARIBAUD - Feb. 11, 2011, 9:52 p.m.
Hi Wolfgang,

Le 11/02/2011 09:56, Wolfgang Denk a écrit :
> Signed-off-by: Wolfgang Denk<wd@denx.de>
> ---
>   tools/mkimage.c |    6 ++++++
>   1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/tools/mkimage.c b/tools/mkimage.c
> index f5859d7..788484d 100644
> --- a/tools/mkimage.c
> +++ b/tools/mkimage.c
> @@ -23,6 +23,7 @@
>
>   #include "mkimage.h"
>   #include<image.h>
> +#include<version.h>
>
>   static void copy_file(int, const char *, int);
>   static void usage(void);
> @@ -246,6 +247,10 @@ main (int argc, char **argv)
>   			case 'v':
>   				params.vflag++;
>   				break;
> +			case 'V':
> +				printf("mkimage version %s\n",
> +					U_BOOT_VERSION + 7);

That 7 is a pretty awful magic number here, isn't it? At least if 
there's a sane reason for this it should be summarized in a short comment.

> +				exit(EXIT_SUCCESS);
>   			case 'x':
>   				params.xflag++;
>   				break;
> @@ -590,6 +595,7 @@ usage ()
>   		params.cmdname);
>   	fprintf (stderr, "       %s [-D dtc_options] -f fit-image.its fit-image\n",
>   		params.cmdname);
> +	fprintf (stderr, "       %s -V ==>  print version information and exit\n");
>
>   	exit (EXIT_FAILURE);
>   }

Amicalement,

Patch

diff --git a/tools/mkimage.c b/tools/mkimage.c
index f5859d7..788484d 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -23,6 +23,7 @@ 
 
 #include "mkimage.h"
 #include <image.h>
+#include <version.h>
 
 static void copy_file(int, const char *, int);
 static void usage(void);
@@ -246,6 +247,10 @@  main (int argc, char **argv)
 			case 'v':
 				params.vflag++;
 				break;
+			case 'V':
+				printf("mkimage version %s\n",
+					U_BOOT_VERSION + 7);
+				exit(EXIT_SUCCESS);
 			case 'x':
 				params.xflag++;
 				break;
@@ -590,6 +595,7 @@  usage ()
 		params.cmdname);
 	fprintf (stderr, "       %s [-D dtc_options] -f fit-image.its fit-image\n",
 		params.cmdname);
+	fprintf (stderr, "       %s -V ==> print version information and exit\n");
 
 	exit (EXIT_FAILURE);
 }