USG_PG3/usr/source/sccsutil2/pwldir.c

# define PWLDSZ 16
# define PWLDF "/usr/pw/ldf"

/*
 * Returns a pointer to the character string representing pw's
 * login directory.  This string is kept in /usr/pw/ldf.
 */

char *pwld___ "~|^`pwldir.c	1.1";

pwldir()
{
	register int i, j;
	register char *p;
	static char dir[PWLDSZ];

	if ((i=open(PWLDF,0))<0)
		return(0);
	if ((j=read(i,p=dir,PWLDSZ))<0) return(0);
	close(i);
	for (i=0; *p++!='\n' && ++i<=j; );
	*--p = '\0';
	return(dir);
}