From 83d6652a6233930eccf5973dccf10f0eba5af5b2 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sat, 31 Jan 2009 14:53:25 -0800 Subject: 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 , although substantially modified. --- core/parsecmd.inc | 18 ++++++++++-------- core/parseconfig.inc | 6 +++--- 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 -- cgit v1.2.1