date and time created 82/08/25 21:54:12 by sam
authorSam Leffler <sam@ucbvax.Berkeley.EDU>
Thu, 26 Aug 1982 12:54:12 +0000 (04:54 -0800)
committerSam Leffler <sam@ucbvax.Berkeley.EDU>
Thu, 26 Aug 1982 12:54:12 +0000 (04:54 -0800)
SCCS-vsn: lib/libc/net/getprotoname.c 4.1

usr/src/lib/libc/net/getprotoname.c [new file with mode: 0644]

diff --git a/usr/src/lib/libc/net/getprotoname.c b/usr/src/lib/libc/net/getprotoname.c
new file mode 100644 (file)
index 0000000..30ca3d4
--- /dev/null
@@ -0,0 +1,23 @@
+/*     getprotoname.c  4.1     82/08/25        */
+
+#include <netdb.h>
+
+struct protoent *
+getprotoname(name)
+       register char *name;
+{
+       register struct protoent *p;
+       register char **cp;
+
+       setprotoent(0);
+       while (p = getprotoent()) {
+               if (strcmp(p->p_name, name) == 0)
+                       break;
+               for (cp = p->p_aliases; *cp != 0; cp++)
+                       if (strcmp(*cp, name) == 0)
+                               goto found;
+       }
+found:
+       endprotoent();
+       return (p);
+}