diff options
Diffstat (limited to 'rbutil/ipodpatcher/main.c')
-rw-r--r-- | rbutil/ipodpatcher/main.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/rbutil/ipodpatcher/main.c b/rbutil/ipodpatcher/main.c index 0983af768f..a4508abf57 100644 --- a/rbutil/ipodpatcher/main.c +++ b/rbutil/ipodpatcher/main.c | |||
@@ -46,7 +46,8 @@ enum { | |||
46 | READ_FIRMWARE, | 46 | READ_FIRMWARE, |
47 | WRITE_FIRMWARE, | 47 | WRITE_FIRMWARE, |
48 | READ_PARTITION, | 48 | READ_PARTITION, |
49 | WRITE_PARTITION | 49 | WRITE_PARTITION, |
50 | FORMAT_PARTITION | ||
50 | }; | 51 | }; |
51 | 52 | ||
52 | void print_macpod_warning(void) | 53 | void print_macpod_warning(void) |
@@ -85,6 +86,7 @@ void print_usage(void) | |||
85 | fprintf(stderr," -a, --add-bootloader filename.ipod\n"); | 86 | fprintf(stderr," -a, --add-bootloader filename.ipod\n"); |
86 | fprintf(stderr," -ab, --add-bootloader-bin filename.bin\n"); | 87 | fprintf(stderr," -ab, --add-bootloader-bin filename.bin\n"); |
87 | fprintf(stderr," -d, --delete-bootloader\n"); | 88 | fprintf(stderr," -d, --delete-bootloader\n"); |
89 | fprintf(stderr," -f, --format\n"); | ||
88 | fprintf(stderr,"\n"); | 90 | fprintf(stderr,"\n"); |
89 | 91 | ||
90 | #ifdef __WIN32__ | 92 | #ifdef __WIN32__ |
@@ -128,9 +130,7 @@ void display_partinfo(struct ipod_t* ipod) | |||
128 | 130 | ||
129 | int main(int argc, char* argv[]) | 131 | int main(int argc, char* argv[]) |
130 | { | 132 | { |
131 | #ifdef WITH_BOOTOBJS | ||
132 | char yesno[4]; | 133 | char yesno[4]; |
133 | #endif | ||
134 | int i; | 134 | int i; |
135 | int n; | 135 | int n; |
136 | int infile, outfile; | 136 | int infile, outfile; |
@@ -293,6 +293,10 @@ int main(int argc, char* argv[]) | |||
293 | (strcmp(argv[i],"--verbose")==0)) { | 293 | (strcmp(argv[i],"--verbose")==0)) { |
294 | verbose++; | 294 | verbose++; |
295 | i++; | 295 | i++; |
296 | } else if ((strcmp(argv[i],"-f")==0) || | ||
297 | (strcmp(argv[i],"--format")==0)) { | ||
298 | action = FORMAT_PARTITION; | ||
299 | i++; | ||
296 | } else { | 300 | } else { |
297 | print_usage(); return 1; | 301 | print_usage(); return 1; |
298 | } | 302 | } |
@@ -465,6 +469,23 @@ int main(int argc, char* argv[]) | |||
465 | } | 469 | } |
466 | 470 | ||
467 | close(infile); | 471 | close(infile); |
472 | } else if (action==FORMAT_PARTITION) { | ||
473 | printf("WARNING!!! YOU ARE ABOUT TO USE AN EXPERIMENTAL FORMATTING FEATURE.\n"); | ||
474 | printf("Are you sure you want to continue? (y/n):"); | ||
475 | |||
476 | if (fgets(yesno,4,stdin)) { | ||
477 | if (yesno[0]=='y') { | ||
478 | if (ipod_reopen_rw(&ipod) < 0) { | ||
479 | return 5; | ||
480 | } | ||
481 | |||
482 | if (format_partition(&ipod,1) < 0) { | ||
483 | fprintf(stderr,"[ERR] Format failed.\n"); | ||
484 | } | ||
485 | } else { | ||
486 | fprintf(stderr,"[INFO] Format cancelled.\n"); | ||
487 | } | ||
488 | } | ||
468 | } | 489 | } |
469 | 490 | ||
470 | ipod_close(&ipod); | 491 | ipod_close(&ipod); |