BSD 4_3_Tahoe release
[unix-history] / usr / src / games / mille / mille.c
index 831da66..4316e63 100644 (file)
@@ -1,3 +1,30 @@
+/*
+ * Copyright (c) 1982 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#ifndef lint
+char copyright[] =
+"@(#) Copyright (c) 1982 Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)mille.c    5.3 (Berkeley) 6/18/88";
+#endif /* not lint */
+
 # include      "mille.h"
 # include      <signal.h>
 # ifdef attron
 # include      "mille.h"
 # include      <signal.h>
 # ifdef attron
 
 int    rub();
 
 
 int    rub();
 
-char   _sobuf[BUFSIZ];
-
 main(ac, av)
 reg int                ac;
 reg char       *av[]; {
 
        reg bool        restore;
 main(ac, av)
 reg int                ac;
 reg char       *av[]; {
 
        reg bool        restore;
-       double          avs[3];
+
+       /* run as the user */
+       setuid(getuid());
 
        if (strcmp(av[0], "a.out") == 0) {
                outf = fopen("q", "w");
 
        if (strcmp(av[0], "a.out") == 0) {
                outf = fopen("q", "w");
-               setbuf(outf, NULL);
+               setbuf(outf, (char *)NULL);
                Debug = TRUE;
        }
        restore = FALSE;
                Debug = TRUE;
        }
        restore = FALSE;
-# ifdef LOADAV
-       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:
                rest_f(av[1]);
        switch (ac) {
          case 2:
                rest_f(av[1]);
@@ -46,7 +63,6 @@ reg char      *av[]; {
                exit(-1);
                /* NOTREACHED */
        }
                exit(-1);
                /* NOTREACHED */
        }
-       setbuf(stdout, _sobuf);
        Play = PLAYER;
        initscr();
 # ifdef attron
        Play = PLAYER;
        initscr();
 # ifdef attron
@@ -116,10 +132,10 @@ reg char  *av[]; {
  */
 rub() {
 
  */
 rub() {
 
-       signal(SIGINT, SIG_IGN);
+       (void)signal(SIGINT, SIG_IGN);
        if (getyn(REALLYPROMPT))
                die();
        if (getyn(REALLYPROMPT))
                die();
-       signal(SIGINT, rub);
+       (void)signal(SIGINT, rub);
 }
 
 /*
 }
 
 /*
@@ -127,7 +143,7 @@ rub() {
  */
 die() {
 
  */
 die() {
 
-       signal(SIGINT, SIG_IGN);
+       (void)signal(SIGINT, SIG_IGN);
        if (outf)
                fflush(outf);
        mvcur(0, COLS - 1, LINES - 1, 0);
        if (outf)
                fflush(outf);
        mvcur(0, COLS - 1, LINES - 1, 0);