1752798 Members
5894 Online
108789 Solutions
New Discussion юеВ

Re: Inquire password

 
SOLVED
Go to solution
Yyrkoon_
Advisor

Inquire password

Good morning all,

 

I am trying to make a DCL which inquire user name and password and I would like to show on the screen "*" or nothing instead the written password. Regretfully I have not found a way to do that despite I suppose it should not be difficult.

 

Can you, please, help me?

 

Thanks in advance.

4 REPLIES 4
Volker Halle
Honored Contributor
Solution

Re: Inquire password

Use SET TERMINAL/NOECHO to prevent echoing the user input on the passowrd question.

 

Volker.

Yyrkoon_
Advisor

Re: Inquire password

I knew it should be easy.

It does work perfect.

Many thanks.

Steven Schweda
Honored Contributor

Re: Inquire password

   If you haven't done it already, then you might wish to look at some
error handling ("ON ERROR" and/or "ON CONTROL_Y" -- See "HELP ON") to go
with that "SET TERMINAL [...]" action.  A carefree program combined with
a careless user can leave the user's terminal in a confusing state.

 

> I knew it should be easy.

   Everything's complicated.

 

> It does work perfect.

   Define "perfect".  You tried Ctrl/Y at your "password:" prompt?

John Gillings
Honored Contributor

Re: Inquire password

Unfortunately this isn't easy from DCL. You need to deal with saving and restoring the terminal state and unexpected stuff in the typeahead buffer. The safest way is to write a program to do it. The attachment is a small MACRO32 program which will prompt SYS$COMMAND for a password with no echo or typeahead, and it's timed out after 20 seconds. The password text is returned as a local symbol "PASSWORD" and any errors in $STATUS.

 

Rename the file to GETPASSWORD.MAR then:

 

$ MACRO GETPASSWORD

$ LINK GETPASSWORD

$ RUN GETPASSWORD

Password:

$ SHOW SYMBOL PASSWORD

  PASSWORD = "secret"

A crucible of informative mistakes