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

login
register
mail settings
Submitter Wolfgang Denk
Date Feb. 11, 2011, 12:22 p.m.
Message ID <1297426949-21865-1-git-send-email-wd@denx.de>
Download mbox | patch
Permalink /patch/82748/
State Superseded
Headers show

Comments

Wolfgang Denk - Feb. 11, 2011, 12:22 p.m.
Signed-off-by: Wolfgang Denk <wd@denx.de>
---
v2: fix missing argument to printf() call.

 tools/mkimage.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
Albert ARIBAUD - Feb. 11, 2011, 9:55 p.m.
Wolfgang,

Please ignore my previous post on V1, I had not seen V2. My comment 
holds, though:

Le 11/02/2011 13:22, Wolfgang Denk a écrit :
> Signed-off-by: Wolfgang Denk<wd@denx.de>
> ---
> v2: fix missing argument to printf() call.
>
>   tools/mkimage.c |    7 +++++++
>   1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/tools/mkimage.c b/tools/mkimage.c
> index f5859d7..127be57 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);

If that magic number 7 (and the addition, as well) has any reason, it 
should at least be explained in a short comment.

> +				exit(EXIT_SUCCESS);
>   			case 'x':
>   				params.xflag++;
>   				break;
> @@ -590,6 +595,8 @@ 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",
> +		params.cmdname);
>
>   	exit (EXIT_FAILURE);
>   }


Amicalement,
Wolfgang Denk - Feb. 11, 2011, 10:35 p.m.
Dear Albert ARIBAUD,

In message <4D55B03A.9030602@free.fr> you wrote:
> 
> Please ignore my previous post on V1, I had not seen V2. My comment
> holds, though:
...
> > +			case 'V':
> > +				printf("mkimage version %s\n",
> > +					U_BOOT_VERSION + 7);
>
> If that magic number 7 (and the addition, as well) has any reason, it >
> should at least be explained in a short comment.

Heh... I though I could leave this as an exercide for the reader ;-)

New version following...


Thanks for pointing out.

Best regards,

Wolfgang Denk

Patch

diff --git a/tools/mkimage.c b/tools/mkimage.c
index f5859d7..127be57 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,8 @@  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",
+		params.cmdname);
 
 	exit (EXIT_FAILURE);
 }