2 * pmap_set - set portmapper table from data produced by pmap_dump
4 * Author: Wietse Venema (wietse@wzv.win.tue.nl), dept. of Mathematics and
5 * Computing Science, Eindhoven University of Technology, The Netherlands.
10 static char sccsid[] = "@(#) pmap_set.c 1.1 92/06/11 22:53:16";
12 static const char rcsid[] =
18 #include <sys/types.h>
20 #include <netinet/in.h>
23 #include <rpc/pmap_clnt.h>
25 int parse_line __P((char *, u_long *, u_long *, int *, unsigned *));
32 struct sockaddr_in addr;
41 while (fgets(buf, sizeof(buf), stdin)) {
42 if (parse_line(buf, &prog, &vers, &prot, &port) == 0) {
43 warnx("malformed line: %s", buf);
46 if (pmap_set(prog, vers, prot, (unsigned short) port) == 0)
47 warnx("not registered: %s", buf);
52 /* parse_line - convert line to numbers */
55 parse_line(buf, prog, vers, prot, port)
62 char proto_name[BUFSIZ];
64 if (sscanf(buf, "%lu %lu %s %u", prog, vers, proto_name, port) != 4) {
67 if (strcmp(proto_name, "tcp") == 0) {
71 if (strcmp(proto_name, "udp") == 0) {
75 if (sscanf(proto_name, "%d", prot) == 1) {