BSD 4_2 release
[unix-history] / usr / src / games / mille / mille.c
index a3e0d5d..609cc89 100644 (file)
@@ -1,7 +1,14 @@
 # include      "mille.h"
 # include      <signal.h>
 # include      "mille.h"
 # include      <signal.h>
+# ifdef attron
+#      include <term.h>
+# endif        attron
 
 
-int    rub(), tstp();
+/*
+ * @(#)mille.c 1.3 (Berkeley) 5/10/83
+ */
+
+int    rub();
 
 char   _sobuf[BUFSIZ];
 
 
 char   _sobuf[BUFSIZ];
 
@@ -10,13 +17,8 @@ reg int              ac;
 reg char       *av[]; {
 
        reg bool        restore;
 reg char       *av[]; {
 
        reg bool        restore;
+       double          avs[3];
 
 
-# if 0
-       if (getuid() == GURP) {
-               printf("%s: Permission denied\n", av[0]);
-               exit(1);
-       }
-# endif
        if (strcmp(av[0], "a.out") == 0) {
                outf = fopen("q", "w");
                setbuf(outf, 0);
        if (strcmp(av[0], "a.out") == 0) {
                outf = fopen("q", "w");
                setbuf(outf, 0);
@@ -24,8 +26,14 @@ reg char     *av[]; {
        }
        restore = FALSE;
 # ifdef pdp11
        }
        restore = FALSE;
 # ifdef pdp11
-       if (geteuid() != ARNOLD)
-               maxusers(MAXUSERS, NULL);
+       if (geteuid() != ARNOLD) {
+               loadav(avs);
+               if (avs[2] > 9.0) {
+                       printf("Sorry.  The load average is too high.\n");
+                       printf("Please try again later\n");
+                       exit(1);
+               }
+       }
 # endif
        switch (ac) {
          case 2:
 # endif
        switch (ac) {
          case 2:
@@ -41,6 +49,9 @@ reg char      *av[]; {
        setbuf(stdout, _sobuf);
        Play = PLAYER;
        initscr();
        setbuf(stdout, _sobuf);
        Play = PLAYER;
        initscr();
+# ifdef attron
+#      define  CA      cursor_address
+# endif
        if (!CA) {
                printf("Sorry.  Need cursor addressing to play mille\n");
                exit(-1);
        if (!CA) {
                printf("Sorry.  Need cursor addressing to play mille\n");
                exit(-1);
@@ -49,6 +60,11 @@ reg char     *av[]; {
        stdscr = Board = newwin(BOARD_Y, BOARD_X, 0, 0);
        Score = newwin(SCORE_Y, SCORE_X, 0, 40);
        Miles = newwin(MILES_Y, MILES_X, 17, 0);
        stdscr = Board = newwin(BOARD_Y, BOARD_X, 0, 0);
        Score = newwin(SCORE_Y, SCORE_X, 0, 40);
        Miles = newwin(MILES_Y, MILES_X, 17, 0);
+#ifdef attron
+       idlok(Board, TRUE);
+       idlok(Score, TRUE);
+       idlok(Miles, TRUE);
+#endif
        leaveok(Score, TRUE);
        leaveok(Miles, TRUE);
        clearok(curscr, TRUE);
        leaveok(Score, TRUE);
        leaveok(Miles, TRUE);
        clearok(curscr, TRUE);
@@ -60,7 +76,6 @@ reg char      *av[]; {
        crmode();
        noecho();
        signal(SIGINT, rub);
        crmode();
        noecho();
        signal(SIGINT, rub);
-       signal(SIGTSTP, tstp);
        for (;;) {
                if (!restore || (Player[PLAYER].total >= 5000
                    || Player[COMP].total >= 5000)) {
        for (;;) {
                if (!restore || (Player[PLAYER].total >= 5000
                    || Player[COMP].total >= 5000)) {
@@ -119,14 +134,3 @@ die() {
        endwin();
        exit(1);
 }
        endwin();
        exit(1);
 }
-
-tstp() {
-
-       if (outf)
-               fflush(outf);
-       resetty();
-       kill(0, SIGTSTP);
-       signal(SIGTSTP, tstp);
-       noecho();
-       crmode();
-}