From:	SMTP%"carl@SOL1.GPS.CALTECH.EDU"  9-JUN-1994 14:37:12.16
To:	EVERHART
CC:	
Subj:	Re: Get username from uaf

From: carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick)
X-Newsgroups: comp.os.vms
Subject: Re: Get username from uaf
Date: 9 Jun 1994 01:47:44 GMT
Organization: HST Wide Field/Planetary Camera
Lines: 47
Distribution: world
Message-ID: <2t5sc0$m0s@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 <1994Jun7.191823.4598@ifwb.wupper.de>, AW@WNVAX.WUPPER.DE (Andreas W. Wylach) writes:
=Hi everybody,
=
=Is someone out there who can give me an example in VAXC looking
=for a username in the uaf, if it is in there or not.
=I'm looking for a example comparing a given username with the usernames 
=in the sysuaf file.
=Maybe this question is a littlebit dummy,  I do not have any description
=of the uafdef.h or any rtl manuals.

Actually, for what you're asking about, the on-line help suffices.  Here's a
program to do that:

#include ssdef
#include rmsdef
#include descrip
main(int nargs, char **args)
{	$DESCRIPTOR(usrnam, "");
	struct ITEM_LIST_3
	{	unsigned short buflen, itmcod;
		unsigned long rsladr, bufadr;
	} itmlst[] = { 0, 0, 0, 0};
	long null = 0, stat, i;

	if(nargs < 2)
		SYS$EXIT(SS$_INSFARG);
	while(--nargs > 0)
	{	usrnam.dsc$a_pointer = *++args;
		usrnam.dsc$w_length = strlen(*args);
		stat = SYS$GETUAI(0, 0, &usrnam, &null, 0, 0, 0);
		if (((stat & 7) == 1) || (stat == SS$_NOGRPPRV) || (stat ==
			SS$_NOSYSPRV))
			printf("%s exists.\n", *args);
		else if (stat == RMS$_RNF)
			printf("%s doesn't exist.\n", *args);
		else
			printf("Error %%X%08X accessing SYSUAF\n", stat);
	}
}
--------------------------------------------------------------------------------
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.

