diff options
Diffstat (limited to 'cgpt/cmd_create.c')
-rw-r--r-- | cgpt/cmd_create.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/cgpt/cmd_create.c b/cgpt/cmd_create.c index ca1b815d..47137bdc 100644 --- a/cgpt/cmd_create.c +++ b/cgpt/cmd_create.c @@ -15,10 +15,13 @@ static void Usage(void) printf("\nUsage: %s create [OPTIONS] DRIVE\n\n" "Create or reset an empty GPT.\n\n" "Options:\n" + " -D NUM Size (in bytes) of the disk where partitions reside\n" + " default 0, meaning partitions and GPT structs are\n" + " both on DRIVE\n" " -z Zero the sectors of the GPT table and entries\n" - " -s Size (in byes) of the disk (MTD only)\n" - " -p Size (in blocks) of the disk to pad between the\n" - " primary GPT header and its entries, default 0\n" + " -s NUM Size (in bytes) of the disk (MTD only)\n" + " -p NUM Size (in blocks) of the disk to pad between the\n" + " primary GPT header and its entries, default 0\n" "\n", progname); } @@ -31,10 +34,18 @@ int cmd_create(int argc, char *argv[]) { char *e = 0; opterr = 0; // quiet, you - while ((c=getopt(argc, argv, ":hzsp:")) != -1) + while ((c=getopt(argc, argv, ":hzs:p:D:")) != -1) { switch (c) { + case 'D': + params.drive_size = strtoull(optarg, &e, 0); + if (!*optarg || (e && *e)) + { + Error("invalid argument to -%c: \"%s\"\n", c, optarg); + errorcnt++; + } + break; case 'z': params.zap = 1; break; @@ -43,8 +54,12 @@ int cmd_create(int argc, char *argv[]) { break; case 'p': params.padding = strtoull(optarg, &e, 0); + if (!*optarg || (e && *e)) + { + Error("invalid argument to -%c: \"%s\"\n", c, optarg); + errorcnt++; + } break; - case 'h': Usage(); return CGPT_OK; |