aboutsummaryrefslogtreecommitdiffstats
path: root/com32/modules
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-05 09:50:00 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-05 09:50:00 -0700
commit1b3adda8be6bb9dc04108880d84bba12e68fd9c9 (patch)
treeb7f741d50431e93b99c7f0c987a47dc7191f50d6 /com32/modules
parent23bd63a7019775ef320550183ae7757e2da24350 (diff)
downloadsyslinux.git-1b3adda8be6bb9dc04108880d84bba12e68fd9c9.tar.gz
syslinux.git-1b3adda8be6bb9dc04108880d84bba12e68fd9c9.tar.xz
syslinux.git-1b3adda8be6bb9dc04108880d84bba12e68fd9c9.zip
linux.c32: honor the "quiet" flag
Honor the "quiet" flag for linux.c32, since some distros have odd notions about these things. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/modules')
-rw-r--r--com32/modules/linux.c40
1 files changed, 34 insertions, 6 deletions
diff --git a/com32/modules/linux.c b/com32/modules/linux.c
index 87b610d4..70afdcb6 100644
--- a/com32/modules/linux.c
+++ b/com32/modules/linux.c
@@ -1,6 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2007-2008 H. Peter Anvin - All Rights Reserved
+ * Copyright 2009 Intel Corporation; author: H. Peter Anvin
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@@ -37,6 +38,7 @@
* Usage: linux.c32 [-dhcpinfo] kernel arguments...
*/
+#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -63,6 +65,19 @@ static char *find_argument(char **argv, const char *argument)
return ptr;
}
+/* Search for a boolean argument; return its position, or 0 if not present */
+static int find_boolean(char **argv, const char *argument)
+{
+ char **arg;
+
+ for (arg = argv; *arg; arg++) {
+ if (!strcmp(*arg, argument))
+ return (arg-argv)+1;
+ }
+
+ return 0;
+}
+
/* Stitch together the command line from a set of argv's */
static char *make_cmdline(char **argv)
{
@@ -101,7 +116,8 @@ int main(int argc, char *argv[])
char *boot_image;
void *kernel_data;
size_t kernel_len;
- int opt_dhcpinfo = 0;
+ bool opt_dhcpinfo = false;
+ bool opt_quiet = false;
void *dhcpdata;
size_t dhcplen;
char **argp, *arg, *p;
@@ -113,7 +129,7 @@ int main(int argc, char *argv[])
while ((arg = *argp) && arg[0] == '-') {
if (!strcmp("-dhcpinfo", arg)) {
- opt_dhcpinfo = 1;
+ opt_dhcpinfo = true;
} else {
fprintf(stderr, "%s: unknown option: %s\n", progname, arg);
return 1;
@@ -127,13 +143,21 @@ int main(int argc, char *argv[])
}
kernel_name = arg;
+ argp++;
+
+ if (find_boolean(argp,"quiet"))
+ opt_quiet = true;
- printf("Loading %s... ", kernel_name);
+ if (!opt_quiet)
+ printf("Loading %s... ", kernel_name);
if (loadfile(kernel_name, &kernel_data, &kernel_len)) {
+ if (opt_quiet)
+ printf("Loading %s ", kernel_name);
printf("failed!\n");
goto bail;
}
- printf("ok\n");
+ if (!opt_quiet)
+ printf("ok\n");
boot_image = malloc(strlen(kernel_name)+12);
if (!boot_image)
@@ -162,12 +186,16 @@ int main(int argc, char *argv[])
if (p)
*p = '\0';
- printf("Loading %s... ", arg);
+ if (!opt_quiet)
+ printf("Loading %s... ", arg);
if (initramfs_load_archive(initramfs, arg)) {
+ if (opt_quiet)
+ printf("Loading %s ", kernel_name);
printf("failed!\n");
goto bail;
}
- printf("ok\n");
+ if (!opt_quiet)
+ printf("ok\n");
if (p)
*p++ = ',';