getprotoname.c (1574) | getprotoname.c (17141) |
---|---|
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 --- 34 unchanged lines hidden (view full) --- 43struct protoent * 44getprotobyname(name) 45 register const char *name; 46{ 47 register struct protoent *p; 48 register char **cp; 49 50 setprotoent(_proto_stayopen); | 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 --- 34 unchanged lines hidden (view full) --- 43struct protoent * 44getprotobyname(name) 45 register const char *name; 46{ 47 register struct protoent *p; 48 register char **cp; 49 50 setprotoent(_proto_stayopen); |
51 while (p = getprotoent()) { | 51 while ( (p = getprotoent()) ) { |
52 if (strcmp(p->p_name, name) == 0) 53 break; 54 for (cp = p->p_aliases; *cp != 0; cp++) 55 if (strcmp(*cp, name) == 0) 56 goto found; 57 } 58found: 59 if (!_proto_stayopen) 60 endprotoent(); 61 return (p); 62} | 52 if (strcmp(p->p_name, name) == 0) 53 break; 54 for (cp = p->p_aliases; *cp != 0; cp++) 55 if (strcmp(*cp, name) == 0) 56 goto found; 57 } 58found: 59 if (!_proto_stayopen) 60 endprotoent(); 61 return (p); 62} |