open_score_file();
main(ac, av)	char	*av[];{	int			seed;	int			f_usage = 0, f_list = 0, f_showscore = 0;	int			f_printpath = 0;	char			*file = NULL;	char			*name, *ptr;	struct sigaction	sa;#ifdef BSD	struct itimerval	itv;#endif	extern char		*default_game(), *okay_game();	extern void		log_score(), quit(), update();	/* revoke privs */	setegid(getgid());	setgid(getgid());	start_time = seed = time(0);	name = *av++;	while (*av) {#ifndef SAVEDASH		if (**av == '-') 			*++*av;		else			break;#endif		ptr = *av++;		while (*ptr) {			switch (*ptr) {			case '?':			case 'u':				f_usage++;				break;			case 'l':				f_list++;				break;			case 's':			case 't':				f_showscore++;				break;			case 'p':				f_printpath++;				break;			case 'r':				seed = atoi(*av);				av++;				break;			case 'f':			case 'g':				file = *av;				av++;				break;			default: 				fprintf(stderr, "Unknown option '%c'\n", *ptr,					name);				f_usage++;				break;			}			ptr++;		}	}	srandom(seed);	if (f_usage)		fprintf(stderr, 		    "Usage: %s -[u?lstp] [-[gf] game_name] [-r random seed]\n",			name);	if (f_showscore)		log_score(1);	if (f_list)		list_games();	if (f_printpath) {		char	buf[100];		strcpy(buf, _PATH_GAMES);		buf[strlen(buf) - 1] = '\0';		puts(buf);	}			if (f_usage || f_showscore || f_list || f_printpath)		exit(0);	if (file == NULL)		file = default_game();	else		file = okay_game(file);	if (file == NULL || read_file(file) < 0)		exit(1);	init_gr();	setup_screen(sp);	addplane();	signal(SIGINT, quit);	signal(SIGQUIT, quit);#ifdef BSD	signal(SIGTSTP, SIG_IGN);	signal(SIGSTOP, SIG_IGN);#endif	signal(SIGHUP, log_score);	signal(SIGTERM, log_score);	tcgetattr(fileno(stdin), &tty_start);	tty_new = tty_start;	tty_new.c_lflag &= ~(ICANON|ECHO);	tty_new.c_cc[VMIN] = 1;	tty_new.c_cc[VTIME] = 0;	tcsetattr(fileno(stdin), TCSADRAIN, &tty_new);	sa.sa_handler = update;	sigemptyset(&sa.sa_mask);	sigaddset(&sa.sa_mask, SIGALRM);	sigaddset(&sa.sa_mask, SIGINT);	sa.sa_flags = 0;	sigaction(SIGALRM, &sa, (struct sigaction *)0);#ifdef BSD	itv.it_value.tv_sec = 0;	itv.it_value.tv_usec = 1;	itv.it_interval.tv_sec = sp->update_secs;	itv.it_interval.tv_usec = 0;	setitimer(ITIMER_REAL, &itv, NULL);#endif#ifdef SYSV	alarm(sp->update_secs);#endif	for (;;) {		if (getcommand() != 1)			planewin();		else {#ifdef BSD			itv.it_value.tv_sec = 0;			itv.it_value.tv_usec = 0;			setitimer(ITIMER_REAL, &itv, NULL);#endif#ifdef SYSV			alarm(0);#endif			update();#ifdef BSD			itv.it_value.tv_sec = sp->update_secs;			itv.it_value.tv_usec = 0;			itv.it_interval.tv_sec = sp->update_secs;			itv.it_interval.tv_usec = 0;			setitimer(ITIMER_REAL, &itv, NULL);#endif#ifdef SYSV			alarm(sp->update_secs);#endif		}	}}