Better NOESCAPE; handle comments without space (too common a mistake)
authorhpa <hpa>
Thu, 18 Aug 2005 23:43:02 +0000 (23:43 +0000)
committerhpa <hpa>
Thu, 18 Aug 2005 23:43:02 +0000 (23:43 +0000)
NEWS
abort.inc
keywords
keywords.inc
parsecmd.inc
parseconfig.inc
ui.inc

diff --git a/NEWS b/NEWS
index a19fd68..54a880b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Changes in 3.10:
        * New API call to query features.
        * Fix for bug in EBIOS code discovered by Arwin Vosselman.
        * NOESCAPE security fix.
+       * Comments are now recognized even without a space following #.
 
 Changes in 3.09:
        * gcc4 compilation fix.
index 25598d3..850a266 100644 (file)
--- a/abort.inc
+++ b/abort.inc
@@ -61,10 +61,8 @@ abort_check:
                sti
                 call cwritestr                  ; Expects SI -> error msg
 
-               ; If NOESCAPE is active, then execute the default command
-               cmp byte [KbdFlagMask],0
-               jz auto_boot                    ; Default command
-               jmp enter_command               ; Otherwise command prompt
+               ; Return to the command prompt
+               jmp enter_command
 
 ;
 ; End of abort_check
index 155a4e1..1fa8c9c 100644 (file)
--- a/keywords
+++ b/keywords
@@ -1,4 +1,3 @@
-# hash
 menu
 append
 default
index 6f68554..e880154 100644 (file)
@@ -44,7 +44,6 @@ keywd_size    equ 8   ; Bytes per keyword
                align 4, db 0
 
 keywd_table:
-               keyword hash,      pc_comment
                keyword menu,      pc_comment
                keyword append,    pc_append
                keyword default,   pc_default
@@ -62,7 +61,7 @@ keywd_table:
                keyword ontimeout, pc_ontimeout
                keyword onerror,   pc_onerror
                keyword allowoptions, pc_setint16, AllowOptions
-               keyword noescape,  pc_noescape
+               keyword noescape,  pc_setint16, NoEscape
                keyword f1,        pc_fkey,     FKeyName+(0<<FILENAME_MAX_LG2)
                keyword f2,        pc_fkey,     FKeyName+(1<<FILENAME_MAX_LG2)
                keyword f3,        pc_fkey,     FKeyName+(2<<FILENAME_MAX_LG2)
index 8d0de95..65a58ad 100644 (file)
@@ -36,6 +36,10 @@ getcommand:
                jz .eof                 ; End of file
                jc .find                ; End of line: try again
 
+               ; Do this explicitly so #foo is treated as a comment
+               cmp al,'#'              ; Leading hash mark -> comment
+               je .skipline
+
                or al,20h               ; Convert to lower case
                movzx ebx,al            ; Hash for a one-char keyword
 .read_loop:
index 1e5ff5f..32e84be 100644 (file)
@@ -276,13 +276,6 @@ pc_say:            call pc_getline                 ; "say" command
                jmp crlf                        ; tailcall
 
 ;
-; "noescape" command
-;
-pc_noescape:
-               mov byte [KbdFlagMask],0        ; No escape route available...
-               ; Fall into pc_getline
-
-;
 ; Comment line
 ;
 pc_comment:    ; Fall into pc_getline
@@ -359,6 +352,7 @@ OnerrorLen  dw 0                    ; Bytes in onerror command
 KbdTimeOut      dw 0                    ; Keyboard timeout (if any)
 CmdLinePtr     dw cmd_line_here        ; Command line advancing pointer
 ForcePrompt    dw 0                    ; Force prompt
+NoEscape       dw 0                    ; No escape
 AllowImplicit   dw 1                    ; Allow implicit kernels
 AllowOptions   dw 1                    ; User-specified options allowed
 SerialPort     dw 0                    ; Serial port base (or 0 for no serial port)
diff --git a/ui.inc b/ui.inc
index 968f778..92bf498 100644 (file)
--- a/ui.inc
+++ b/ui.inc
@@ -20,13 +20,15 @@ no_config_file:
 ; Check whether or not we are supposed to display the boot prompt.
 ;
 check_for_key:
-               cmp word [ForcePrompt],byte 0   ; Force prompt?
+               cmp word [ForcePrompt],0        ; Force prompt?
                jnz enter_command
-               mov al,[KbdFlags]
-               test al,[KbdFlagMask]
+               test byte [KbdFlags],5Bh        ; Shift Alt Caps Scroll
                jz auto_boot                    ; If neither, default boot
 
 enter_command:
+               cmp word [NoEscape],0           ; If NOESCAPE, no prompt,
+               je auto_boot                    ; always run default cmd
+
                mov si,boot_prompt
                call cwritestr
 
@@ -183,12 +185,20 @@ fk_wrcmd:
                call cwritestr                  ; Write command line so far
 fk_nofile:     pop di
                jmp short get_char_2
+
+;
+; Jump here to run the default command line
+;
 auto_boot:
                mov si,default_cmd
                mov di,command_line
                mov cx,(max_cmd_len+4) >> 2
                rep movsd
                jmp short load_kernel
+
+;
+; Jump here when the command line is completed
+;
 command_done:
                call crlf
                cmp di,command_line             ; Did we just hit return?
@@ -486,9 +496,6 @@ kernel_good:
 %endif
                ; Otherwise Linux kernel
 
-               section .data
-KbdFlagMask    db 5Bh                  ; Caps, Scroll, Shift, Alt
-
                section .bss
                alignb 2
 KernelExtPtr   resw 1                  ; During search, final null pointer