svn commit: r280382 - head/sys/boot/forth
Devin Teske
dteske at FreeBSD.org
Mon Mar 23 16:22:57 UTC 2015
Author: dteske
Date: Mon Mar 23 16:22:56 2015
New Revision: 280382
URL: https://svnweb.freebsd.org/changeset/base/280382
Log:
Fix sgetkey indentation to be consistent with the rest of the file.
Remove some blank lines, adjust some comments and update copyright.
MFC after: 3 days
X-MFC-to: stable/10 stable/9
Modified:
head/sys/boot/forth/check-password.4th
Modified: head/sys/boot/forth/check-password.4th
==============================================================================
--- head/sys/boot/forth/check-password.4th Mon Mar 23 16:04:04 2015 (r280381)
+++ head/sys/boot/forth/check-password.4th Mon Mar 23 16:22:56 2015 (r280382)
@@ -1,4 +1,4 @@
-\ Copyright (c) 2006-2012 Devin Teske <dteske at FreeBSD.org>
+\ Copyright (c) 2006-2015 Devin Teske <dteske at FreeBSD.org>
\ All rights reserved.
\
\ Redistribution and use in source and binary forms, with or without
@@ -48,33 +48,29 @@ variable readlen \ input length
\
: sgetkey ( -- )
- begin \ Loop forever
- key? if \ Was a key pressed? (see loader(8))
-
- drop \ Remove stack-cruft
- key \ Get the key that was pressed
-
- \ Check key pressed (see loader(8)) and input limit
- dup 0<> if ( and ) readlen @ readmax < if
-
- \ Echo an asterisk (unless Backspace/Enter)
- dup bs_key <> if ( and ) dup enter_key <> if
- ." *" \ Echo an asterisk
- then then
-
- exit \ Exit from the function
- then then
-
- \ Always allow Backspace and Enter
- dup bs_key = if exit then
- dup enter_key = if exit then
-
- then
- 50 ms \ Sleep for 50 milliseconds (see loader(8))
- again
+ begin \ Loop forever
+ key? if \ Was a key pressed? (see loader(8))
+ drop \ Remove stack-cruft
+ key \ Get the key that was pressed
+
+ \ Check key pressed (see loader(8)) and input limit
+ dup 0<> if ( and ) readlen @ readmax < if
+ \ Echo an asterisk (unless Backspace/Enter)
+ dup bs_key <> if ( and ) dup enter_key <> if
+ ." *" \ Echo an asterisk
+ then then
+ exit
+ then then
+
+ \ Always allow Backspace and Enter
+ dup bs_key = if exit then
+ dup enter_key = if exit then
+ then
+ 50 ms \ Sleep for 50 milliseconds (see loader(8))
+ again
;
-: read ( String prompt -- )
+: read ( c-addr/u -- ) \ Expects string prompt as stack input
0 25 at-xy \ Move the cursor to the bottom-left
dup 1+ read-start ! \ Store X offset after the prompt
@@ -127,8 +123,7 @@ variable readlen \ input length
then then
- drop \ drop the last key that was entered
-
+ drop \ last key pressed
again \ Enter was not pressed; repeat
;
More information about the svn-src-all
mailing list