BSD 4_4 release
[unix-history] / usr / src / games / dm / dm.c
index e6b35a5..b268a5c 100644 (file)
@@ -1,29 +1,60 @@
 /*
 /*
- * Copyright (c) 1987 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1987, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1987 Regents of the University of California.\n\
- All rights reserved.\n";
+static char copyright[] =
+"@(#) Copyright (c) 1987, 1993\n\
      The Regents of the University of California.  All rights reserved.\n";
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)dm.c       5.16 (Berkeley) %G%";
+static char sccsid[] = "@(#)dm.c       8.1 (Berkeley) 5/31/93";
 #endif /* not lint */
 
 #include <sys/param.h>
 #include <sys/file.h>
 #include <sys/time.h>
 #include <sys/resource.h>
 #endif /* not lint */
 
 #include <sys/param.h>
 #include <sys/file.h>
 #include <sys/time.h>
 #include <sys/resource.h>
-#include <pwd.h>
-#include <utmp.h>
+
+#include <ctype.h>
 #include <nlist.h>
 #include <nlist.h>
+#include <pwd.h>
 #include <stdio.h>
 #include <stdio.h>
-#include <ctype.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+#include <utmp.h>
+
 #include "pathnames.h"
 
 extern int errno;
 #include "pathnames.h"
 
 extern int errno;
@@ -32,13 +63,12 @@ static int  priority = 0;           /* priority game runs at */
 static char    *game,                  /* requested game */
                *gametty;               /* from tty? */
 
 static char    *game,                  /* requested game */
                *gametty;               /* from tty? */
 
-/*ARGSUSED*/
+int
 main(argc, argv)
        int argc;
 main(argc, argv)
        int argc;
-       char **argv;
+       char *argv[];
 {
 {
-       char *cp, *rindex(), *ttyname();
-       time_t time();
+       char *cp;
 
        nogamefile();
        game = (cp = rindex(*argv, '/')) ? ++cp : *argv;
 
        nogamefile();
        game = (cp = rindex(*argv, '/')) ? ++cp : *argv;
@@ -63,7 +93,7 @@ main(argc, argv)
 play(args)
        char **args;
 {
 play(args)
        char **args;
 {
-       char pbuf[MAXPATHLEN], *strcpy(), *strerror();
+       char pbuf[MAXPATHLEN];
 
        (void)strcpy(pbuf, _PATH_HIDE);
        (void)strcpy(pbuf + sizeof(_PATH_HIDE) - 1, game);
 
        (void)strcpy(pbuf, _PATH_HIDE);
        (void)strcpy(pbuf + sizeof(_PATH_HIDE) - 1, game);
@@ -150,7 +180,6 @@ c_tty(tty)
 {
        static int first = 1;
        static char *p_tty;
 {
        static int first = 1;
        static char *p_tty;
-       char *rindex();
 
        if (first) {
                p_tty = rindex(gametty, '/');
 
        if (first) {
                p_tty = rindex(gametty, '/');
@@ -272,11 +301,10 @@ hour(h)
  */
 logfile()
 {
  */
 logfile()
 {
-       struct passwd *pw, *getpwuid();
+       struct passwd *pw;
        FILE *lp;
        uid_t uid;
        int lock_cnt;
        FILE *lp;
        uid_t uid;
        int lock_cnt;
-       char *ctime();
 
        if (lp = fopen(_PATH_LOG, "a")) {
                for (lock_cnt = 0;; ++lock_cnt) {
 
        if (lp = fopen(_PATH_LOG, "a")) {
                for (lock_cnt = 0;; ++lock_cnt) {