]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - adventure/main.c
Add manpage wargames(6), contributed by Joey Hess <joeyh@kitenet.net>.
[bsdgames-darwin.git] / adventure / main.c
index cf5e268a9a4ddf9ded519521ec8dc4d18f85a1cd..794e5a3f403a37d8599ccd7c56c05548786be26b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.11 1998/09/13 15:21:37 hubertf Exp $        */
+/*     $NetBSD: main.c,v 1.14 1999/07/16 01:38:20 hubertf Exp $        */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -48,7 +48,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
 #if 0
 static char sccsid[] = "@(#)main.c     8.1 (Berkeley) 6/2/93";
 #else
-__RCSID("$NetBSD: main.c,v 1.11 1998/09/13 15:21:37 hubertf Exp $");
+__RCSID("$NetBSD: main.c,v 1.14 1999/07/16 01:38:20 hubertf Exp $");
 #endif
 #endif /* not lint */
 
@@ -73,9 +73,8 @@ main(argc, argv)
        int     rval, ll;
        struct text *kk;
 
-       /* adventure doesn't need setuid-ness, so, just get rid of it */
-       if (setuid(getuid()) < 0)
-               warn("setuid");
+       /* revoke setgid privileges from dm */
+       setregid(getgid(), getgid());
 
        init();         /* Initialize everything */
        signal(SIGINT, trapdel);
@@ -90,10 +89,10 @@ main(argc, argv)
                        unlink(argv[1]);        /* Don't re-use the save */
                        goto l8;                /* Get where we're going */
                case 1:                         /* Couldn't open it */
-                       exit(0);                /* So give up */
+                       errx(1,"can't open file");      /* So give up */
                case 2:                         /* Oops -- file was altered */
                        rspeak(202);            /* You dissolve */
-                       exit(0);        /* File could be non-adventure */
+                       exit(1);        /* File could be non-adventure */
                }                       /* So don't unlink it. */
        }
        startup();                      /* prepare for a user */
@@ -277,8 +276,7 @@ l2630:              i = vocab(wd1, -1, 0);
                case 4:
                        goto l2010;
                default:
-                       printf("Error 22\n");
-                       exit(0);
+                       bug(22);
                }
 
 l8:
@@ -453,7 +451,7 @@ l4080:
                        printf(" %d minutes before continuing.", latncy);
                        if (!yes(200, 54, 54))
                                goto l2012;
-                       datime(&saved, &savet);
+                       datime(&saveday, &savet);
                        ciao(); /* Do we quit? */
                        continue;       /* Maybe not */
                case 31:        /* hours=8310 */