Date: Mon, 23 Mar 2015 16:22:57 +0000 (UTC) From: Devin Teske <dteske@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280382 - head/sys/boot/forth Message-ID: <201503231622.t2NGMvY8065146@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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@FreeBSD.org> +\ Copyright (c) 2006-2015 Devin Teske <dteske@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 ;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201503231622.t2NGMvY8065146>