File:  [CSRG BSD Unix] / 43BSD / ingres / source / gutil / getufield.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:55 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43
BSD 4.3

# include	<sccs.h>

SCCSID(@(#)getufield.c	8.1	12/31/84)

/*
**  GETUFIELD -- extract field from users file
**
**	A buffer returned as the result of a getuser() (or getpw())
**	call is scanned for the indicated parameter, numbered from
**	zero.  A pointer to the parameter is returned.
*/

char *
getufield(buf, num)
char	*buf;
int	num;
{
	register char	c;
	register int	i;
	register char	*p;
	char		*r;

	p = buf;

	/* skip other fields */
	for (i = num; i > 0; i--)
	{
		while ((c = *p++) != 0)
			if (c == ':')
				break;
	}

	/* save result pointer */
	r = p;

	/* null-terminate this field */
	while ((c = *p++) != 0)
		if (c == ':')
			break;

	*--p = 0;

	return (r);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.