Commit 07450081 authored by Simon Glass's avatar Simon Glass Committed by Tom Rini
Browse files

mkimage: Sort the option processing code by option



Adjust the code so that option alphabetical order matches the order in the
switch() statement. This makes it easier to find options.
Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
parent a02221f2
...@@ -75,8 +75,13 @@ static void process_args(int argc, char **argv) ...@@ -75,8 +75,13 @@ static void process_args(int argc, char **argv)
while ((opt = getopt(argc, argv, while ((opt = getopt(argc, argv,
"a:A:cC:d:D:e:f:Fk:K:ln:O:rR:sT:vVx")) != -1) { "a:A:cC:d:D:e:f:Fk:K:ln:O:rR:sT:vVx")) != -1) {
switch (opt) { switch (opt) {
case 'l': case 'a':
params.lflag = 1; params.addr = strtoull(optarg, &ptr, 16);
if (*ptr) {
fprintf(stderr, "%s: invalid load address %s\n",
params.cmdname, optarg);
exit(EXIT_FAILURE);
}
break; break;
case 'A': case 'A':
params.arch = genimg_get_arch_id(optarg); params.arch = genimg_get_arch_id(optarg);
...@@ -91,33 +96,13 @@ static void process_args(int argc, char **argv) ...@@ -91,33 +96,13 @@ static void process_args(int argc, char **argv)
if (params.comp < 0) if (params.comp < 0)
usage(); usage();
break; break;
case 'D':
params.dtc = optarg;
break;
case 'O':
params.os = genimg_get_os_id(optarg);
if (params.os < 0)
usage();
break;
case 'T':
params.type = genimg_get_type_id(optarg);
if (params.type < 0) {
show_image_types();
usage();
}
break;
case 'a':
params.addr = strtoull(optarg, &ptr, 16);
if (*ptr) {
fprintf(stderr, "%s: invalid load address %s\n",
params.cmdname, optarg);
exit(EXIT_FAILURE);
}
break;
case 'd': case 'd':
params.datafile = optarg; params.datafile = optarg;
params.dflag = 1; params.dflag = 1;
break; break;
case 'D':
params.dtc = optarg;
break;
case 'e': case 'e':
params.ep = strtoull(optarg, &ptr, 16); params.ep = strtoull(optarg, &ptr, 16);
if (*ptr) { if (*ptr) {
...@@ -144,9 +129,17 @@ static void process_args(int argc, char **argv) ...@@ -144,9 +129,17 @@ static void process_args(int argc, char **argv)
case 'K': case 'K':
params.keydest = optarg; params.keydest = optarg;
break; break;
case 'l':
params.lflag = 1;
break;
case 'n': case 'n':
params.imagename = optarg; params.imagename = optarg;
break; break;
case 'O':
params.os = genimg_get_os_id(optarg);
if (params.os < 0)
usage();
break;
case 'r': case 'r':
params.require_keys = 1; params.require_keys = 1;
break; break;
...@@ -160,6 +153,13 @@ static void process_args(int argc, char **argv) ...@@ -160,6 +153,13 @@ static void process_args(int argc, char **argv)
case 's': case 's':
params.skipcpy = 1; params.skipcpy = 1;
break; break;
case 'T':
params.type = genimg_get_type_id(optarg);
if (params.type < 0) {
show_image_types();
usage();
}
break;
case 'v': case 'v':
params.vflag++; params.vflag++;
break; break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment