diff options
author | Martin Szulecki | 2020-06-14 22:53:55 +0200 |
---|---|---|
committer | Martin Szulecki | 2020-06-14 22:53:55 +0200 |
commit | 3934652aeea8bc5b824d237bbaff648381217db2 (patch) | |
tree | e8051209f38aa0fd8005424a55caeaae698f2435 /tools/irecovery.c | |
parent | c2e65ff7d2c4a7bc03ba98906009c581d77a1b9f (diff) | |
download | libirecovery-3934652aeea8bc5b824d237bbaff648381217db2.tar.gz libirecovery-3934652aeea8bc5b824d237bbaff648381217db2.tar.bz2 |
irecovery: Add long argument name variants
Diffstat (limited to 'tools/irecovery.c')
-rw-r--r-- | tools/irecovery.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/tools/irecovery.c b/tools/irecovery.c index 48a69f6..fd53925 100644 --- a/tools/irecovery.c +++ b/tools/irecovery.c @@ -27,6 +27,7 @@ #include <stdlib.h> #include <unistd.h> #include <string.h> +#include <getopt.h> #include <inttypes.h> #include <libirecovery.h> #include <readline/readline.h> @@ -358,24 +359,39 @@ static void print_usage(int argc, char **argv) { printf("Interact with an iOS device in DFU or recovery mode.\n"); printf("\n"); printf("OPTIONS:\n"); - printf(" -i ECID\tconnect to specific device by its ECID\n"); - printf(" -c CMD\trun CMD on device\n"); - printf(" -m\t\tprint current device mode\n"); - printf(" -f FILE\tsend file to device\n"); - printf(" -k FILE\tsend limera1n usb exploit payload from FILE\n"); - printf(" -r\t\treset client\n"); - printf(" -n\t\treboot device into normal mode (exit recovery loop)\n"); - printf(" -e FILE\texecutes recovery script from FILE\n"); - printf(" -s\t\tstart an interactive shell\n"); - printf(" -q\t\tquery device info\n"); - printf(" -v\t\tenable verbose output, repeat for higher verbosity\n"); - printf(" -h\t\tprints this usage information\n"); + printf(" -i, --ecid ECID\tconnect to specific device by its ECID\n"); + printf(" -c, --command CMD\trun CMD on device\n"); + printf(" -m, --mode\t\tprint current device mode\n"); + printf(" -f, --file FILE\tsend file to device\n"); + printf(" -k, --payload FILE\tsend limera1n usb exploit payload from FILE\n"); + printf(" -r, --reset\t\treset client\n"); + printf(" -n, --normal\t\treboot device into normal mode (exit recovery loop)\n"); + printf(" -e, --script FILE\texecutes recovery script from FILE\n"); + printf(" -s, --shell\t\tstart an interactive shell\n"); + printf(" -q, --query\t\tquery device info\n"); + printf(" -v, --verbose\t\tenable verbose output, repeat for higher verbosity\n"); + printf(" -h, --help\t\tprints this usage information\n"); printf("\n"); printf("Homepage: <" PACKAGE_URL ">\n"); printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n"); } int main(int argc, char* argv[]) { + static struct option longopts[] = { + { "ecid", required_argument, NULL, 'i' }, + { "command", required_argument, NULL, 'c' }, + { "mode", no_argument, NULL, 'm' }, + { "file", required_argument, NULL, 'f' }, + { "payload", required_argument, NULL, 'k' }, + { "reset", no_argument, NULL, 'r' }, + { "normal", no_argument, NULL, 'n' }, + { "script", required_argument, NULL, 'e' }, + { "shell", no_argument, NULL, 's' }, + { "query", no_argument, NULL, 'q' }, + { "verbose", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 'h' }, + { NULL, 0, NULL, 0 } + }; int i = 0; int opt = 0; int action = kNoAction; @@ -392,7 +408,7 @@ int main(int argc, char* argv[]) { return 0; } - while ((opt = getopt(argc, argv, "i:vhrsmnc:f:e:k::q")) > 0) { + while ((opt = getopt_long(argc, argv, "i:vhrsmnc:f:e:k:q", longopts, NULL)) > 0) { switch (opt) { case 'i': if (optarg) { |