goto bad;
usage(*argv);
flushroutes(int argc, char **argv){	size_t needed;	int mib[6], rlen, seqno;	char *buf = NULL, *next, *lim = NULL;	struct rt_msghdr *rtm;	struct sockaddr *sa;	if (uid)		errx(1, "must be root to alter routing table");	shutdown(s, 0); /* Don't want to read back our messages */	if (argc > 1) {		argv++;		if (argc == 2 && **argv == '-')		    switch (keyword(*argv + 1)) {			case K_INET:				af = AF_INET;				break;#ifdef INET6			case K_INET6:				af = AF_INET6;				break;#endif			case K_IPX:				af = AF_IPX;				break;			case K_LINK:				af = AF_LINK;				break;			case K_X25:				af = AF_CCITT;				break;			default:				goto bad;		} elsebad:			usage(*argv);	}	mib[0] = CTL_NET;	mib[1] = PF_ROUTE;	mib[2] = 0;		/* protocol */	mib[3] = 0;		/* wildcard address family */	mib[4] = NET_RT_DUMP;	mib[5] = 0;		/* no flags */	if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)		err(1, "route-sysctl-estimate");	if (needed) {		if ((buf = malloc(needed)) == NULL)			err(1, "malloc");		if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0)			err(1, "actual retrieval of routing table");		lim = buf + needed;	}	if (verbose) {		(void) printf("Examining routing table from sysctl\n");		 if (af)			printf("(address family %s)\n", (*argv + 1));	}	if (buf == NULL)		return;	seqno = 0;		/* ??? */	for (next = buf; next < lim; next += rtm->rtm_msglen) {		rtm = (struct rt_msghdr *)next;		if (verbose)			print_rtmsg(rtm, rtm->rtm_msglen);		if ((rtm->rtm_flags & (RTF_GATEWAY|RTF_STATIC|RTF_LLINFO)) == 0)			continue;		sa = (struct sockaddr *)(rtm + 1);		if (af) {			if (sa->sa_family != af)				continue;		}		if (sa->sa_family == AF_KEY)			continue;  /* Don't flush SPD */		if (debugonly)			continue;		rtm->rtm_type = RTM_DELETE;		rtm->rtm_seq = seqno;		rlen = write(s, next, rtm->rtm_msglen);		if (rlen < (int)rtm->rtm_msglen) {			warn("write to routing socket");			(void) printf("got only %d for rlen\n", rlen);			break;		}		seqno++;		if (qflag)			continue;		if (verbose)			print_rtmsg(rtm, rlen);		else {			struct sockaddr *sa = (struct sockaddr *)(rtm + 1);			(void) printf("%-20.20s ", rtm->rtm_flags & RTF_HOST ?			    routename(sa) : netname(sa, NULL)); /* XXX extract								   netmask */			sa = (struct sockaddr *)(ROUNDUP(sa->sa_len) + (char *)sa);			(void) printf("%-20.20s ", routename(sa));			(void) printf("done\n");		}	}	free(buf);}