mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Juergen Beisert <jbe@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 08/10] Change 'linux16' command to use getopt()
Date: Fri,  7 Jan 2011 09:35:14 +0100	[thread overview]
Message-ID: <1294389316-6569-9-git-send-email-jbe@pengutronix.de> (raw)
In-Reply-To: <1294389316-6569-1-git-send-email-jbe@pengutronix.de>

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
---
 commands/linux16.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/commands/linux16.c b/commands/linux16.c
index 5f412e2..87245d4 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;
-- 
1.7.2.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2011-01-07  8:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-07  8:35 Various fixes to make barebox's x86 support working again Juergen Beisert
2011-01-07  8:35 ` [PATCH 01/10] x86: Remove not used expressions from the makefile Juergen Beisert
2011-01-07  8:35 ` [PATCH 02/10] x86: Use the generic linker script initializing Juergen Beisert
2011-01-07  8:35 ` [PATCH 03/10] x86 ATA: Don't touch the size entry for the BIOS disk based device Juergen Beisert
2011-01-07  8:35 ` [PATCH 04/10] x86 Generic platform: Fix some typos Juergen Beisert
2011-01-07  8:35 ` [PATCH 05/10] x86 Generic platform: Fix disk drive name Juergen Beisert
2011-01-07  8:35 ` [PATCH 06/10] x86 Generic platform: Fix prompt name Juergen Beisert
2011-01-07  8:35 ` [PATCH 07/10] x86: Remove 'uboot' from file names Juergen Beisert
2011-01-07  8:35 ` Juergen Beisert [this message]
2011-01-07  8:35 ` [PATCH 09/10] LINUX16: Add selection of the VESA video mode Juergen Beisert
2011-01-07 16:51   ` Jean-Christophe PLAGNIOL-VILLARD
2011-01-13 15:22     ` Juergen Beisert
2011-01-13 15:25       ` Robert Schwebel
2011-01-07  8:35 ` [PATCH 10/10] LINUX16: Fix warning Juergen Beisert
2011-03-08 14:48 [PATCH] Various fixes to make barebox's x86 support working again Juergen Beisert
2011-03-08 14:48 ` [PATCH 08/10] Change 'linux16' command to use getopt() Juergen Beisert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1294389316-6569-9-git-send-email-jbe@pengutronix.de \
    --to=jbe@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox