ALT Linux Bugzilla
– Attachment 4952 Details for
Bug 25663
[FR] add whichsys.c32
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
[patch]
syslinux-3.82-whichsys.diff
syslinux-3.82-whichsys.diff (text/plain), 6.22 KB, created by
Michael Shigorin
on 2011-05-24 13:47:38 MSK
(
hide
)
Description:
syslinux-3.82-whichsys.diff
Filename:
MIME Type:
Creator:
Michael Shigorin
Created:
2011-05-24 13:47:38 MSK
Size:
6.22 KB
patch
obsolete
>From 66c3eb4f6fc622fc3326956adfb0c6e23342b98f Mon Sep 17 00:00:00 2001 >From: Gert Hulselmans <gerth@zytor.com> >Date: Mon, 5 Jul 2010 23:52:39 +0200 >Subject: [PATCH] whichsys.c32: execute specific command, based on Syslinux > bootloader variant > >Detemine which command to execute, based on the Syslinux bootloader variant >from which you run it. > > Usage: whichsys.c32 [-iso- command] [-pxe- command] [-sys- command] > Examples: whichsys.c32 -iso- chain.c32 hd0 -sys- chain.c32 hd1 swap > whichsys.c32 -iso- config iso.cfg -sys- sys.cfg -pxe- pxe.cfg > >Signed-off-by: Gert Hulselmans <gerth@zytor.com> >--- > com32/modules/Makefile | 2 +- > com32/modules/whichsys.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 129 insertions(+), 1 deletions(-) > create mode 100644 com32/modules/whichsys.c > >diff --git a/com32/modules/Makefile b/com32/modules/Makefile >index f42ce96..2d47913 100644 >--- a/com32/modules/Makefile >+++ b/com32/modules/Makefile >@@ -22,7 +22,7 @@ MODULES = chain.c32 config.c32 ethersel.c32 dmitest.c32 cpuidtest.c32 \ > disk.c32 pcitest.c32 elf.c32 linux.c32 reboot.c32 pmload.c32 \ > meminfo.c32 sdi.c32 sanboot.c32 ifcpu64.c32 vesainfo.c32 \ > kbdmap.c32 cmd.c32 vpdtest.c32 host.c32 ls.c32 gpxecmd.c32 \ >- ifcpu.c32 cpuid.c32 cat.c32 pwd.c32 ifplop.c32 >+ ifcpu.c32 cpuid.c32 cat.c32 pwd.c32 ifplop.c32 whichsys.c32 > > TESTFILES = > >diff --git a/com32/modules/whichsys.c b/com32/modules/whichsys.c >new file mode 100644 >index 0000000..c186722 >--- /dev/null >+++ b/com32/modules/whichsys.c >@@ -0,0 +1,128 @@ >+/* ----------------------------------------------------------------------- * >+ * >+ * Copyright 2010 Gert Hulselmans - All Rights Reserved >+ * >+ * This program is free software; you can redistribute it and/or modify >+ * it under the terms of the GNU General Public License as published by >+ * the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, >+ * Boston MA 02110-1301, USA; either version 2 of the License, or >+ * (at your option) any later version; incorporated herein by reference. >+ * >+ * ----------------------------------------------------------------------- */ >+ >+/* >+ * whichsys.c >+ * >+ * Detemine which command to execute, based on the Syslinux bootloader variant >+ * from which you run it. >+ * >+ * Usage: whichsys.c32 [-iso- command] [-pxe- command] [-sys- command] >+ * Examples: whichsys.c32 -iso- chain.c32 hd0 -sys- chain.c32 hd1 swap >+ * whichsys.c32 -iso- config iso.cfg -sys- sys.cfg -pxe- pxe.cfg >+ * >+ */ >+ >+#include <stdio.h> >+#include <alloca.h> >+#include <console.h> >+#include <string.h> >+#include <syslinux/boot.h> >+#include "syslinux/config.h" >+ >+ >+static struct syslinux_parameter { >+ char **arg[1]; >+ bool option; >+} isolinux, pxelinux, syslinux; >+ >+/* XXX: this really should be librarized */ >+static void boot_args(char **args) >+{ >+ int len = 0, a = 0; >+ char **pp; >+ const char *p; >+ char c, *q, *str; >+ >+ for (pp = args; *pp; pp++) >+ len += strlen(*pp) + 1; >+ >+ q = str = alloca(len); >+ for (pp = args; *pp; pp++) { >+ p = *pp; >+ while ((c = *p++)) >+ *q++ = c; >+ *q++ = ' '; >+ a = 1; >+ } >+ q -= a; >+ *q = '\0'; >+ >+ if (!str[0]) >+ syslinux_run_default(); >+ else >+ syslinux_run_command(str); >+} >+ >+static void usage(void) >+{ >+ static const char usage[] = "\ >+Usage: whichsys.c32 [-iso- command] [-pxe- command] [-sys- command]\n\ >+Examples: whichsys.c32 -iso- chain.c32 hd0 -sys- chain.c32 hd1 swap\n\ >+ whichsys.c32 -iso- config iso.cfg -sys- sys.cfg -pxe- pxe.cfg\n"; >+ fprintf(stderr, usage); >+} >+ >+int main(int argc, char *argv[]) >+{ >+ const union syslinux_derivative_info *sdi; >+ >+ int arg = 0; >+ >+ openconsole(&dev_null_r, &dev_stdcon_w); >+ >+ /* If no argument got passed, let's show the usage */ >+ if (argc == 1) { >+ usage(); >+ return 0; >+ } >+ >+ arg++; >+ >+ while (arg < argc) { >+ if (!strcmp(argv[arg], "-iso-")) { >+ argv[arg] = NULL; >+ isolinux.arg[0] = &argv[arg + 1]; >+ isolinux.option = true; >+ } >+ if (!strcmp(argv[arg], "-pxe-")) { >+ argv[arg] = NULL; >+ pxelinux.arg[0] = &argv[arg + 1]; >+ pxelinux.option = true; >+ } >+ if (!strcmp(argv[arg], "-sys-")) { >+ argv[arg] = NULL; >+ syslinux.arg[0] = &argv[arg + 1]; >+ syslinux.option = true; >+ } >+ arg++; >+ } >+ >+ sdi = syslinux_derivative_info(); >+ >+ switch (sdi->c.filesystem) { >+ case SYSLINUX_FS_ISOLINUX: >+ isolinux.option ? boot_args(isolinux.arg[0]) : fprintf(stderr, "No command specified for ISOLINUX.\n\n"); usage(); >+ break; >+ case SYSLINUX_FS_PXELINUX: >+ pxelinux.option ? boot_args(pxelinux.arg[0]) : fprintf(stderr, "No command specified for PXELINUX.\n\n"); usage(); >+ break; >+ case SYSLINUX_FS_SYSLINUX: >+ syslinux.option ? boot_args(syslinux.arg[0]) : fprintf(stderr, "No command specified for SYSLINUX.\n\n"); usage(); >+ break; >+ case SYSLINUX_FS_UNKNOWN: >+ default: >+ fprintf(stderr, "Unknown Syslinux filesystem\n\n"); >+ } >+ >+ return -1; >+} >-- >1.7.4.5 > >From fd4d6e5845b9b84b25850bb2a908a23f7bb0c9de Mon Sep 17 00:00:00 2001 >From: Gert Hulselmans <gerth@zytor.com> >Date: Tue, 13 Jul 2010 00:26:09 +0200 >Subject: [PATCH] whichsys.c32: Fix example in the comments and Usage output > >Fix example in the comments and Usage output. > >Signed-off-by: Gert Hulselmans <gerth@zytor.com> >--- > com32/modules/whichsys.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > >diff --git a/com32/modules/whichsys.c b/com32/modules/whichsys.c >index c186722..af133f2 100644 >--- a/com32/modules/whichsys.c >+++ b/com32/modules/whichsys.c >@@ -18,7 +18,7 @@ > * > * Usage: whichsys.c32 [-iso- command] [-pxe- command] [-sys- command] > * Examples: whichsys.c32 -iso- chain.c32 hd0 -sys- chain.c32 hd1 swap >- * whichsys.c32 -iso- config iso.cfg -sys- sys.cfg -pxe- pxe.cfg >+ * whichsys.c32 -iso- config iso.cfg -pxe- config pxe.cfg > * > */ > >@@ -68,7 +68,7 @@ static void usage(void) > static const char usage[] = "\ > Usage: whichsys.c32 [-iso- command] [-pxe- command] [-sys- command]\n\ > Examples: whichsys.c32 -iso- chain.c32 hd0 -sys- chain.c32 hd1 swap\n\ >- whichsys.c32 -iso- config iso.cfg -sys- sys.cfg -pxe- pxe.cfg\n"; >+ whichsys.c32 -iso- config iso.cfg -pxe- config pxe.cfg\n"; > fprintf(stderr, usage); > } > >-- >1.7.4.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 25663
:
4952
|
4953
|
4955