getnetgrent.c (49435560cc988ecad06b5a161ae1abaa8670ec50) | getnetgrent.c (22626efa0f96cbca4edae882e46cb56b1879706b) |
---|---|
1/* 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 18 unchanged lines hidden (view full) --- 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. | 1/* 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 18 unchanged lines hidden (view full) --- 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. |
35 * 36 * $FreeBSD$ | |
37 */ 38 39#if defined(LIBC_SCCS) && !defined(lint) 40static char sccsid[] = "@(#)getnetgrent.c 8.2 (Berkeley) 4/27/95"; 41#endif /* LIBC_SCCS and not lint */ | 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) 38static char sccsid[] = "@(#)getnetgrent.c 8.2 (Berkeley) 4/27/95"; 39#endif /* LIBC_SCCS and not lint */ |
40#include <sys/cdefs.h> 41__FBSDID("$FreeBSD$"); |
|
42 43#include <stdio.h> 44#include <strings.h> 45#include <stdlib.h> 46#include <unistd.h> 47 48#ifdef YP 49/* --- 187 unchanged lines hidden (view full) --- 237} 238 239/* 240 * endnetgrent() - cleanup 241 */ 242void 243endnetgrent() 244{ | 42 43#include <stdio.h> 44#include <strings.h> 45#include <stdlib.h> 46#include <unistd.h> 47 48#ifdef YP 49/* --- 187 unchanged lines hidden (view full) --- 237} 238 239/* 240 * endnetgrent() - cleanup 241 */ 242void 243endnetgrent() 244{ |
245 register struct linelist *lp, *olp; 246 register struct netgrp *gp, *ogp; | 245 struct linelist *lp, *olp; 246 struct netgrp *gp, *ogp; |
247 248 lp = linehead; 249 while (lp) { 250 olp = lp; 251 lp = lp->l_next; 252 free(olp->l_groupname); 253 free(olp->l_line); 254 free((char *)olp); --- 151 unchanged lines hidden (view full) --- 406 407/* 408 * Parse the netgroup file setting up the linked lists. 409 */ 410static int 411parse_netgrp(group) 412 char *group; 413{ | 247 248 lp = linehead; 249 while (lp) { 250 olp = lp; 251 lp = lp->l_next; 252 free(olp->l_groupname); 253 free(olp->l_line); 254 free((char *)olp); --- 151 unchanged lines hidden (view full) --- 406 407/* 408 * Parse the netgroup file setting up the linked lists. 409 */ 410static int 411parse_netgrp(group) 412 char *group; 413{ |
414 register char *spos, *epos; 415 register int len, strpos; | 414 char *spos, *epos; 415 int len, strpos; |
416#ifdef DEBUG | 416#ifdef DEBUG |
417 register int fields; | 417 int fields; |
418#endif 419 char *pos, *gpos; 420 struct netgrp *grp; 421 struct linelist *lp = linehead; 422 423 /* 424 * First, see if the line has already been read in. 425 */ --- 91 unchanged lines hidden (view full) --- 517/* 518 * Read the netgroup file and save lines until the line for the netgroup 519 * is found. Return 1 if eof is encountered. 520 */ 521static struct linelist * 522read_for_group(group) 523 char *group; 524{ | 418#endif 419 char *pos, *gpos; 420 struct netgrp *grp; 421 struct linelist *lp = linehead; 422 423 /* 424 * First, see if the line has already been read in. 425 */ --- 91 unchanged lines hidden (view full) --- 517/* 518 * Read the netgroup file and save lines until the line for the netgroup 519 * is found. Return 1 if eof is encountered. 520 */ 521static struct linelist * 522read_for_group(group) 523 char *group; 524{ |
525 register char *pos, *spos, *linep, *olinep; 526 register int len, olen; | 525 char *pos, *spos, *linep, *olinep; 526 int len, olen; |
527 int cont; 528 struct linelist *lp; 529 char line[LINSIZ + 2]; 530#ifdef YP 531 char *result; 532 int resultlen; 533 534 while (_netgr_yp_enabled || fgets(line, LINSIZ, netf) != NULL) { --- 100 unchanged lines hidden --- | 527 int cont; 528 struct linelist *lp; 529 char line[LINSIZ + 2]; 530#ifdef YP 531 char *result; 532 int resultlen; 533 534 while (_netgr_yp_enabled || fgets(line, LINSIZ, netf) != NULL) { --- 100 unchanged lines hidden --- |