if (argc > 0) strncpy(interface, argv[0], sizeof(interface));
if (argc > 0) { (void)strncpy(interface, argv[0], sizeof(interface) - 1); interface[sizeof(interface) - 1] = '\0'; } if (sscanf(interface, "ppp%d", &unit) != 1) errx(1, "invalid interface '%s' specified", interface);
main(argc, argv)	int argc;	char *argv[];{	int c;	struct ifreq ifr;	strcpy(interface, "ppp0");	if ((progname = strrchr(argv[0], '/')) == NULL)		progname = argv[0];	else		++progname;	while ((c = getopt(argc, argv, "avrzc:w:")) != -1) {		switch (c) {		case 'a':			++aflag;			break;		case 'v':			++vflag;			break;		case 'r':			++rflag;			break;		case 'z':			++zflag;			break;		case 'c':			count = atoi(optarg);			if (count <= 0)				usage();			break;		case 'w':			interval = atoi(optarg);			if (interval <= 0)				usage();			break;		default:			usage();		}	}	argc -= optind;	argv += optind;	if (!interval && count)		interval = 5;	if (interval && !count)		infinite = 1;	if (!interval && !count)		count = 1;	if (argc > 1)		usage();	if (argc > 0)		strncpy(interface, argv[0], sizeof(interface));	if (sscanf(interface, "ppp%d", &unit) != 1)		errx(1, "invalid interface '%s' specified\n", interface);	s = socket(AF_INET, SOCK_DGRAM, 0);	if (s < 0)		err(1, "couldn't create IP socket");	strcpy(ifr.ifr_name, interface);	if (ioctl(s, SIOCGIFFLAGS, (caddr_t)&ifr) < 0)		errx(1, "nonexistent interface '%s' specified\n", interface);	intpr();	exit(0);}