Hello.

Thanks for your patch.

I'm fine with the idea but have some problems with the coding style.
It behaves differently form the other code and thus makes it harder to
read. See below.

On Thu, 2012-01-05 at 20:30, Angelo S. Mavridis Bartolome wrote:
> From: "Angelo S. Mavridis Bartolome" <barkl...@gmail.com>
> 
> ---
>  src/moto-boot-usb.c |   18 +++++++++++++-----
>  1 files changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/src/moto-boot-usb.c b/src/moto-boot-usb.c
> index 962a236..d57d888 100644
> --- a/src/moto-boot-usb.c
> +++ b/src/moto-boot-usb.c
> @@ -28,6 +28,7 @@
>  
>  #include <stdio.h>
>  #include <stdlib.h>
> +#include <stdbool.h>
>  #include <unistd.h>
>  #include <string.h>
>  #include <getopt.h>
> @@ -627,7 +628,9 @@ static void usage()
>            "   moto-boot-usb setflag usb|dumpkeys|passthrough\t"
>            "set memory flag for gen-blob\n"
>            "   moto-boot-usb off\t\t\t\t"
> -          "power off the phone\n\n");
> +          "power off the phone\n"
> +          "   moto-boot-usb help\t\t\t\t"
> +          "show this help screen\n\n");
>  
>       info("You can use hexadecimal and decimal "
>            "for <addr> and <size> arguments,\n"
> @@ -866,14 +869,19 @@ int main(int argc, char *argv[])
>       int k_offset = 0;
>       int mach_id = 867; /* 867 is the old EZX mach id */
>       int ret;
> +     bool helpParam = 0;

Please don't use camelCase variable name here. We just use lower case
names as you can see from the variable above.

>       printf("%s\n", "$Id$");
> -
> -     if (argc < 2) {
> +     
> +     if (argc >= 2 && (!strcmp(argv[1], "help"))) helpParam = 1;

Please write the statement after if on a new line. Even if it is only
one statemenmt. Same for the changes below.

> +     else if (argc >= 2 && (!strcmp(argv[1], "--help"))) helpParam = 1;
> +     
> +     if (argc < 2 || helpParam) {
>               usage();
>  
> -             error("Too few arguments.");
> -             exit(1);
> +             if (!helpParam) error("Too few arguments.");
> +             if (!helpParam) exit(1);
> +             exit(0);

regards
Stefan Schmidt

Reply via email to