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;
 
        printf("%s\n", "$Id$");
-
-       if (argc < 2) {
+       
+       if (argc >= 2 && (!strcmp(argv[1], "help"))) helpParam = 1;
+       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);
        }
 
        ezx_device_open();
-- 
1.7.5.4


Reply via email to