Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : PWORD.ZIP
Filename : PASSGET.PRG

 
Output of file : PASSGET.PRG contained in archive : PWORD.ZIP
*.............................................................................
*
* Program Name: PASSGET.PRG Copyright: Automated Logic Systems
* Date Created: 08/16/90 Language: FoxPro
* Time Created: 10:08:20 Author: Brian Gardner
* /brief/library.src
*.............................................................................
* DESCRIPTION: This function is used to read a password that needs to remain
* invisible during the read. It allows the user to still see a
* place marker that shows how many letters have been typed,
* without actually showing the letters. Rather than the input
* characters being shown on screen, all input is simply displayed
* as CHR(254) (þ). It returns a string to the calling program
* consisting of the characters read, padded to the length
* specified by the word_lngth parameter.
*
* PARAMETERS: read_row - The row number where the read will occur
* read_col - The column number where the read will start
* word_lngth - An integer value expressing the length of the
* expression to be read.
* pas_colr - The color combination to be used for the read.
* Note that the color is taken from the GET
* color pair (2nd), if it is passed.
*
* RETURNS: The string entered by the user, padded to the length passed
* in the parameter.
*
* NOTE: FUNCTION RETURNS A NULL STRING IF THE USER ABORTS THE
* PASSWORD ENTRY PROCESS!
*
*.............................................................................

FUNCTION passget

PARAMETERS read_row,read_col,word_lngth,pas_colr

*----Define variables
rtrn_str = SPACE(word_lngth)
char_count = 0
curs_col = read_col
hld_clr = SET("COLOR")

*---Figure out the appropriate "cursor color" (blinking version of the
* color passed). Note that the color is taken from the GET color pair
* (2nd), if it is passed.
IF "," $ pas_colr
pas_colr = SUBSTR(pas_colr,AT(',',pas_colr)+1)
ENDIF
curs_colr = STUFF(pas_colr,AT('/',pas_colr),0,"*")

*---Display a "blank field"
SET COLOR TO &pas_colr
@read_row,read_col SAY SPACE(word_lngth)

*---Enter the main "reading" loop
DO WHILE .T.
*---A blinking ASCII "imitation" cursor is displayed at the appropriate
*---location
@read_row,curs_col SAY "" COLOR &curs_colr

get_char=INKEY(sysblnktme,"H") && Get a keypress

DO CASE && Figure out what to do with it

CASE BETWEEN(get_char,32,126) && A valid password character
*---Valid password characters are added to the string at the appropriate
*---location, the input indicator is displayed at the "cursor" loaction,
*---and the "cursor" is moved over one character.
rtrn_str = STUFF(rtrn_str,curs_col-read_col+1,1,CHR(get_char))
SET COLOR TO &pas_colr
@read_row,curs_col SAY "þ"
*---If the maximum word length has been reached, exit the loop, else
*---increment the cursor column
IF curs_col < read_col + word_lngth - 1
curs_col = curs_col + 1
ELSE
EXIT
ENDIF

CASE get_char=13 && RETURN key
*---USER PRESSES RETURN. EXIT READ LOOP & RETURN TO CALLING PROGRAM.
EXIT

CASE get_char=127 && Backspace key
*---BACKUP ONE CHARACTER, REPLACE IT WITH A SPACE, AND ERASE "INDICATOR"
rtrn_str = STUFF(rtrn_str,curs_col-read_col,1," ")
@read_row,curs_col SAY " "
IF curs_col > read_col
curs_col = curs_col - 1
ENDIF

CASE get_char=27 && Escape key
*---USER PRESSES ESCAPE, SHORTEN RETURN STRING TO A NULL & EXIT LOOP
rtrn_str = ''
EXIT

CASE get_char=28 && HELP key
* DO help routine here

CASE get_char=0
*---NO KEYBOARD INPUT. CALL SCREEN BLANKING ROUTINE.

OTHERWISE
*---IF INVALID KEY IS PRESSED, BEEP
?? CHR(7)

ENDCASE
ENDDO

*---RETURN THE PASSWORD TO THE CALLING PROGRAM
SET COLOR TO &hld_clr
RETURN (rtrn_str)


  3 Responses to “Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : PWORD.ZIP
Filename : PASSGET.PRG

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/