time_t interval; int ch, iflag, flags;
main(int argc, char *argv[]){	struct passwd *pw;	struct stat sb;	ALIAS *cur;	time_t interval;	int ch, iflag, flags;	opterr = iflag = 0;	interval = -1;	while ((ch = getopt(argc, argv, "a:Iir:")) != -1)		switch((char)ch) {		case 'a':			/* alias */			if (!(cur = (ALIAS *)malloc((u_int)sizeof(ALIAS))))				break;			cur->name = optarg;			cur->next = names;			names = cur;			break;		case 'I':			/* backward compatible */		case 'i':			/* init the database */			iflag = 1;			break;		case 'r':			if (isdigit(*optarg)) {				interval = atol(optarg) * SECSPERDAY;				if (interval < 0)					usage();			}			else				interval = (time_t)LONG_MAX;	/* XXX */			break;		case '?':		default:			usage();		}	argc -= optind;	argv += optind;	if (argc != 1) {		if (!iflag)			usage();		if (!(pw = getpwuid(getuid()))) {			syslog(LOG_ERR,			    "no such user uid %u.", getuid());			exit(1);		}	}	else if (!(pw = getpwnam(*argv))) {		syslog(LOG_ERR, "no such user %s.", *argv);		exit(1);	}	if (chdir(pw->pw_dir)) {		syslog(LOG_NOTICE,		    "no such directory %s.", pw->pw_dir);		exit(1);	}	/*	 * dbopen(3) can not deal with a zero-length file w/o O_TRUNC.	 */	if (iflag == 1 || (stat(VDB, &sb) == 0 && sb.st_size == (off_t)0))		flags = O_CREAT|O_RDWR|O_TRUNC;	else		flags = O_CREAT|O_RDWR;			db = dbopen(VDB, flags, S_IRUSR|S_IWUSR, DB_HASH, NULL);	if (!db) {		syslog(LOG_NOTICE, "%s: %m", VDB);		exit(1);	}	if (interval != -1)		setinterval(interval);	if (iflag) {		(void)(db->close)(db);		exit(0);	}	if (!(cur = malloc((u_int)sizeof(ALIAS))))		exit(1);	cur->name = pw->pw_name;	cur->next = names;	names = cur;	readheaders();	if (!recent()) {		setreply();		(void)(db->close)(db);		sendmessage(pw->pw_name);	}	else		(void)(db->close)(db);	exit(0);	/* NOTREACHED */}