maxrec = -1; snaptime = 0; lastch = '\0'; newarg = 1; prevoptind = 1;
main(int argc, char *argv[]){	const char *errstr;	char *p;	int ch, lastch, newarg, prevoptind;	maxrec = -1;	snaptime = 0;	lastch = '\0';	newarg = 1;	prevoptind = 1;	while ((ch = getopt(argc, argv, "0123456789cf:h:n:st:d:T")) != -1) {		switch (ch) {		case '0': case '1': case '2': case '3': case '4':		case '5': case '6': case '7': case '8': case '9':			/*			 * kludge: last was originally designed to take			 * a number after a dash.			 */			if (newarg || !isdigit(lastch))				maxrec = 0;			else if (maxrec > INT_MAX / 10)				usage();			maxrec = (maxrec * 10) + (ch - '0');			break;		case 'c':			calculate++;			break;		case 'f':			file = optarg;			break;		case 'h':			hostconv(optarg);			addarg(HOST_TYPE, optarg);			break;		case 'n':			maxrec = strtonum(optarg, 0, LONG_MAX, &errstr);			if (errstr != NULL)				errx(1, "number of lines is %s: %s", errstr,				    optarg);			if (maxrec == 0)				exit(0);			break;		case 's':			seconds++;			break;		case 't':			addarg(TTY_TYPE, ttyconv(optarg));			break;		case 'd':			snaptime = dateconv(optarg);			break;		case 'T':			fulltime = 1;			break;		default:			usage();		}		lastch = ch;		newarg = optind != prevoptind;		prevoptind = optind;	}	if (maxrec == 0)		exit(0);	if (argc) {		setlinebuf(stdout);		for (argv += optind; *argv; ++argv) {#define	COMPATIBILITY#ifdef	COMPATIBILITY			/* code to allow "last p5" to work */			addarg(TTY_TYPE, ttyconv(*argv));#endif			addarg(USER_TYPE, *argv);		}	}	checkargs();	wtmp();	exit(0);}