From:	SMTP%"carl@SOL1.GPS.CALTECH.EDU"  6-JUN-1994 10:23:22.93
To:	EVERHART
CC:	
Subj:	Re: Has anyone written a "getpass()" for VAXC?

From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick)
X-Newsgroups: comp.os.vms
Subject: Re: Has anyone written a "getpass()" for VAXC?
Date: 1 Jun 1994 03:24:26 GMT
Organization: HST Wide Field/Planetary Camera
Lines: 41
Distribution: world
Message-Id: <2sgv1a$qpu@gap.cco.caltech.edu>
Reply-To: carl@SOL1.GPS.CALTECH.EDU
Nntp-Posting-Host: sol1.gps.caltech.edu
To: Info-VAX@CRVAX.SRI.COM
X-Gateway-Source-Info: USENET

In article <york.11.2DEBDBA8@neptune.ece.syr.edu>, york@neptune.ece.syr.edu (Kevin B. York) writes:
=	Has anyone written a System-V style "getpass()" function for VAXC?

#include stdio
#include descrip
#include iodef

char *getpass(char *prompt)
{	static char string[65];
	$DESCRIPTOR(devnam, "TT");
	unsigned short chan, iosb[4];
	unsigned long stat;
	char *retval;

	if(((stat = SYS$ASSIGN(&devnam, &chan, 0, 0)) & 7) != 1) return NULL;
	if(((stat = SYS$QIOW(0, chan, IO$_WRITEVBLK | IO$M_NOECHO, iosb, 0, 0,
		prompt, strlen(prompt), 0, 0, 0, 0, 0, 0)) & 7) != 1)
		retval = (char *) NULL;
	else if((iosb[0] & 7) != 1)
		retval = (char *) NULL;
	else
	{	if(((stat = SYS$QIOW(0, chan, IO$_READVBLK | IO$M_NOECHO, iosb,
			0, 0, string, 64, 0, 0, 0, 0, 0, 0)) & 7) != 1)
			retval = (char *) NULL;
		else if((iosb[0] & 7) != 1)
			retval = (char *) NULL;
		{	string[iosb[1]] = '\0';
			retval = string;
		}
	}
	SYS$DASSGN(chan);
	return retval;
}
--------------------------------------------------------------------------------
Carl J Lydick | INTERnet: CARL@SOL1.GPS.CALTECH.EDU | NSI/HEPnet: SOL1::CARL

Disclaimer:  Hey, I understand VAXen and VMS.  That's what I get paid for.  My
understanding of astronomy is purely at the amateur level (or below).  So
unless what I'm saying is directly related to VAX/VMS, don't hold me or my
organization responsible for it.  If it IS related to VAX/VMS, you can try to
hold me responsible for it, but my organization had nothing to do with it.

