Sebastian Herbszt
2008-Jul-19 19:54 UTC
[syslinux] [PATCH] ethersel: use library functions
Replace get_config() and execute() with syslinux_config_file() and syslinux_run_command(). - Sebastian Index: syslinux-3.71-pre14-8-gb8f5d7d/com32/modules/ethersel.c ==================================================================--- syslinux-3.71-pre14-8-gb8f5d7d.orig/com32/modules/ethersel.c 2008-07-18 19:45:15.000000000 +0200 +++ syslinux-3.71-pre14-8-gb8f5d7d/com32/modules/ethersel.c 2008-07-19 00:25:59.000000000 +0200 @@ -35,6 +35,8 @@ #include <console.h> #include <sys/pci.h> #include <com32.h> +#include <syslinux/boot.h> +#include <syslinux/config.h> #ifdef DEBUG # define dprintf printf @@ -42,17 +44,6 @@ # define dprintf(...) ((void)0) #endif -static const char * -get_config(void) -{ - static com32sys_t r; - - r.eax.w[0] = 0x000E; - __intcall(0x22, &r, &r); - - return MK_PTR(r.es, r.ebx.w[0]); -} - static char * skipspace(char *p) { @@ -139,7 +130,7 @@ struct match *m; if ( !filename ) - filename = get_config(); + filename = syslinux_config_file(); f = fopen(filename, "r"); if ( !f ) @@ -198,19 +189,6 @@ return list; } -static void __attribute__((noreturn)) -execute(const char *cmdline) -{ - static com32sys_t ireg; - - strcpy(__com32.cs_bounce, cmdline); - ireg.eax.w[0] = 0x0003; /* Run command */ - ireg.ebx.w[0] = OFFS(__com32.cs_bounce); - ireg.es = SEG(__com32.cs_bounce); - __intcall(0x22, &ireg, NULL); - exit(255); /* Shouldn't return */ -} - int main(int argc, char *argv[]) { struct match *list, *match; @@ -225,7 +203,7 @@ match = find_pci_device(&pci_device_list,list); if ( match ) - execute(match->filename); + syslinux_run_command(match->filename); /* On error, return to the command line */ fputs("Error: no recognized network card found!\n", stderr);