Rebol Programming/input

= USAGE: = INPUT /hide

= DESCRIPTION: = Inputs a string from the console. New-line character is removed.

INPUT is a function value. = REFINEMENTS: =
 * /hide -- Mask input with a * character

= SOURCE CODE = input: func [ {Inputs a string from the console. New-line character is removed.} /hide "Mask input with a * character" /local console-port buffer char ignore ignore-chars ][   either hide [ console-port: open/binary [scheme: 'console] buffer: make string! 10        ignore: make binary! 10        ignore-chars: charset ["^@^["] while [ wait console-port char: to-char first console-port (char <> newline) and (char <> #"^M") ] [           any [ all [char = #"^H" either not empty? buffer [ clear back tail buffer prin ["^H ^H"] ] [true] true ]                all [find ignore-chars char read-io console-port ignore 3 true ]                all [append buffer char prin #"*" false ]           ]        ]         prin newline close console-port buffer ] [       pick system/ports/input 1 ] ]