diff options
author | Matt Fleming <matt.fleming@intel.com> | 2012-12-07 11:33:45 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2012-12-07 11:33:45 +0000 |
commit | 10f6cf6eef0a7da7dad1933efdbfb101155792d0 (patch) | |
tree | d8ee3bfc6e55e739e0f135cd6d945955c670dd46 /com32/elflink | |
parent | 35928ee37da523e5f992cc462a4a4193d0bfaa4c (diff) | |
parent | ddb10ce99c327888ade4d2ba3e4c50ad12aaa059 (diff) | |
download | syslinux-10f6cf6eef0a7da7dad1933efdbfb101155792d0.tar.gz syslinux-10f6cf6eef0a7da7dad1933efdbfb101155792d0.tar.xz syslinux-10f6cf6eef0a7da7dad1933efdbfb101155792d0.zip |
Merge tag 'syslinux-5.00' into firmwaresyslinux-6.00-pre3
Conflicts:
Makefile
com32/elflink/ldlinux/Makefile
com32/lib/sys/module/elf_module.c
core/cleanup.c
core/comboot.inc
core/conio.c
core/fs/fs.c
core/init.c
core/mem/free.c
core/mem/malloc.c
core/timer.inc
diag/geodsp/Makefile
extlinux/main.c
mk/embedded.mk
modules/Makefile
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'com32/elflink')
-rw-r--r-- | com32/elflink/ldlinux/Makefile | 5 | ||||
-rw-r--r-- | com32/elflink/ldlinux/adv.c | 4 | ||||
-rw-r--r-- | com32/elflink/ldlinux/advwrite.c | 3 | ||||
-rw-r--r-- | com32/elflink/ldlinux/chainboot.c | 4 | ||||
-rw-r--r-- | com32/elflink/ldlinux/cli.c | 44 | ||||
-rw-r--r-- | com32/elflink/ldlinux/config.h | 2 | ||||
-rw-r--r-- | com32/elflink/ldlinux/execute.c | 32 | ||||
-rw-r--r-- | com32/elflink/ldlinux/get_key.c | 2 | ||||
-rw-r--r-- | com32/elflink/ldlinux/getadv.c | 2 | ||||
-rw-r--r-- | com32/elflink/ldlinux/ldlinux.c | 85 | ||||
-rw-r--r-- | com32/elflink/ldlinux/msg.c | 214 | ||||
-rw-r--r-- | com32/elflink/ldlinux/readconfig.c | 33 | ||||
-rw-r--r-- | com32/elflink/ldlinux/setadv.c | 2 |
13 files changed, 332 insertions, 100 deletions
diff --git a/com32/elflink/ldlinux/Makefile b/com32/elflink/ldlinux/Makefile index 7da6e287..aa35f475 100644 --- a/com32/elflink/ldlinux/Makefile +++ b/com32/elflink/ldlinux/Makefile @@ -13,18 +13,19 @@ VPATH = $(SRC) include $(MAKEDIR)/elf.mk -CFLAGS += -I$(topdir)/core/elflink -I$(topdir)/core/include -I$(topdir)/com32/lib +CFLAGS += -I$(topdir)/core/elflink -I$(topdir)/core/include -I$(topdir)/com32/lib -fvisibility=hidden LIBS = --whole-archive $(objdir)/com32/lib/libcom32min.a OBJS = ldlinux.o cli.o readconfig.o refstr.o colors.o getadv.o adv.o \ execute.o chainboot.o kernel.o get_key.o advwrite.o setadv.o \ - eprintf.o loadhigh.o + eprintf.o loadhigh.o msg.o all: ldlinux.c32 ldlinux_lnx.a ldlinux.c32 : $(OBJS) $(LD) $(LDFLAGS) -o $@ $^ $(LIBS) +LNXCFLAGS += -D__export='__attribute__((visibility("default")))' LNXLIBOBJS = get_key.lo ldlinux_lnx.a: $(LNXLIBOBJS) rm -f $@ diff --git a/com32/elflink/ldlinux/adv.c b/com32/elflink/ldlinux/adv.c index ae473908..677fe92d 100644 --- a/com32/elflink/ldlinux/adv.c +++ b/com32/elflink/ldlinux/adv.c @@ -35,8 +35,8 @@ #include <syslinux/firmware.h> #include <klibc/compiler.h> -void *__syslinux_adv_ptr; -size_t __syslinux_adv_size; +__export void *__syslinux_adv_ptr; +__export size_t __syslinux_adv_size; void __constructor __syslinux_init(void) { diff --git a/com32/elflink/ldlinux/advwrite.c b/com32/elflink/ldlinux/advwrite.c index 95a311a8..47e45534 100644 --- a/com32/elflink/ldlinux/advwrite.c +++ b/com32/elflink/ldlinux/advwrite.c @@ -31,10 +31,11 @@ * Write back the ADV */ +#include <klibc/compiler.h> #include <syslinux/adv.h> #include <syslinux/firmware.h> -int syslinux_adv_write(void) +__export int syslinux_adv_write(void) { return firmware->adv_ops->write(); } diff --git a/com32/elflink/ldlinux/chainboot.c b/com32/elflink/ldlinux/chainboot.c index 4a4a2e1a..ff19c530 100644 --- a/com32/elflink/ldlinux/chainboot.c +++ b/com32/elflink/ldlinux/chainboot.c @@ -54,10 +54,8 @@ void chainboot_file(const char *file, uint32_t type) goto bail; rv = open_file(file, &fd); - if (rv == -1) { - free(buf); + if (rv == -1) goto bail; - } reg.eax.l = max; reg.ebx.l = 0; diff --git a/com32/elflink/ldlinux/cli.c b/com32/elflink/ldlinux/cli.c index ebeaeece..b94c6835 100644 --- a/com32/elflink/ldlinux/cli.c +++ b/com32/elflink/ldlinux/cli.c @@ -119,12 +119,11 @@ static const char * cmd_reverse_search(int *cursor, clock_t *kbd_to, const char *edit_cmdline(const char *input, int top /*, int width */ , int (*pDraw_Menu) (int, int, int), - void (*show_fkey) (int)) + void (*show_fkey) (int), bool *timedout) { - static char cmdline[MAX_CMDLINE_LEN]; - char temp_cmdline[MAX_CMDLINE_LEN] = { }; + char cmdline[MAX_CMDLINE_LEN] = { }; int key, len, prev_len, cursor; - int redraw = 1; /* We enter with the menu already drawn */ + int redraw = 0; int x, y; bool done = false; const char *ret; @@ -139,12 +138,17 @@ const char *edit_cmdline(const char *input, int top /*, int width */ , width = 80; } - cmdline[MAX_CMDLINE_LEN - 1] = '\0'; - len = cursor = 0; prev_len = 0; x = y = 0; + /* + * Before we start messing with the x,y coordinates print 'input' + * so that it follows whatever text has been written to the screen + * previously. + */ + eprintf("%s ", input); + while (!done) { if (redraw > 1) { /* Clear and redraw whole screen */ @@ -154,6 +158,7 @@ const char *edit_cmdline(const char *input, int top /*, int width */ , if (pDraw_Menu) (*pDraw_Menu) (-1, top, 1); prev_len = 0; + eprintf("\033[2J\033[H"); // printf("\033[0m\033[2J\033[H"); } @@ -164,8 +169,6 @@ const char *edit_cmdline(const char *input, int top /*, int width */ , /* Redraw the command line */ eprintf("\033[?7l\033[?25l"); - if (y) - eprintf("\033[%dA", y); eprintf("\033[1G%s ", input); x = strlen(input); @@ -202,6 +205,7 @@ const char *edit_cmdline(const char *input, int top /*, int width */ , switch (key) { case KEY_NONE: /* We timed out. */ + *timedout = true; return NULL; case KEY_CTRL('L'): @@ -214,12 +218,6 @@ const char *edit_cmdline(const char *input, int top /*, int width */ , done = true; break; - case KEY_ESC: - case KEY_CTRL('C'): - ret = NULL; - done = true; - break; - case KEY_BACKSPACE: case KEY_DEL: if (cursor) { @@ -351,11 +349,9 @@ const char *edit_cmdline(const char *input, int top /*, int width */ , comm_counter = list_entry(next, typeof(*comm_counter), list); - if (&comm_counter->list == &cli_history_head) { - strcpy(cmdline, temp_cmdline); - } else { + if (&comm_counter->list != &cli_history_head) strcpy(cmdline, comm_counter->command); - } + cursor = len = strlen(cmdline); redraw = 1; } @@ -375,11 +371,9 @@ const char *edit_cmdline(const char *input, int top /*, int width */ , comm_counter = list_entry(prev, typeof(*comm_counter), list); - if (&comm_counter->list == &cli_history_head) { - strcpy(cmdline, temp_cmdline); - } else { + if (&comm_counter->list != &cli_history_head) strcpy(cmdline, comm_counter->command); - } + cursor = len = strlen(cmdline); redraw = 1; } @@ -435,9 +429,8 @@ const char *edit_cmdline(const char *input, int top /*, int width */ , default: if (key >= ' ' && key <= 0xFF && len < MAX_CMDLINE_LEN - 1) { if (cursor == len) { - temp_cmdline[len] = key; cmdline[len++] = key; - temp_cmdline[len] = cmdline[len] = '\0'; + cmdline[len] = '\0'; putchar(key); cursor++; x++; @@ -450,9 +443,6 @@ const char *edit_cmdline(const char *input, int top /*, int width */ , } else { memmove(cmdline + cursor + 1, cmdline + cursor, len - cursor + 1); - memmove(temp_cmdline + cursor + 1, temp_cmdline + cursor, - len - cursor + 1); - temp_cmdline[cursor] = key; cmdline[cursor++] = key; len++; redraw = 1; diff --git a/com32/elflink/ldlinux/config.h b/com32/elflink/ldlinux/config.h index 63e33b69..c551fb19 100644 --- a/com32/elflink/ldlinux/config.h +++ b/com32/elflink/ldlinux/config.h @@ -48,5 +48,7 @@ extern int new_linux_kernel(char *okernel, char *ocmdline); extern void pm_load_high(com32sys_t *regs); extern void ldlinux_enter_command(void); +extern void ldlinux_console_init(void); +extern const char *apply_extension(const char *kernel, const char *ext); #endif /* __CONFIG_H__ */ diff --git a/com32/elflink/ldlinux/execute.c b/com32/elflink/ldlinux/execute.c index 6ccde49d..727df50a 100644 --- a/com32/elflink/ldlinux/execute.c +++ b/com32/elflink/ldlinux/execute.c @@ -39,7 +39,6 @@ const struct image_types image_boot_types[] = { { "bss", IMAGE_TYPE_BSS }, { "pxe", IMAGE_TYPE_PXE }, { "fdimage", IMAGE_TYPE_FDIMAGE }, - { "comboot", IMAGE_TYPE_COMBOOT }, { "com32", IMAGE_TYPE_COM32 }, { "config", IMAGE_TYPE_CONFIG }, { NULL, 0 }, @@ -47,7 +46,7 @@ const struct image_types image_boot_types[] = { extern int create_args_and_load(char *); -void execute(const char *cmdline, uint32_t type) +__export void execute(const char *cmdline, uint32_t type) { const char *kernel, *args; const char *p; @@ -84,7 +83,17 @@ void execute(const char *cmdline, uint32_t type) const struct image_types *t; for (t = image_boot_types; t->name; t++) { if (!strcmp(kernel + 1, t->name)) { - /* Strip the type specifier and retry */ + /* + * Strip the type specifier, apply the + * filename extension if COM32 and + * retry. + */ + if (t->type == IMAGE_TYPE_COM32) { + p = apply_extension(p, ".c32"); + if (!p) + return; + } + execute(p, t->type); return; } @@ -92,8 +101,15 @@ void execute(const char *cmdline, uint32_t type) } if (type == IMAGE_TYPE_COM32) { + /* + * We may be called with the console in an unknown + * state, so initialise it. + */ + ldlinux_console_init(); + /* new entry for elf format c32 */ - create_args_and_load((char *)cmdline); + if (create_args_and_load((char *)cmdline)) + printf("Failed to load COM32 file %s\n", kernel); /* * The old COM32 module code would run the module then @@ -102,9 +118,14 @@ void execute(const char *cmdline, uint32_t type) * e.g. from vesamenu.c32. */ unload_modules_since("ldlinux.c32"); + + /* Restore the console */ + ldlinux_console_init(); + ldlinux_enter_command(); } else if (type == IMAGE_TYPE_CONFIG) { char *argv[] = { "ldlinux.c32", NULL }; + int rv; /* kernel contains the config file name */ realpath(ConfigName, kernel, FILENAME_MAX); @@ -113,7 +134,8 @@ void execute(const char *cmdline, uint32_t type) if (*args) mangle_name(config_cwd, args); - start_ldlinux(argv); + rv = start_ldlinux(argv); + printf("Failed to exec ldlinux.c32: %s\n", strerror(rv)); } else if (type == IMAGE_TYPE_LOCALBOOT) { local_boot(strtoul(kernel, NULL, 0)); } else if (type == IMAGE_TYPE_PXE || type == IMAGE_TYPE_BSS || diff --git a/com32/elflink/ldlinux/get_key.c b/com32/elflink/ldlinux/get_key.c index 123171ae..cece0f81 100644 --- a/com32/elflink/ldlinux/get_key.c +++ b/com32/elflink/ldlinux/get_key.c @@ -166,7 +166,7 @@ int raw_read(int fd, void *buf, size_t count) extern int raw_read(int fd, void *buf, size_t count); #endif -int get_key(FILE * f, clock_t timeout) +__export int get_key(FILE * f, clock_t timeout) { char buffer[KEY_MAXLEN]; int nc, rv; diff --git a/com32/elflink/ldlinux/getadv.c b/com32/elflink/ldlinux/getadv.c index 5578313e..1c27f1b8 100644 --- a/com32/elflink/ldlinux/getadv.c +++ b/com32/elflink/ldlinux/getadv.c @@ -36,7 +36,7 @@ #include <klibc/compiler.h> #include <inttypes.h> -const void *syslinux_getadv(int tag, size_t * size) +__export const void *syslinux_getadv(int tag, size_t * size) { const uint8_t *p; size_t left; diff --git a/com32/elflink/ldlinux/ldlinux.c b/com32/elflink/ldlinux/ldlinux.c index 59c55980..6f9f20fa 100644 --- a/com32/elflink/ldlinux/ldlinux.c +++ b/com32/elflink/ldlinux/ldlinux.c @@ -21,8 +21,6 @@ struct file_ext { }; static const struct file_ext file_extensions[] = { - { ".com", IMAGE_TYPE_COMBOOT }, - { ".cbt", IMAGE_TYPE_COMBOOT }, { ".c32", IMAGE_TYPE_COM32 }, { ".img", IMAGE_TYPE_FDIMAGE }, { ".bss", IMAGE_TYPE_BSS }, @@ -46,7 +44,7 @@ static inline const char *find_command(const char *str) return p; } -uint32_t parse_image_type(const char *kernel) +__export uint32_t parse_image_type(const char *kernel) { const struct file_ext *ext; const char *p; @@ -102,7 +100,7 @@ static const char *get_extension(const char *kernel) return NULL; } -static const char *apply_extension(const char *kernel, const char *ext) +const char *apply_extension(const char *kernel, const char *ext) { const char *p; char *k; @@ -121,12 +119,15 @@ static const char *apply_extension(const char *kernel, const char *ext) memcpy(k, kernel, len); /* Append the extension */ - memcpy(k + len, ext, elen); + if (strncmp(p - elen, ext, elen)) { + memcpy(k + len, ext, elen); + len += elen; + } /* Copy the rest of the command line */ - strcpy(k + len + elen, p); + strcpy(k + len, p); - k[len + elen + strlen(p)] = '\0'; + k[len + strlen(p)] = '\0'; return k; } @@ -138,7 +139,7 @@ static const char *apply_extension(const char *kernel, const char *ext) * the the kernel. If we return the caller should call enter_cmdline() * so that the user can help us out. */ -void load_kernel(const char *command_line) +__export void load_kernel(const char *command_line) { struct menu_entry *me; const char *cmdline; @@ -201,28 +202,14 @@ bad_kernel: * line. */ if (onerrorlen) { - rsprintf(&cmdline, "%s %s", onerror, default_cmd); - execute(cmdline, IMAGE_TYPE_COM32); - } -} - -static void enter_cmdline(void) -{ - const char *cmdline; - - /* Enter endless command line prompt, should support "exit" */ - while (1) { - cmdline = edit_cmdline("boot:", 1, NULL, cat_help_file); - printf("\n"); - - /* return if user only press enter or we timed out */ - if (!cmdline || cmdline[0] == '\0') { - if (ontimeoutlen) - load_kernel(ontimeout); - return; - } - - load_kernel(cmdline); + me = find_label(onerror); + if (me) + rsprintf(&cmdline, "%s %s", me->cmdline, default_cmd); + else + rsprintf(&cmdline, "%s %s", onerror, default_cmd); + + type = parse_image_type(cmdline); + execute(cmdline, type); } } @@ -241,10 +228,35 @@ void ldlinux_auto_boot(void) load_kernel(default_cmd); } +static void enter_cmdline(void) +{ + const char *cmdline; + + /* Enter endless command line prompt, should support "exit" */ + while (1) { + bool to = false; + + if (noescape) { + ldlinux_auto_boot(); + continue; + } + + cmdline = edit_cmdline("boot:", 1, NULL, cat_help_file, &to); + printf("\n"); + + /* return if user only press enter or we timed out */ + if (!cmdline || cmdline[0] == '\0') { + if (to && ontimeoutlen) + load_kernel(ontimeout); + else + ldlinux_auto_boot(); + } else + load_kernel(cmdline); + } +} + void ldlinux_enter_command(void) { - if (noescape) - ldlinux_auto_boot(); enter_cmdline(); } @@ -259,14 +271,19 @@ static void __destructor close_console(void) close(i); } -int main(int argc __unused, char **argv __unused) +void ldlinux_console_init(void) +{ + openconsole(&dev_stdcon_r, &dev_ansiserial_w); +} + +__export int main(int argc __unused, char **argv __unused) { const void *adv; const char *cmdline; size_t count = 0; char *config_argv[2] = { NULL, NULL }; - openconsole(&dev_stdcon_r, &dev_ansiserial_w); + ldlinux_console_init(); if (ConfigName[0]) config_argv[0] = ConfigName; diff --git a/com32/elflink/ldlinux/msg.c b/com32/elflink/ldlinux/msg.c new file mode 100644 index 00000000..2efcc792 --- /dev/null +++ b/com32/elflink/ldlinux/msg.c @@ -0,0 +1,214 @@ +#include <com32.h> +#include <stdio.h> +#include <bios.h> +#include <graphics.h> + +static uint8_t TextAttribute; /* Text attribute for message file */ +static uint8_t DisplayMask; /* Display modes mask */ + +/* Routine to interpret next print char */ +static void (*NextCharJump)(uint8_t); + +void msg_initvars(void); +static void msg_setfg(uint8_t data); +static void msg_putchar(uint8_t ch); + +/* + * + * get_msg_file: Load a text file and write its contents to the screen, + * interpreting color codes. + * + * Returns 0 on success, -1 on failure. + */ +int get_msg_file(char *filename) +{ + FILE *f; + char ch; + + f = fopen(filename, "r"); + if (!f) + return -1; + + TextAttribute = 0x7; /* Default grey on white */ + DisplayMask = 0x7; /* Display text in all modes */ + msg_initvars(); + + /* + * Read the text file a byte at a time and interpret that + * byte. + */ + while ((ch = getc(f)) != EOF) { + /* DOS EOF? */ + if (ch == 0x1A) + break; + + /* + * 01h = text mode + * 02h = graphics mode + */ + UsingVGA &= 0x1; + UsingVGA += 1; + + NextCharJump(ch); /* Do what shall be done */ + } + + fclose(f); + return 0; +} + +static void msg_setbg(uint8_t data) +{ + if (unhexchar(&data) == 0) { + data <<= 4; + if (DisplayMask & UsingVGA) { + TextAttribute = data; + } + + NextCharJump = msg_setfg; + } else { + TextAttribute = 0x7; /* Default attribute */ + NextCharJump = msg_putchar; + } +} + +static void msg_setfg(uint8_t data) +{ + if (unhexchar(&data) == 0) { + if (DisplayMask & UsingVGA) { + /* setbg set foreground to 0 */ + TextAttribute |= data; + } + } else + TextAttribute = 0x7; /* Default attribute */ + + NextCharJump = msg_putchar; +} + +static inline void msg_ctrl_o(void) +{ + NextCharJump = msg_setbg; +} + +static void msg_novga(void) +{ + syslinux_force_text_mode(); + msg_initvars(); +} + +static void msg_viewimage(void) +{ + FILE *f; + + *VGAFilePtr = '\0'; /* Zero-terminate filename */ + + mangle_name(VGAFileMBuf, VGAFileBuf); + f = fopen(VGAFileMBuf, "r"); + if (!f) { + /* Not there */ + NextCharJump = msg_putchar; + return; + } + + vgadisplayfile(f); + fclose(f); + msg_initvars(); +} + +/* + * Getting VGA filename + */ +static void msg_filename(uint8_t data) +{ + /* <LF> = end of filename */ + if (data == 0x0A) { + msg_viewimage(); + return; + } + + /* Ignore space/control char */ + if (data > ' ') { + if ((char *)VGAFilePtr < (VGAFileBuf + sizeof(VGAFileBuf))) + *VGAFilePtr++ = data; + } +} + +static void msg_vga(void) +{ + NextCharJump = msg_filename; + VGAFilePtr = (uint16_t *)VGAFileBuf; +} + +/* Convert ANSI colors to PC display attributes */ +static int convert_to_pcdisplay[] = { 0, 4, 2, 6, 1, 5, 3, 7 }; + +static void msg_normal(uint8_t data) +{ + uint8_t bg, fg; + + /* Write to serial port */ + if (DisplayMask & 0x4) + write_serial(data); + + if (!(DisplayMask & UsingVGA)) + return; /* Not screen */ + + if (!(DisplayCon & 0x01)) + return; + + fg = convert_to_pcdisplay[(TextAttribute & 0x7)]; + bg = convert_to_pcdisplay[((TextAttribute >> 4) & 0x7)]; + + printf("\033["); + if (TextAttribute & 0x40) + printf("1;"); /* Foreground bright */ + + printf("3%dm\033[", fg); + + if (TextAttribute & 0x80) + printf("5;"); /* Foreground blink */ + + printf("4%dm%c\033[0m", bg, data); +} + +static void msg_modectl(uint8_t data) +{ + data &= 0x07; + DisplayMask = data; + NextCharJump = msg_putchar; +} + +static void msg_putchar(uint8_t ch) +{ + /* 10h to 17h are mode controls */ + if (ch >= 0x10 && ch < 0x18) { + msg_modectl(ch); + return; + } + + switch (ch) { + case 0x0F: /* ^O = color code follows */ + msg_ctrl_o(); + break; + case 0x0D: /* Ignore <CR> */ + break; + case 0x19: /* <EM> = return to text mode */ + msg_novga(); + break; + case 0x18: /* <CAN> = VGA filename follows */ + msg_vga(); + break; + default: + msg_normal(ch); + break; + } +} + +/* + * Subroutine to initialize variables, also needed after loading + * graphics file. + */ +void msg_initvars(void) +{ + /* Initialize state machine */ + NextCharJump = msg_putchar; +} diff --git a/com32/elflink/ldlinux/readconfig.c b/com32/elflink/ldlinux/readconfig.c index 2fa0641e..6a419c6d 100644 --- a/com32/elflink/ldlinux/readconfig.c +++ b/com32/elflink/ldlinux/readconfig.c @@ -80,12 +80,13 @@ short includelevel = 1; //nesting level short defaultlevel = 0; //the current level of default short vkernel = 0; //have we seen any "label" statements? short displaycon = 1; //conio.inc -short nohalt = 1; //idle.inc +extern short NoHalt; //idle.c -const char *default_cmd = NULL; //"default" command line const char *onerror = NULL; //"onerror" command line const char *ontimeout = NULL; //"ontimeout" command line +__export const char *default_cmd = NULL; //"default" command line + /* Empty refstring */ const char *empty_string; @@ -599,7 +600,7 @@ uint32_t parse_argb(char **p) //static const char *append = NULL; extern const char *append; //static unsigned int ipappend = 0; -unsigned int ipappend = 0; +__export unsigned int ipappend = 0; extern uint16_t PXERetry; static struct labeldata ld; @@ -636,21 +637,7 @@ static char *is_message_name(char *cmdstr, enum message_number *msgnr) return NULL; } -static int cat_file(const char *filename) -{ - FILE *f; - char line[2048]; - - f = fopen(filename, "r"); - if (!f) - return -1; - - while (fgets(line, sizeof(line), f) != NULL) - eprintf("%s", line); - - fclose(f); - return 0; -} +extern void get_msg_file(char *); void cat_help_file(int key) { @@ -704,7 +691,7 @@ void cat_help_file(int key) if (cm->fkeyhelp[fkey].textname) { eprintf("\n"); - cat_file(cm->fkeyhelp[fkey].textname); + get_msg_file((char *)cm->fkeyhelp[fkey].textname); } } @@ -732,7 +719,7 @@ extern uint8_t FlowInput; extern uint8_t FlowOutput; extern uint16_t SerialPort; extern uint16_t BaudDivisor; -extern uint8_t SerialNotice; +static uint8_t SerialNotice = 1; #define DEFAULT_BAUD 9600 #define BAUD_DIVISOR 115200 @@ -748,7 +735,6 @@ static inline void io_delay(void) outb(0, 0x80); } -extern void get_msg_file(char *); extern void loadfont(char *); extern void loadkeys(char *); @@ -1196,7 +1182,7 @@ do_include: } else if (looking_at(p, "nocomplete")) { nocomplete = atoi(skipspace(p + 10)); } else if (looking_at(p, "nohalt")) { - nohalt = atoi(skipspace(p + 8)); + NoHalt = atoi(skipspace(p + 8)); } else if (looking_at(p, "onerror")) { refstr_put(m->onerror); m->onerror = refstrdup(skipspace(p + 7)); @@ -1368,7 +1354,8 @@ static int parse_one_config(const char *filename) parse_config_file(f); if (config_cwd[0]) { - chdir(config_cwd); + if (chdir(config_cwd) < 0) + printf("Failed to chdir to %s\n", config_cwd); config_cwd[0] = '\0'; } diff --git a/com32/elflink/ldlinux/setadv.c b/com32/elflink/ldlinux/setadv.c index 40f00a4e..2e386213 100644 --- a/com32/elflink/ldlinux/setadv.c +++ b/com32/elflink/ldlinux/setadv.c @@ -45,7 +45,7 @@ #include <errno.h> #include <alloca.h> -int syslinux_setadv(int tag, size_t size, const void *data) +__export int syslinux_setadv(int tag, size_t size, const void *data) { uint8_t *p, *advtmp; size_t rleft, left; |