From owner-svn-src-all@FreeBSD.ORG Mon Mar 23 16:22:57 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A024F7C7; Mon, 23 Mar 2015 16:22:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 725F9662; Mon, 23 Mar 2015 16:22:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t2NGMvUR065147; Mon, 23 Mar 2015 16:22:57 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t2NGMvY8065146; Mon, 23 Mar 2015 16:22:57 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201503231622.t2NGMvY8065146@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Mon, 23 Mar 2015 16:22:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r280382 - head/sys/boot/forth X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Mar 2015 16:22:57 -0000 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 +\ Copyright (c) 2006-2015 Devin Teske \ 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 ;