diff options
author | Juergen Beisert <jbe@pengutronix.de> | 2010-12-22 14:48:07 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-03-10 11:15:13 +0100 |
commit | 6db768f0461de00bd2209941e5b94bb98dda1139 (patch) | |
tree | af75cf0f51594d5d2d782e9ff65f3b73c5649f52 /commands/linux16.c | |
parent | b022d614917c2aeccff538932c3aa20b017c5283 (diff) | |
download | barebox-6db768f0461de00bd2209941e5b94bb98dda1139.tar.gz barebox-6db768f0461de00bd2209941e5b94bb98dda1139.tar.xz |
Change 'linux16' command to use getopt()
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Diffstat (limited to 'commands/linux16.c')
-rw-r--r-- | commands/linux16.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/commands/linux16.c b/commands/linux16.c index 5f412e29d3..87245d4d2c 100644 --- a/commands/linux16.c +++ b/commands/linux16.c @@ -28,6 +28,7 @@ #include <environment.h> #include <fs.h> #include <errno.h> +#include <getopt.h> #include <malloc.h> #include <asm/syslib.h> @@ -153,18 +154,25 @@ struct linux_kernel_header { static int do_linux16(struct command *cmdtp, int argc, char *argv[]) { struct linux_kernel_header *lh = NULL; - int rc; + int rc, opt; unsigned setup_sects; unsigned real_mode_size; size_t image_size; const char *cmdline = getenv("bootargs"); + const char *kernel_file; - if (argc < 2) { - perror("linux16"); + while((opt = getopt(argc, argv, "")) > 0) { + switch(opt) { + } + } + + if (optind == argc) { + printf("No kernel filename given\n"); return 1; } + kernel_file = argv[optind]; - lh = read_file(argv[1], &image_size); + lh = read_file(kernel_file, &image_size); if (lh == NULL) { printf("Cannot read file '%s'\n", argv[1]); return 1; |