Deleted Added
sdiff udiff text old ( 238431 ) new ( 244158 )
full compact
1\ Copyright (c) 2006-2011 Devin Teske <dteske@FreeBSD.org>
2\ All rights reserved.
3\
4\ Redistribution and use in source and binary forms, with or without
5\ modification, are permitted provided that the following conditions
6\ are met:
7\ 1. Redistributions of source code must retain the above copyright
8\ notice, this list of conditions and the following disclaimer.
9\ 2. Redistributions in binary form must reproduce the above copyright

--- 7 unchanged lines hidden (view full) ---

17\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23\ SUCH DAMAGE.
24\
25\ $FreeBSD: head/sys/boot/forth/check-password.4th 238431 2012-07-14 01:45:35Z dteske $
26
27marker task-check-password.4th
28
29include /boot/screen.4th
30
3113 constant enter_key \ The decimal ASCII value for Enter key
328 constant bs_key \ The decimal ASCII value for Backspace key
3316 constant readmax \ Maximum number of characters for the password

--- 35 unchanged lines hidden (view full) ---

69 dup bs_key = if exit then
70 dup enter_key = if exit then
71
72 then
73 50 ms \ Sleep for 50 milliseconds (see loader(8))
74 again
75;
76
77: read ( -- String prompt )
78
79 0 25 at-xy \ Move the cursor to the bottom-left
80 dup 1+ read-start ! \ Store X offset after the prompt
81 read-start @ readX ! \ copy value to the current X offset
82 0 readlen ! \ Initialize the read length
83 type \ Print the prompt
84
85 begin \ Loop forever

--- 43 unchanged lines hidden (view full) ---

129
130 drop \ drop the last key that was entered
131
132 again \ Enter was not pressed; repeat
133;
134
135: check-password ( -- )
136
137 \ Exit if a password was not set
138 s" password" getenv dup -1 = if
139 drop exit
140 then
141
142 begin \ Loop as long as it takes to get the right password
143
144 s" Password: " \ Output a prompt for a password
145 read \ Read the user's input until Enter
146
147 2dup readval readlen @ compare 0= if
148 2drop exit \ Correct password
149 then
150
151 \ Bad Password
152 3000 ms
153 ." loader: incorrect password" 10 emit
154
155 again \ Not the right password; repeat
156;