syslog(LOG_ERR, "cannot bind udp: %m");
syslog(LOG_ERR, "cannot bind tcp: %m");
main(argc, argv)	int argc;	char **argv;{	SVCXPRT *xprt;	int sock, lsock, c;	struct sockaddr_in addr, laddr;	int on = 1;	int len = sizeof(struct sockaddr_in);	register struct pmaplist *pml;	while ((c = getopt(argc, argv, "d")) != EOF) {		switch (c) {		case 'd':			debugging = 1;			break;		default:			(void) fprintf(stderr, "usage: %s [-d]\n", argv[0]);			exit(1);		}	}	if (!debugging && daemon(0, 0)) {		(void) fprintf(stderr, "portmap: fork: %s", strerror(errno));		exit(1);	}	openlog("portmap", debugging ? LOG_PID | LOG_PERROR : LOG_PID,	    LOG_DAEMON);	bzero((char *)&addr, sizeof addr);	addr.sin_addr.s_addr = 0;	addr.sin_family = AF_INET;	addr.sin_addr.s_addr = htonl(INADDR_ANY);	addr.sin_port = htons(PMAPPORT);	bzero((char *)&laddr, sizeof laddr);	laddr.sin_addr.s_addr = 0;	laddr.sin_family = AF_INET;	laddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);	laddr.sin_port = htons(PMAPPORT);	if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {		syslog(LOG_ERR, "cannot create udp socket: %m");		exit(1);	}	setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof on);	if (bind(sock, (struct sockaddr *)&addr, len) != 0) {		syslog(LOG_ERR, "cannot bind udp: %m");		exit(1);	}	if ((xprt = svcudp_create(sock)) == (SVCXPRT *)NULL) {		syslog(LOG_ERR, "couldn't do udp_create");		exit(1);	}	if ((lsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {		syslog(LOG_ERR, "cannot create udp socket: %m");		exit(1);	}	setsockopt(lsock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof on);	if (bind(lsock, (struct sockaddr *)&laddr, len) != 0) {		syslog(LOG_ERR, "cannot bind udp: %m");		exit(1);	}	if ((ludpxprt = svcudp_create(lsock)) == (SVCXPRT *)NULL) {		syslog(LOG_ERR, "couldn't do udp_create");		exit(1);	}	/* make an entry for ourself */	pml = (struct pmaplist *)malloc((u_int)sizeof(struct pmaplist));	pml->pml_next = 0;	pml->pml_map.pm_prog = PMAPPROG;	pml->pml_map.pm_vers = PMAPVERS;	pml->pml_map.pm_prot = IPPROTO_UDP;	pml->pml_map.pm_port = PMAPPORT;	pmaplist = pml;	if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {		syslog(LOG_ERR, "cannot create tcp socket: %m");		exit(1);	}	setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof on);	if (bind(sock, (struct sockaddr *)&addr, len) != 0) {		syslog(LOG_ERR, "cannot bind udp: %m");		exit(1);	}	if ((xprt = svctcp_create(sock, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE))	    == (SVCXPRT *)NULL) {		syslog(LOG_ERR, "couldn't do tcp_create");		exit(1);	}	if ((lsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {		syslog(LOG_ERR, "cannot create tcp socket: %m");		exit(1);	}	setsockopt(lsock, SOL_SOCKET, SO_REUSEADDR, &on, sizeof on);	if (bind(lsock, (struct sockaddr *)&laddr, len) != 0) {		syslog(LOG_ERR, "cannot bind udp: %m");		exit(1);	}	if ((ltcpxprt = svctcp_create(lsock, RPCSMALLMSGSIZE,	    RPCSMALLMSGSIZE)) == (SVCXPRT *)NULL) {		syslog(LOG_ERR, "couldn't do tcp_create");		exit(1);	}	/* make an entry for ourself */	pml = (struct pmaplist *)malloc((u_int)sizeof(struct pmaplist));	pml->pml_map.pm_prog = PMAPPROG;	pml->pml_map.pm_vers = PMAPVERS;	pml->pml_map.pm_prot = IPPROTO_TCP;	pml->pml_map.pm_port = PMAPPORT;	pml->pml_next = pmaplist;	pmaplist = pml;	(void)svc_register(xprt, PMAPPROG, PMAPVERS, reg_service, FALSE);	(void)signal(SIGCHLD, reap);	svc_run();	syslog(LOG_ERR, "run_svc returned unexpectedly");	abort();}