diff options
Diffstat (limited to 'src/ideviceinstaller.c')
| -rw-r--r-- | src/ideviceinstaller.c | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c index 5709b58..301a5b8 100644 --- a/src/ideviceinstaller.c +++ b/src/ideviceinstaller.c | |||
| @@ -345,31 +345,6 @@ static void idevice_wait_for_command_to_complete() | |||
| 345 | idevice_event_unsubscribe(); | 345 | idevice_event_unsubscribe(); |
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | static int str_is_udid(const char* str) | ||
| 349 | { | ||
| 350 | const char allowed[] = "0123456789abcdefABCDEF"; | ||
| 351 | |||
| 352 | /* handle NULL case */ | ||
| 353 | if (str == NULL) | ||
| 354 | return -1; | ||
| 355 | |||
| 356 | int length = strlen(str); | ||
| 357 | |||
| 358 | /* verify length */ | ||
| 359 | if (length != 40) | ||
| 360 | return -1; | ||
| 361 | |||
| 362 | /* check for invalid characters */ | ||
| 363 | while(length--) { | ||
| 364 | /* invalid character in udid? */ | ||
| 365 | if (strchr(allowed, str[length]) == NULL) { | ||
| 366 | return -1; | ||
| 367 | } | ||
| 368 | } | ||
| 369 | |||
| 370 | return 0; | ||
| 371 | } | ||
| 372 | |||
| 373 | static void print_usage(int argc, char **argv) | 348 | static void print_usage(int argc, char **argv) |
| 374 | { | 349 | { |
| 375 | char *name = NULL; | 350 | char *name = NULL; |
| @@ -378,7 +353,7 @@ static void print_usage(int argc, char **argv) | |||
| 378 | printf("Usage: %s OPTIONS\n", (name ? name + 1 : argv[0])); | 353 | printf("Usage: %s OPTIONS\n", (name ? name + 1 : argv[0])); |
| 379 | printf("Manage apps on iOS devices.\n\n"); | 354 | printf("Manage apps on iOS devices.\n\n"); |
| 380 | printf | 355 | printf |
| 381 | (" -u, --udid UDID\tTarget specific device by its 40-digit device UDID.\n" | 356 | (" -u, --udid UDID\tTarget specific device by UDID.\n" |
| 382 | " -l, --list-apps\tList apps, possible options:\n" | 357 | " -l, --list-apps\tList apps, possible options:\n" |
| 383 | " -o list_user\t- list user apps only (this is the default)\n" | 358 | " -o list_user\t- list user apps only (this is the default)\n" |
| 384 | " -o list_system\t- list system apps only\n" | 359 | " -o list_system\t- list system apps only\n" |
| @@ -454,19 +429,12 @@ static void parse_opts(int argc, char **argv) | |||
| 454 | print_usage(argc, argv); | 429 | print_usage(argc, argv); |
| 455 | exit(0); | 430 | exit(0); |
| 456 | case 'u': | 431 | case 'u': |
| 457 | if (str_is_udid(optarg) == 0) { | 432 | if (!*optarg) { |
| 458 | udid = strdup(optarg); | 433 | printf("ERROR: UDID must not be empty!\n"); |
| 459 | break; | ||
| 460 | } | ||
| 461 | if (strchr(optarg, '.') != NULL) { | ||
| 462 | fprintf(stderr, "WARNING: Using \"-u\" for \"--uninstall\" is deprecated. Please use \"-U\" instead.\n"); | ||
| 463 | cmd = CMD_UNINSTALL; | ||
| 464 | appid = strdup(optarg); | ||
| 465 | } else { | ||
| 466 | printf("ERROR: Invalid UDID specified\n"); | ||
| 467 | print_usage(argc, argv); | 434 | print_usage(argc, argv); |
| 468 | exit(2); | 435 | exit(2); |
| 469 | } | 436 | } |
| 437 | udid = strdup(optarg); | ||
| 470 | break; | 438 | break; |
| 471 | case 'l': | 439 | case 'l': |
| 472 | cmd = CMD_LIST_APPS; | 440 | cmd = CMD_LIST_APPS; |
| @@ -476,11 +444,6 @@ static void parse_opts(int argc, char **argv) | |||
| 476 | appid = strdup(optarg); | 444 | appid = strdup(optarg); |
| 477 | break; | 445 | break; |
| 478 | case 'U': | 446 | case 'U': |
| 479 | if (str_is_udid(optarg) == 0) { | ||
| 480 | fprintf(stderr, "WARNING: Using \"-U\" for \"--udid\" is deprecated. Please use \"-u\" instead.\n"); | ||
| 481 | udid = strdup(optarg); | ||
| 482 | break; | ||
| 483 | } | ||
| 484 | cmd = CMD_UNINSTALL; | 447 | cmd = CMD_UNINSTALL; |
| 485 | appid = strdup(optarg); | 448 | appid = strdup(optarg); |
| 486 | break; | 449 | break; |
