mirror of
https://github.com/vattam/BSDGames.git
synced 2025-12-21 03:14:50 +00:00
releasing version 2.17-1
git-svn-id: file:///srv/svn/joey/trunk/src/packages/bsdgames@11092 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
a.out
|
||||
*.d
|
||||
*.i
|
||||
*.s
|
||||
*.d.tmp
|
||||
dm
|
||||
pathnames.h
|
||||
dm.8
|
||||
dm.conf.5
|
||||
12
dm/dm.c
12
dm/dm.c
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dm.c,v 1.20 2004/02/08 22:23:50 jsm Exp $ */
|
||||
/* $NetBSD: dm.c,v 1.21 2004/11/05 21:30:32 dsl Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993
|
||||
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)dm.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: dm.c,v 1.20 2004/02/08 22:23:50 jsm Exp $");
|
||||
__RCSID("$NetBSD: dm.c,v 1.21 2004/11/05 21:30:32 dsl Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -173,7 +173,7 @@ c_day(s_day, s_start, s_stop)
|
||||
ct = localtime(&now);
|
||||
if (strcasecmp(s_day, days[ct->tm_wday]))
|
||||
return;
|
||||
if (!isdigit(*s_start) || !isdigit(*s_stop))
|
||||
if (!isdigit((unsigned char)*s_start) || !isdigit((unsigned char)*s_stop))
|
||||
return;
|
||||
start = atoi(s_start);
|
||||
stop = atoi(s_stop);
|
||||
@@ -221,11 +221,11 @@ c_game(s_game, s_load, s_users, s_priority)
|
||||
if (strcmp(game, s_game) && strcasecmp("default", s_game))
|
||||
return;
|
||||
++found;
|
||||
if (isdigit(*s_load) && atoi(s_load) < load())
|
||||
if (isdigit((unsigned char)*s_load) && atoi(s_load) < load())
|
||||
errx(0, "Sorry, the load average is too high right now.");
|
||||
if (isdigit(*s_users) && atoi(s_users) <= users())
|
||||
if (isdigit((unsigned char)*s_users) && atoi(s_users) <= users())
|
||||
errx(0, "Sorry, there are too many users logged on right now.");
|
||||
if (isdigit(*s_priority))
|
||||
if (isdigit((unsigned char)*s_priority))
|
||||
priority = atoi(s_priority);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: utmpentry.c,v 1.4 2003/02/12 17:39:36 christos Exp $ */
|
||||
/* $NetBSD: utmpentry.c,v 1.5 2004/10/22 15:50:47 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: utmpentry.c,v 1.4 2003/02/12 17:39:36 christos Exp $");
|
||||
__RCSID("$NetBSD: utmpentry.c,v 1.5 2004/10/22 15:50:47 christos Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
@@ -94,6 +94,7 @@ setup(const char *fname)
|
||||
{
|
||||
int what = 3;
|
||||
struct stat st;
|
||||
const char *sfname;
|
||||
|
||||
if (fname == NULL) {
|
||||
#ifdef SUPPORT_UTMPX
|
||||
@@ -110,38 +111,49 @@ setup(const char *fname)
|
||||
if (what == 1) {
|
||||
#ifdef SUPPORT_UTMPX
|
||||
if (utmpxname(fname) == 0)
|
||||
err(1, "Cannot open `%s'", fname);
|
||||
warnx("Cannot set utmpx file to `%s'",
|
||||
fname);
|
||||
#else
|
||||
errx(1, "utmpx support not compiled in");
|
||||
warnx("utmpx support not compiled in");
|
||||
#endif
|
||||
} else {
|
||||
#ifdef SUPPORT_UTMP
|
||||
if (utmpname(fname) == 0)
|
||||
err(1, "Cannot open `%s'", fname);
|
||||
warnx("Cannot set utmp file to `%s'",
|
||||
fname);
|
||||
#else
|
||||
errx(1, "utmp support not compiled in");
|
||||
warnx("utmp support not compiled in");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef SUPPORT_UTMPX
|
||||
if (what & 1) {
|
||||
(void)stat(fname ? fname : _PATH_UTMPX, &st);
|
||||
if (st.st_mtime > utmpxtime)
|
||||
utmpxtime = st.st_mtime;
|
||||
else
|
||||
sfname = fname ? fname : _PATH_UTMPX;
|
||||
if (stat(sfname, &st) == -1) {
|
||||
warn("Cannot stat `%s'", sfname);
|
||||
what &= ~1;
|
||||
} else {
|
||||
if (st.st_mtime > utmpxtime)
|
||||
utmpxtime = st.st_mtime;
|
||||
else
|
||||
what &= ~1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef SUPPORT_UTMP
|
||||
if (what & 2) {
|
||||
(void)stat(fname ? fname : _PATH_UTMP, &st);
|
||||
if (st.st_mtime > utmptime)
|
||||
utmptime = st.st_mtime;
|
||||
else
|
||||
sfname = fname ? fname : _PATH_UTMP;
|
||||
if (stat(sfname, &st) == -1) {
|
||||
warn("Cannot stat `%s'", sfname);
|
||||
what &= ~2;
|
||||
} else {
|
||||
if (st.st_mtime > utmptime)
|
||||
utmptime = st.st_mtime;
|
||||
else
|
||||
what &= ~2;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return what;
|
||||
}
|
||||
#endif
|
||||
@@ -179,10 +191,13 @@ getutentries(const char *fname, struct utmpentry **epp)
|
||||
struct utmpentry *ep;
|
||||
int what = setup(fname);
|
||||
struct utmpentry **nextp = &ehead;
|
||||
if (what == 0) {
|
||||
switch (what) {
|
||||
case 0:
|
||||
/* No updates */
|
||||
*epp = ehead;
|
||||
return numutmp;
|
||||
} else {
|
||||
default:
|
||||
/* Need to re-scan */
|
||||
ehead = NULL;
|
||||
numutmp = 0;
|
||||
}
|
||||
@@ -192,8 +207,10 @@ getutentries(const char *fname, struct utmpentry **epp)
|
||||
while ((what & 1) && (utx = getutxent()) != NULL) {
|
||||
if (fname == NULL && utx->ut_type != USER_PROCESS)
|
||||
continue;
|
||||
if ((ep = calloc(1, sizeof(struct utmpentry))) == NULL)
|
||||
err(1, NULL);
|
||||
if ((ep = calloc(1, sizeof(struct utmpentry))) == NULL) {
|
||||
warn(NULL);
|
||||
return 0;
|
||||
}
|
||||
getentryx(ep, utx);
|
||||
*nextp = ep;
|
||||
nextp = &(ep->next);
|
||||
@@ -213,8 +230,10 @@ getutentries(const char *fname, struct utmpentry **epp)
|
||||
}
|
||||
if (ep != NULL)
|
||||
continue;
|
||||
if ((ep = calloc(1, sizeof(struct utmpentry))) == NULL)
|
||||
err(1, NULL);
|
||||
if ((ep = calloc(1, sizeof(struct utmpentry))) == NULL) {
|
||||
warn(NULL);
|
||||
return 0;
|
||||
}
|
||||
getentry(ep, ut);
|
||||
*nextp = ep;
|
||||
nextp = &(ep->next);
|
||||
|
||||
Reference in New Issue
Block a user