getprotoent.c (213453) | getprotoent.c (254700) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#if defined(LIBC_SCCS) && !defined(lint) 31static char sccsid[] = "@(#)getprotoent.c 8.1 (Berkeley) 6/4/93"; 32#endif /* LIBC_SCCS and not lint */ 33#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#if defined(LIBC_SCCS) && !defined(lint) 31static char sccsid[] = "@(#)getprotoent.c 8.1 (Berkeley) 6/4/93"; 32#endif /* LIBC_SCCS and not lint */ 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/lib/libc/net/getprotoent.c 213453 2010-10-05 15:40:59Z ume $"); | 34__FBSDID("$FreeBSD: head/lib/libc/net/getprotoent.c 254700 2013-08-23 13:59:47Z jilles $"); |
35 36#include <sys/param.h> 37#include <sys/types.h> 38#include <sys/socket.h> 39#include <errno.h> 40#include <limits.h> 41#include <netdb.h> 42#include <nsswitch.h> --- 294 unchanged lines hidden (view full) --- 337 338 return (0); 339} 340 341void 342__setprotoent_p(int f, struct protoent_data *ped) 343{ 344 if (ped->fp == NULL) | 35 36#include <sys/param.h> 37#include <sys/types.h> 38#include <sys/socket.h> 39#include <errno.h> 40#include <limits.h> 41#include <netdb.h> 42#include <nsswitch.h> --- 294 unchanged lines hidden (view full) --- 337 338 return (0); 339} 340 341void 342__setprotoent_p(int f, struct protoent_data *ped) 343{ 344 if (ped->fp == NULL) |
345 ped->fp = fopen(_PATH_PROTOCOLS, "r"); | 345 ped->fp = fopen(_PATH_PROTOCOLS, "re"); |
346 else 347 rewind(ped->fp); 348 ped->stayopen |= f; 349} 350 351void 352__endprotoent_p(struct protoent_data *ped) 353{ --- 6 unchanged lines hidden (view full) --- 360 361int 362__getprotoent_p(struct protoent *pe, struct protoent_data *ped) 363{ 364 char *p; 365 char *cp, **q, *endp; 366 long l; 367 | 346 else 347 rewind(ped->fp); 348 ped->stayopen |= f; 349} 350 351void 352__endprotoent_p(struct protoent_data *ped) 353{ --- 6 unchanged lines hidden (view full) --- 360 361int 362__getprotoent_p(struct protoent *pe, struct protoent_data *ped) 363{ 364 char *p; 365 char *cp, **q, *endp; 366 long l; 367 |
368 if (ped->fp == NULL && (ped->fp = fopen(_PATH_PROTOCOLS, "r")) == NULL) | 368 if (ped->fp == NULL && (ped->fp = fopen(_PATH_PROTOCOLS, "re")) == NULL) |
369 return (-1); 370again: 371 if ((p = fgets(ped->line, sizeof ped->line, ped->fp)) == NULL) 372 return (-1); 373 if (*p == '#') 374 goto again; 375 cp = strpbrk(p, "#\n"); 376 if (cp != NULL) --- 178 unchanged lines hidden --- | 369 return (-1); 370again: 371 if ((p = fgets(ped->line, sizeof ped->line, ped->fp)) == NULL) 372 return (-1); 373 if (*p == '#') 374 goto again; 375 cp = strpbrk(p, "#\n"); 376 if (cp != NULL) --- 178 unchanged lines hidden --- |