--- trunk/mkinitrd-magellan/isolinux/parsecmd.inc 2010/08/19 08:27:19 1132 +++ trunk/mkinitrd-magellan/isolinux/parsecmd.inc 2010/08/19 09:50:43 1133 @@ -1,7 +1,7 @@ -;; $Id: parsecmd.inc,v 1.1 2007-09-01 22:44:05 niro Exp $ ;; ----------------------------------------------------------------------- -;; -;; Copyright 1994-2002 H. Peter Anvin - All Rights Reserved +;; +;; Copyright 1994-2009 H. Peter Anvin - All Rights Reserved +;; Copyright 2009 Intel Corporation; author: H. Peter Anvin ;; ;; 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 @@ -30,6 +30,9 @@ ; with CF = 1. ; ------------------------------------------------------------------------- +getcommand.skipline: + call skipline + getcommand: .find: call skipspace ; Skip leading whitespace @@ -40,20 +43,25 @@ cmp al,'#' ; Leading hash mark -> comment je .skipline + ; Abuse the trackbuf by putting the keyword there for + ; possible error messaging... + mov di,trackbuf + stosb or al,20h ; Convert to lower case movzx ebx,al ; Hash for a one-char keyword .read_loop: - push ebx call getc - pop ebx jc .eof cmp al,' ' ; Whitespace jbe .done + stosb or al,20h rol ebx,5 xor bl,al jmp short .read_loop .done: call ungetc + xor ax,ax + stosb ; Null-terminate the trackbuf call skipspace jz .eof jc .noparm @@ -69,15 +77,20 @@ ; Otherwise unrecognized keyword mov si,err_badcfg - jmp short .error + call writestr + mov si,trackbuf + call writestr + call crlf + jmp .skipline ; No parameter .noparm: mov si,err_noparm - mov al,10 ; Already at EOL -.error: - call cwritestr - jmp short .skipline + call writestr + mov si,trackbuf + call writestr + call crlf + jmp .find .found_keywd: lodsw ; Load argument into ax call [si] @@ -87,21 +100,27 @@ .eof: stc ret -.skipline: cmp al,10 ; Search for LF - je .find +skipline: cmp al,10 ; Search for LF + je .end call getc - jc .eof - jmp short .skipline + jnc skipline +.end: ret + + section .data +err_badcfg db 'Unknown keyword in configuration file: ',0 +err_noparm db 'Missing parameter in configuration file. Keyword: ',0 - section .latebss + section .uibss alignb 4 vk_size equ (vk_end + 3) & ~3 VKernelBuf: resb vk_size ; "Current" vkernel AppendBuf resb max_cmd_len+1 ; append= Ontimeout resb max_cmd_len+1 ; ontimeout Onerror resb max_cmd_len+1 ; onerror + ; This could be in .uibss but that makes PXELINUX overflow + section .bss KbdMap resb 256 ; Keyboard map -FKeyName resb 10*FILENAME_MAX ; File names for F-key help +FKeyName resb MAX_FKEYS*FILENAME_MAX ; File names for F-key help KernelCNameLen resw 1 ; Length of unmangled kernel name InitRDCNameLen resw 1 ; Length of unmangled initrd name %if IS_SYSLINUX