summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2020-06-04 05:04:07 +0200
committerGravatar Martin Szulecki2020-06-04 05:04:07 +0200
commit1b2b2eb9914af4773079af5b1702b065dba4a6e5 (patch)
treec0a0c389df8228311df84d2e37ab8b3628ff9e58
parentb7af9688bc0beaa717d36b45cbaf690ab2ecdf8d (diff)
downloadidevicerestore-1b2b2eb9914af4773079af5b1702b065dba4a6e5.tar.gz
idevicerestore-1b2b2eb9914af4773079af5b1702b065dba4a6e5.tar.bz2
Add new "--version" option to output version information and update man page
-rw-r--r--docs/idevicerestore.13
-rw-r--r--src/idevicerestore.c9
2 files changed, 11 insertions, 1 deletions
diff --git a/docs/idevicerestore.1 b/docs/idevicerestore.1
index fcd52b7..4a244b5 100644
--- a/docs/idevicerestore.1
+++ b/docs/idevicerestore.1
@@ -55,6 +55,9 @@ enable communication debugging.
.TP
.B \-h, \-\-help
prints usage information.
+.TP
+.B \-v, \-\-version
+prints version information.
.SH AUTHORS
Martin Szulecki
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index d4bdff9..996b3c7 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -77,6 +77,7 @@ static struct option longopts[] = {
{ "restore-mode", no_argument, NULL, 'R' },
{ "ticket", required_argument, NULL, 'T' },
{ "no-restore", no_argument, NULL, 'z' },
+ { "version", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0 }
};
@@ -116,6 +117,7 @@ static void usage(int argc, char* argv[], int err)
" -C, --cache-path DIR Use specified directory for caching extracted or other\n" \
" reused files.\n" \
" -d, --debug Enable communication debugging\n" \
+ " -v, --version Print version information\n" \
"\n" \
"Advanced/experimental options:\n"
" -c, --custom Restore with a custom firmware\n" \
@@ -1569,7 +1571,7 @@ int main(int argc, char* argv[]) {
client->flags |= FLAG_INTERACTIVE;
}
- while ((opt = getopt_long(argc, argv, "dhcesxtpli:u:nC:kyPRT:z", longopts, &optindex)) > 0) {
+ while ((opt = getopt_long(argc, argv, "dhcesxtpli:u:nC:kyPRT:zv", longopts, &optindex)) > 0) {
switch (opt) {
case 'h':
usage(argc, argv, 0);
@@ -1658,6 +1660,10 @@ int main(int argc, char* argv[]) {
client->flags |= FLAG_NO_RESTORE;
break;
+ case 'v':
+ info("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION);
+ return 0;
+
case 'T': {
size_t root_ticket_len = 0;
unsigned char* root_ticket = NULL;
@@ -1669,6 +1675,7 @@ int main(int argc, char* argv[]) {
info("Using ApTicket found at %s length %u\n", optarg, client->root_ticket_len);
break;
}
+
default:
usage(argc, argv, 1);
return -1;