USG_PG3/usr/source/sccsutil1/getlnm.c

Compare this file to the similar file:
Show the results in this format:

char getlnm_____[] "~|^`getlnm.c:	2.2";
/*
	Gets login name. Argument is optional, if not present
	the real user ID is used. Note that if the argument is
	present it must be an integer.
*/

getlnam(auid)
int auid;
{
	char pw[200];
	static int ouid;
	static char lnam[9];
	register int i,uid;
	if (nargs()==0) uid = getuid()&0377;
	else uid = auid;
	if (ouid!=uid || ouid==0) {
		if (getpw(uid,pw)) copy(stringf("%d",uid),lnam);
		else {
			for (i=0; i<8; i++) if ((lnam[i] = pw[i])==':') break;
			lnam[i] = '\0';
		}
		ouid = uid;
	}
	return(lnam);
}