summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-01-31 14:53:25 -0800
committerH. Peter Anvin <hpa@zytor.com>2009-01-31 14:53:25 -0800
commit83d6652a6233930eccf5973dccf10f0eba5af5b2 (patch)
tree9a2264ce1e97a178ced73f95a5832282b87b64a8
parentffb58825da075663f576232b589a0372f0a8d658 (diff)
downloadsyslinux-83d6652a6233930eccf5973dccf10f0eba5af5b2.tar.gz
Make sure we eat the input when ignoring a DEFAULT command
Make sure we eat the rest of the input line when we encounter a DEFAULT command that is to be ignored because we have a UI command already. Do this by making skipline a subroutine. Based on a patch by Sebastian Hebszt <herbszt@gmx.de>, although substantially modified.
-rw-r--r--core/parsecmd.inc18
-rw-r--r--core/parseconfig.inc6
2 files changed, 13 insertions, 11 deletions
diff --git a/core/parsecmd.inc b/core/parsecmd.inc
index edca0b7d..a7a00d5a 100644
--- a/core/parsecmd.inc
+++ b/core/parsecmd.inc
@@ -1,6 +1,6 @@
;; -----------------------------------------------------------------------
;;
-;; Copyright 1994-2008 H. Peter Anvin - All Rights Reserved
+;; Copyright 1994-2009 H. Peter Anvin - 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
@@ -29,6 +29,9 @@
; with CF = 1.
; -------------------------------------------------------------------------
+getcommand.skipline:
+ call skipline
+
getcommand:
.find:
call skipspace ; Skip leading whitespace
@@ -77,7 +80,7 @@ getcommand:
mov si,trackbuf
call writestr
call crlf
- jmp short .skipline
+ jmp .skipline
; No parameter
.noparm:
@@ -86,8 +89,7 @@ getcommand:
mov si,trackbuf
call writestr
call crlf
- mov al,10 ; Already at EOL
- jmp short .skipline
+ jmp .find
.found_keywd: lodsw ; Load argument into ax
call [si]
@@ -97,11 +99,11 @@ getcommand:
.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
diff --git a/core/parseconfig.inc b/core/parseconfig.inc
index fcf18d9c..d2c452b6 100644
--- a/core/parseconfig.inc
+++ b/core/parseconfig.inc
@@ -1,6 +1,6 @@
;; -----------------------------------------------------------------------
;;
-;; Copyright 1994-2008 H. Peter Anvin - All Rights Reserved
+;; Copyright 1994-2009 H. Peter Anvin - 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
@@ -21,12 +21,12 @@
; "default" or "ui" command, with level (1 = default, 2 = ui)
;
pc_default: cmp ax,[DefaultLevel]
- jb .skip
+ jb skipline ; == call skipline + ret
mov [DefaultLevel],ax
mov di,default_cmd
call getline
mov byte [di-1],0 ; null-terminate
-.skip: ret
+ ret
;
; "ontimeout" command