2 * pmap_dump - dump portmapper table in format readable by pmap_set
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_dump.c 1.1 92/06/11 22:53:15";
12 static const char rcsid[] =
13 "$FreeBSD: src/usr.sbin/portmap/pmap_dump/pmap_dump.c,v 1.6 2000/01/15 23:08:30 brian Exp $";
17 #include <sys/types.h>
19 #include <netinet/in.h>
20 #include <rpc/rpcent.h>
25 #include <rpc/pmap_clnt.h>
26 #include <rpc/pmap_prot.h>
28 static const char *protoname __P((u_long));
35 struct sockaddr_in addr;
36 register struct pmaplist *list;
37 register struct rpcent *rpc;
41 for (list = pmap_getmaps(&addr); list; list = list->pml_next) {
42 rpc = getrpcbynumber((int) list->pml_map.pm_prog);
43 printf("%10lu %4lu %5s %6lu %s\n",
44 list->pml_map.pm_prog,
45 list->pml_map.pm_vers,
46 protoname(list->pml_map.pm_prot),
47 list->pml_map.pm_port,
48 rpc ? rpc->r_name : "");
51 return (fclose(stdout) ? (perror(argv[0]), 1) : 0);
58 static char buf[BUFSIZ];
66 sprintf(buf, "%lu", proto);