summaryrefslogtreecommitdiffstats
path: root/dm
diff options
context:
space:
mode:
authorcgd <cgd@NetBSD.org>1993-03-21 09:45:37 +0000
committercgd <cgd@NetBSD.org>1993-03-21 09:45:37 +0000
commit77e3814f0c0e3dea4d0032e25666f77e6f83bfff (patch)
tree7eddfcbf3dd12089e71dc3fafb0a106c5c5766c7 /dm
parente81d63576b2e46ab90da7d75fa155ea57ee4d32e (diff)
downloadbsdgames-darwin-77e3814f0c0e3dea4d0032e25666f77e6f83bfff.tar.gz
bsdgames-darwin-77e3814f0c0e3dea4d0032e25666f77e6f83bfff.tar.zst
bsdgames-darwin-77e3814f0c0e3dea4d0032e25666f77e6f83bfff.zip
initial import of 386bsd-0.1 sources
Diffstat (limited to 'dm')
-rw-r--r--dm/Makefile12
-rw-r--r--dm/dm.066
-rw-r--r--dm/dm.8109
-rw-r--r--dm/dm.c327
-rw-r--r--dm/dm.conf.066
-rw-r--r--dm/dm.conf.599
-rw-r--r--dm/pathnames.h39
7 files changed, 718 insertions, 0 deletions
diff --git a/dm/Makefile b/dm/Makefile
new file mode 100644
index 00000000..d0d552bd
--- /dev/null
+++ b/dm/Makefile
@@ -0,0 +1,12 @@
+# @(#)Makefile 5.7 (Berkeley) 9/30/90
+
+# -DLOG log games
+PROG= dm
+MAN8= dm.0
+MAN5= dm.conf.0
+BINGRP= kmem
+BINMODE=6555
+DPADD= ${LIBUTIL}
+LDADD= -lutil
+
+.include <bsd.prog.mk>
diff --git a/dm/dm.0 b/dm/dm.0
new file mode 100644
index 00000000..7afb5634
--- /dev/null
+++ b/dm/dm.0
@@ -0,0 +1,66 @@
+DM(8) 386BSD System Manager's Manual DM(8)
+
+NNAAMMEE
+ ddmm - dungeon master
+
+SSYYNNOOPPSSIISS
+ llnn --ss ddmm _g_a_m_e
+
+DDEESSCCRRIIPPTTIIOONN
+ DDmm is a program used to regulate game playing. DDmm expects to be invoked
+ with the name of a game that a user wishes to play. This is done by cre-
+ ating symbolic links to ddmm, in the directory /_u_s_r/_g_a_m_e_s for all of the
+ regulated games. The actual binaries for these games should be placed in
+ a ``hidden'' directory, /_u_s_r/_g_a_m_e_s/_h_i_d_e, that may only be accessed by the
+ ddmm program. DDmm determines if the requested game is available and, if so,
+ runs it. The file /_e_t_c/_d_m._c_o_n_f controls the conditions under which games
+ may be run.
+
+ The file /_e_t_c/_n_o_g_a_m_e_s may be used to ``turn off'' game playing. If the
+ file exists, no game playing is allowed; the contents of the file will be
+ displayed to any user requesting a game.
+
+FFIILLEESS
+ /etc/dm.conf configuration file
+ /etc/nogames turns off game playing
+ /usr/games/hide directory of ``real'' binaries
+ /var/log/games.log game logging file
+
+SSEEEE AALLSSOO
+ dm.conf(5)
+
+BBUUGGSS
+ Two problems result from ddmm running the games setuid ``games''. First,
+ all games that allow users to run UNIX commands should carefully set both
+ the real and effective user id's immediately before executing those com-
+ mands. Probably more important is that ddmm never be setuid anything but
+ ``games'' so that compromising a game will result only in the user's
+ ability to play games at will. Secondly, games which previously had no
+ reason to run setuid and which accessed user files may have to be modi-
+ fied.
+
+HHIISSTTOORRYY
+ The ddmm command appeared in 4.3BSD-Tahoe.
+
+BSD Experimental July 23, 1991 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dm/dm.8 b/dm/dm.8
new file mode 100644
index 00000000..4304600b
--- /dev/null
+++ b/dm/dm.8
@@ -0,0 +1,109 @@
+.\" Copyright (c) 1987, 1991 Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" @(#)dm.8 5.11 (Berkeley) 7/23/91
+.\"
+.Dd July 23, 1991
+.Dt DM 8
+.Os
+.Sh NAME
+.Nm dm
+.Nd dungeon master
+.Sh SYNOPSIS
+.Nm ln
+.Fl s Cm dm Ar game
+.Sh DESCRIPTION
+.Nm Dm
+is a program used to regulate game playing.
+.Nm Dm
+expects to be invoked with the name of a game that a user wishes to play.
+This is done by creating symbolic links to
+.Nm dm ,
+in the directory
+.Pa /usr/games
+for all of the regulated games.
+The actual binaries for these games should be placed in a
+.Dq hidden
+directory,
+.Pa /usr/games/hide ,
+that may only be accessed by the
+.Nm dm
+program.
+.Nm Dm
+determines if the requested game is available and, if so, runs it.
+The file
+.Pa /etc/dm.conf
+controls the conditions under which games may
+be run.
+.Pp
+The file
+.Pa /etc/nogames
+may be used to
+.Dq turn off
+game playing.
+If the file exists, no game playing is allowed; the contents of the file
+will be displayed to any user requesting a game.
+.Sh FILES
+.Bl -tag -width /var/log/games.log -compact
+.It Pa /etc/dm.conf
+configuration file
+.It Pa /etc/nogames
+turns off game playing
+.It Pa /usr/games/hide
+directory of ``real'' binaries
+.It Pa /var/log/games.log
+game logging file
+.El
+.Sh SEE ALSO
+.Xr dm.conf 5
+.Sh BUGS
+Two problems result from
+.Nm dm
+running the games setuid
+.Dq games .
+First, all games that allow users to run
+.Tn UNIX
+commands should carefully
+set both the real and effective user id's immediately before executing
+those commands. Probably more important is that
+.Nm dm
+never be setuid
+anything but
+.Dq games
+so that compromising a game will result only in
+the user's ability to play games at will. Secondly, games which previously
+had no reason to run setuid and which accessed user files may have to
+be modified.
+.Sh HISTORY
+The
+.Nm dm
+command appeared in
+.Bx 4.3 tahoe .
diff --git a/dm/dm.c b/dm/dm.c
new file mode 100644
index 00000000..bf820688
--- /dev/null
+++ b/dm/dm.c
@@ -0,0 +1,327 @@
+/*
+ * Copyright (c) 1987 Regents of the University of California.
+ * All rights reserved.
+ *
+ * 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
+char copyright[] =
+"@(#) Copyright (c) 1987 Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)dm.c 5.16 (Berkeley) 2/28/91";
+#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 <nlist.h>
+#include <stdio.h>
+#include <ctype.h>
+#include "pathnames.h"
+
+extern int errno;
+static time_t now; /* current time value */
+static int priority = 0; /* priority game runs at */
+static char *game, /* requested game */
+ *gametty; /* from tty? */
+
+/*ARGSUSED*/
+main(argc, argv)
+ int argc;
+ char **argv;
+{
+ char *cp, *rindex(), *ttyname();
+ time_t time();
+
+ nogamefile();
+ game = (cp = rindex(*argv, '/')) ? ++cp : *argv;
+
+ if (!strcmp(game, "dm"))
+ exit(0);
+
+ gametty = ttyname(0);
+ (void)time(&now);
+ read_config();
+#ifdef LOG
+ logfile();
+#endif
+ play(argv);
+ /*NOTREACHED*/
+}
+
+/*
+ * play --
+ * play the game
+ */
+play(args)
+ char **args;
+{
+ char pbuf[MAXPATHLEN], *strcpy(), *strerror();
+
+ (void)strcpy(pbuf, _PATH_HIDE);
+ (void)strcpy(pbuf + sizeof(_PATH_HIDE) - 1, game);
+ if (priority > 0) /* < 0 requires root */
+ (void)setpriority(PRIO_PROCESS, 0, priority);
+ setgid(getgid()); /* we run setgid kmem; lose it */
+ execv(pbuf, args);
+ (void)fprintf(stderr, "dm: %s: %s\n", pbuf, strerror(errno));
+ exit(1);
+}
+
+/*
+ * read_config --
+ * read through config file, looking for key words.
+ */
+read_config()
+{
+ FILE *cfp;
+ char lbuf[BUFSIZ], f1[40], f2[40], f3[40], f4[40], f5[40];
+
+ if (!(cfp = fopen(_PATH_CONFIG, "r")))
+ return;
+ while (fgets(lbuf, sizeof(lbuf), cfp))
+ switch(*lbuf) {
+ case 'b': /* badtty */
+ if (sscanf(lbuf, "%s%s", f1, f2) != 2 ||
+ strcasecmp(f1, "badtty"))
+ break;
+ c_tty(f2);
+ break;
+ case 'g': /* game */
+ if (sscanf(lbuf, "%s%s%s%s%s",
+ f1, f2, f3, f4, f5) != 5 || strcasecmp(f1, "game"))
+ break;
+ c_game(f2, f3, f4, f5);
+ break;
+ case 't': /* time */
+ if (sscanf(lbuf, "%s%s%s%s", f1, f2, f3, f4) != 4 ||
+ strcasecmp(f1, "time"))
+ break;
+ c_day(f2, f3, f4);
+ }
+ (void)fclose(cfp);
+}
+
+/*
+ * c_day --
+ * if day is today, see if okay to play
+ */
+c_day(s_day, s_start, s_stop)
+ char *s_day, *s_start, *s_stop;
+{
+ static char *days[] = {
+ "sunday", "monday", "tuesday", "wednesday",
+ "thursday", "friday", "saturday",
+ };
+ static struct tm *ct;
+ int start, stop;
+
+ if (!ct)
+ ct = localtime(&now);
+ if (strcasecmp(s_day, days[ct->tm_wday]))
+ return;
+ if (!isdigit(*s_start) || !isdigit(*s_stop))
+ return;
+ start = atoi(s_start);
+ stop = atoi(s_stop);
+ if (ct->tm_hour >= start && ct->tm_hour < stop) {
+ fputs("dm: Sorry, games are not available from ", stderr);
+ hour(start);
+ fputs(" to ", stderr);
+ hour(stop);
+ fputs(" today.\n", stderr);
+ exit(0);
+ }
+}
+
+/*
+ * c_tty --
+ * decide if this tty can be used for games.
+ */
+c_tty(tty)
+ char *tty;
+{
+ static int first = 1;
+ static char *p_tty;
+ char *rindex();
+
+ if (first) {
+ p_tty = rindex(gametty, '/');
+ first = 0;
+ }
+
+ if (!strcmp(gametty, tty) || p_tty && !strcmp(p_tty, tty)) {
+ fprintf(stderr, "dm: Sorry, you may not play games on %s.\n", gametty);
+ exit(0);
+ }
+}
+
+/*
+ * c_game --
+ * see if game can be played now.
+ */
+c_game(s_game, s_load, s_users, s_priority)
+ char *s_game, *s_load, *s_users, *s_priority;
+{
+ static int found;
+ double load();
+
+ if (found)
+ return;
+ if (strcmp(game, s_game) && strcasecmp("default", s_game))
+ return;
+ ++found;
+ if (isdigit(*s_load) && atoi(s_load) < load()) {
+ fputs("dm: Sorry, the load average is too high right now.\n", stderr);
+ exit(0);
+ }
+ if (isdigit(*s_users) && atoi(s_users) <= users()) {
+ fputs("dm: Sorry, there are too many users logged on right now.\n", stderr);
+ exit(0);
+ }
+ if (isdigit(*s_priority))
+ priority = atoi(s_priority);
+}
+
+/*
+ * load --
+ * return 15 minute load average
+ */
+double
+load()
+{
+ double avenrun[3];
+
+ if (getloadavg(avenrun, sizeof(avenrun)/sizeof(avenrun[0])) < 0) {
+ fputs("dm: getloadavg() failed.\n", stderr);
+ exit(1);
+ }
+ return(avenrun[2]);
+}
+
+/*
+ * users --
+ * return current number of users
+ * todo: check idle time; if idle more than X minutes, don't
+ * count them.
+ */
+users()
+{
+
+ register int nusers, utmp;
+ struct utmp buf;
+
+ if ((utmp = open(_PATH_UTMP, O_RDONLY, 0)) < 0) {
+ (void)fprintf(stderr, "dm: %s: %s\n",
+ _PATH_UTMP, strerror(errno));
+ exit(1);
+ }
+ for (nusers = 0; read(utmp, (char *)&buf, sizeof(struct utmp)) > 0;)
+ if (buf.ut_name[0] != '\0')
+ ++nusers;
+ return(nusers);
+}
+
+nogamefile()
+{
+ register int fd, n;
+ char buf[BUFSIZ];
+
+ if ((fd = open(_PATH_NOGAMES, O_RDONLY, 0)) >= 0) {
+#define MESG "Sorry, no games right now.\n\n"
+ (void)write(2, MESG, sizeof(MESG) - 1);
+ while ((n = read(fd, buf, sizeof(buf))) > 0)
+ (void)write(2, buf, n);
+ exit(1);
+ }
+}
+
+/*
+ * hour --
+ * print out the hour in human form
+ */
+hour(h)
+ int h;
+{
+ switch(h) {
+ case 0:
+ fputs("midnight", stderr);
+ break;
+ case 12:
+ fputs("noon", stderr);
+ break;
+ default:
+ if (h > 12)
+ fprintf(stderr, "%dpm", h - 12);
+ else
+ fprintf(stderr, "%dam", h);
+ }
+}
+
+#ifdef LOG
+/*
+ * logfile --
+ * log play of game
+ */
+logfile()
+{
+ struct passwd *pw, *getpwuid();
+ FILE *lp;
+ uid_t uid;
+ int lock_cnt;
+ char *ctime();
+
+ if (lp = fopen(_PATH_LOG, "a")) {
+ for (lock_cnt = 0;; ++lock_cnt) {
+ if (!flock(fileno(lp), LOCK_EX))
+ break;
+ if (lock_cnt == 4) {
+ perror("dm: log lock");
+ (void)fclose(lp);
+ return;
+ }
+ sleep((u_int)1);
+ }
+ if (pw = getpwuid(uid = getuid()))
+ fputs(pw->pw_name, lp);
+ else
+ fprintf(lp, "%u", uid);
+ fprintf(lp, "\t%s\t%s\t%s", game, gametty, ctime(&now));
+ (void)fclose(lp);
+ (void)flock(fileno(lp), LOCK_UN);
+ }
+}
+#endif /* LOG */
diff --git a/dm/dm.conf.0 b/dm/dm.conf.0
new file mode 100644
index 00000000..3a1e3648
--- /dev/null
+++ b/dm/dm.conf.0
@@ -0,0 +1,66 @@
+DM.CONF(5) 386BSD Programmer's Manual DM.CONF(5)
+
+NNAAMMEE
+ ddmm..ccoonnff - dm configuration file
+
+DDEESSCCRRIIPPTTIIOONN
+ The dm.conf file is the configuration file for the dm(8) program. It
+ consists of lines beginning with one of three keywords, ``badtty'',
+ ``game'', and ``time''. All other lines are ignored.
+
+ Any tty listed after the keyword ``badtty'' may not have games played on
+ it. Entries consist of two white-space separated fields: the string
+ ``badtty'' and the ttyname as returned by ttyname(3). For example, to
+ keep the uucp dialout, ``tty19'', from being used for games, the entry
+ would be:
+
+ badtty /dev/tty19
+
+ Any day/hour combination listed after the keyword ``time'' will disallow
+ games during those hours. Entries consist of four white-space separated
+ fields: the string ``time'', the unabbreviated day of the week and the
+ beginning and ending time of a period of the day when games may not be
+ played. The time fields are in a 0 based, 24-hour clock. For example,
+ the following entry allows games playing before 8AM and after 5PM on Mon-
+ days.
+
+ time Monday 8 17
+
+ Any game listed after the keyword ``game'' will set parameters for a spe-
+ cific game. Entries consist of five white-space separated fields: the
+ keyword ``game'', the name of a game, the highest system load average at
+ which the game may be played, the maximum users allowed if the game is to
+ be played, and the priority at which the game is to be run. Any of these
+ fields may start with a non-numeric character, resulting in no game limi-
+ tation or priority based on that field. The game "default" controls the
+ settings for any game not otherwise listed, and must be the last ``game''
+ entry in the file. Priorities may not be negative. For example, the
+ following entries limits the game ``hack'' to running only when the sys-
+ tem has 10 or less users and a load average of 5 or less; all other games
+ may be run any time the system has 15 or less users.
+
+ game hack 5 10 *
+ game default * 15 *
+
+FFIILLEESS
+ /etc/dm.conf The dm(8) configuration file.
+
+SSEEEE AALLSSOO
+ setpriority(2), ttyname(3), dm(8)
+
+4.2 Berkeley Distribution May 10, 1991 2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dm/dm.conf.5 b/dm/dm.conf.5
new file mode 100644
index 00000000..e856385d
--- /dev/null
+++ b/dm/dm.conf.5
@@ -0,0 +1,99 @@
+.\" Copyright (c) 1988, 1991 Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" 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.
+.\"
+.\" @(#)dm.conf.5 5.8 (Berkeley) 5/10/91
+.\"
+.Dd May 10, 1991
+.Dt DM.CONF 5
+.Os BSD 4.2
+.Sh NAME
+.Nm dm.conf
+.Nd \&dm configuration file
+.Sh DESCRIPTION
+The
+.Xr dm.conf
+file
+is the configuration file for the
+.Xr \&dm 8
+program.
+It consists of lines beginning with one of three keywords, ``badtty'',
+``game'', and ``time''. All other lines are ignored.
+.Pp
+Any tty listed after the keyword ``badtty'' may not have games played on
+it.
+Entries consist of two white-space separated fields: the string
+``badtty'' and the ttyname as returned by
+.Xr ttyname 3 .
+For example,
+to keep the uucp dialout, ``tty19'', from being used for games, the
+entry would be:
+.Bd -literal -offset indent
+badtty /dev/tty19
+.Ed
+.Pp
+Any day/hour combination listed after the keyword ``time'' will disallow
+games during those hours. Entries consist of four white-space separated
+fields: the string ``time'', the unabbreviated day of the week and the
+beginning and ending time of a period of the day when games may not be
+played. The time fields are in a 0 based, 24-hour clock. For example,
+the following entry allows games playing before 8AM and after 5PM on
+Mondays.
+.Bd -literal -offset indent
+time Monday 8 17
+.Ed
+.Pp
+Any game listed after the keyword ``game'' will set parameters for a specific
+game. Entries consist of five white-space separated fields: the keyword
+``game'', the name of a game, the highest system load average at which the
+game may be played, the maximum users allowed if the game is to be played,
+and the priority at which the game is to be run. Any of these fields may
+start with a non-numeric character, resulting in no game limitation or
+priority based on that field. The game "default" controls the settings for
+any game not otherwise listed, and must be the last ``game'' entry in the
+file. Priorities may not be negative. For example, the following entries
+limits the game ``hack'' to running only when the system has 10 or less
+users and a load average of 5 or less; all other games may be run any time
+the system has 15 or less users.
+.Bd -literal -offset indent
+game hack 5 10 *
+game default * 15 *
+.Ed
+.Sh FILES
+.Bl -tag -width /etc/dm.conf -compact
+.It Pa /etc/dm.conf
+The
+.Xr \&dm 8
+configuration file.
+.El
+.Sh SEE ALSO
+.Xr setpriority 2 ,
+.Xr ttyname 3 ,
+.Xr dm 8
diff --git a/dm/pathnames.h b/dm/pathnames.h
new file mode 100644
index 00000000..44d36b13
--- /dev/null
+++ b/dm/pathnames.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * @(#)pathnames.h 5.3 (Berkeley) 6/26/90
+ */
+
+#define _PATH_CONFIG "/etc/dm.conf"
+#define _PATH_HIDE "/usr/games/hide/"
+#define _PATH_LOG "/var/log/games.log"
+#define _PATH_NOGAMES "/etc/nogames"