mirror of
https://xff.cz/git/u-boot/
synced 2025-09-29 22:41:17 +02:00
mkimage: Move argument processing into its own function
At present main() is very long. Split out the argument processing to make it easier to follow. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -67,18 +67,9 @@ static void show_image_types(void)
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
static void process_args(int argc, char **argv)
|
||||
{
|
||||
int ifd = -1;
|
||||
struct stat sbuf;
|
||||
char *ptr;
|
||||
int retval = 0;
|
||||
struct image_type_params *tparams = NULL;
|
||||
int pad_len = 0;
|
||||
int dfd;
|
||||
|
||||
params.cmdname = *argv;
|
||||
params.addr = params.ep = 0;
|
||||
|
||||
while (--argc > 0 && **++argv == '-') {
|
||||
while (*++*argv) {
|
||||
@@ -216,6 +207,25 @@ NXTARG: ;
|
||||
|
||||
if (argc != 1)
|
||||
usage();
|
||||
params.imagefile = *argv;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int ifd = -1;
|
||||
struct stat sbuf;
|
||||
char *ptr;
|
||||
int retval = 0;
|
||||
struct image_type_params *tparams = NULL;
|
||||
int pad_len = 0;
|
||||
int dfd;
|
||||
|
||||
params.cmdname = *argv;
|
||||
params.addr = 0;
|
||||
params.ep = 0;
|
||||
|
||||
process_args(argc, argv);
|
||||
|
||||
/* set tparams as per input type_id */
|
||||
tparams = imagetool_get_type(params.type);
|
||||
@@ -240,8 +250,6 @@ NXTARG: ;
|
||||
params.ep += tparams->header_size;
|
||||
}
|
||||
|
||||
params.imagefile = *argv;
|
||||
|
||||
if (params.fflag){
|
||||
if (tparams->fflag_handle)
|
||||
/*
|
||||
|
Reference in New Issue
Block a user