From: tedu Date: Sun, 13 Jul 2014 13:00:40 +0000 (+0000) Subject: long live BSD, SYSV is dead! X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=54740ad2cd154e666a138ce310738eb6afd4834d;p=openbsd long live BSD, SYSV is dead! --- diff --git a/games/atc/graphics.c b/games/atc/graphics.c index 6aad9d476eb..c9ba0b577a9 100644 --- a/games/atc/graphics.c +++ b/games/atc/graphics.c @@ -1,4 +1,4 @@ -/* $OpenBSD: graphics.c,v 1.8 2009/10/27 23:59:23 deraadt Exp $ */ +/* $OpenBSD: graphics.c,v 1.9 2014/07/13 13:00:40 tedu Exp $ */ /* $NetBSD: graphics.c,v 1.3 1995/03/21 15:04:04 cgd Exp $ */ /*- @@ -59,15 +59,10 @@ int getAChar(void) { int c; -#ifdef BSD + if ((c = getchar()) == EOF && feof(stdin)) quit(0); return (c); -#endif -#ifdef SYSV - while ((c = getchar()) == -1 && errno == EINTR) ; - return(c); -#endif } void @@ -282,9 +277,7 @@ void quit(int dummy) { int c, y, x; -#ifdef BSD struct itimerval itv; -#endif getyx(input, y, x); wmove(input, 2, 0); @@ -296,14 +289,9 @@ quit(int dummy) c = getchar(); if (c == EOF || c == 'y') { /* disable timer */ -#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 fflush(stdout); clear(); refresh(); @@ -324,15 +312,10 @@ planewin(void) PLANE *pp; int warning = 0; -#ifdef BSD wclear(planes); -#endif wmove(planes, 0,0); -#ifdef SYSV - wclrtobot(planes); -#endif wprintw(planes, "Time: %-4d Safe: %d", clck, safe_planes); wmove(planes, 2, 0); @@ -365,19 +348,12 @@ void loser(const PLANE *p, const char *s) { int c; -#ifdef BSD struct itimerval itv; -#endif /* disable timer */ -#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 wmove(input, 0, 0); wclrtobot(input); diff --git a/games/atc/log.c b/games/atc/log.c index 6f134bec863..6f4edacadd1 100644 --- a/games/atc/log.c +++ b/games/atc/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.17 2009/10/27 23:59:23 deraadt Exp $ */ +/* $OpenBSD: log.c,v 1.18 2014/07/13 13:00:40 tedu Exp $ */ /* $NetBSD: log.c,v 1.3 1995/03/21 15:04:21 cgd Exp $ */ /*- @@ -126,13 +126,7 @@ log_score(int list_em) if (score_fp == NULL) return (-1); -#ifdef BSD - if (flock(fileno(score_fp), LOCK_EX) < 0) -#endif -#ifdef SYSV - while (lockf(fileno(score_fp), F_LOCK, 1) < 0) -#endif - { + if (flock(fileno(score_fp), LOCK_EX) < 0) { perror("flock"); return (-1); } @@ -225,19 +219,10 @@ log_score(int list_em) } putchar('\n'); } -#ifdef BSD flock(fileno(score_fp), LOCK_UN); -#endif -#ifdef SYSV - /* lock will evaporate upon close */ -#endif -#if 0 - fclose(score_fp); -#else fflush(score_fp); fsync(fileno(score_fp)); rewind(score_fp); -#endif printf("%2s: %-31s %-18s %4s %9s %4s\n", "#", "name", "game", "time", "real time", "safe"); puts("-------------------------------------------------------------------------------"); diff --git a/games/atc/main.c b/games/atc/main.c index 5b189534bb6..7262502dd2f 100644 --- a/games/atc/main.c +++ b/games/atc/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.21 2009/10/27 23:59:23 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.22 2014/07/13 13:00:40 tedu Exp $ */ /* $NetBSD: main.c,v 1.4 1995/04/27 21:22:25 mycroft Exp $ */ /*- @@ -54,9 +54,7 @@ main(int ac, char *av[]) char *name, *ptr, *seed; struct sigaction sa; gid_t gid; -#ifdef BSD struct itimerval itv; -#endif open_score_file(); @@ -154,10 +152,8 @@ main(int ac, char *av[]) signal(SIGINT, quit); signal(SIGQUIT, quit); -#ifdef BSD signal(SIGTSTP, SIG_IGN); signal(SIGSTOP, SIG_IGN); -#endif signal(SIGHUP, log_score_quit); signal(SIGTERM, log_score_quit); @@ -177,42 +173,27 @@ main(int ac, char *av[]) 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(0); -#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 } } } diff --git a/games/atc/update.c b/games/atc/update.c index 98ce4d2d9d4..7eb9996c54c 100644 --- a/games/atc/update.c +++ b/games/atc/update.c @@ -1,4 +1,4 @@ -/* $OpenBSD: update.c,v 1.12 2009/10/27 23:59:23 deraadt Exp $ */ +/* $OpenBSD: update.c,v 1.13 2014/07/13 13:00:40 tedu Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -49,11 +49,6 @@ update(int dummy) int i, dir_diff, unclean; PLANE *pp, *p1, *p2; -#ifdef SYSV - alarm(0); - signal(SIGALRM, update); -#endif - clck++; erase_all(); @@ -203,10 +198,6 @@ update(int dummy) */ if ((random() % sp->newplane_time) == 0) addplane(); - -#ifdef SYSV - alarm(sp->update_secs); -#endif } const char *