]> git.cameronkatri.com Git - bsdgames-darwin.git/blobdiff - dm/dm.c
Clarify how one is supposed to use the pointers returned by getutentries()
[bsdgames-darwin.git] / dm / dm.c
diff --git a/dm/dm.c b/dm/dm.c
index 4dd2553abf55cb4eaddede33e3b22fe721a32659..24833da5a54493f7eba022c47d6ba55049e3ef28 100644 (file)
--- a/dm/dm.c
+++ b/dm/dm.c
@@ -1,4 +1,4 @@
-/*     $NetBSD: dm.c,v 1.22 2005/07/02 08:35:29 jmc Exp $      */
+/*     $NetBSD: dm.c,v 1.25 2008/07/13 20:07:48 dholland 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.22 2005/07/02 08:35:29 jmc Exp $");
+__RCSID("$NetBSD: dm.c,v 1.25 2008/07/13 20:07:48 dholland Exp $");
 #endif
 #endif /* not lint */
 
@@ -72,12 +72,12 @@ void        c_tty(const char *);
 const char *hour(int);
 double load(void);
 void   nogamefile(void);
-void   play(char **) __attribute__((__noreturn__));
+void   play(char **) __dead;
 void   read_config(void);
 int    users(void);
 
 int
-main(int argc __attribute__((__unused__)), char *argv[])
+main(int argc __unused, char *argv[])
 {
        char *cp;
 
@@ -130,19 +130,19 @@ read_config(void)
        while (fgets(lbuf, sizeof(lbuf), cfp))
                switch (*lbuf) {
                case 'b':               /* badtty */
-                       if (sscanf(lbuf, "%s%s", f1, f2) != 2 ||
+                       if (sscanf(lbuf, "%39s%39s", f1, f2) != 2 ||
                            strcasecmp(f1, "badtty"))
                                break;
                        c_tty(f2);
                        break;
                case 'g':               /* game */
-                       if (sscanf(lbuf, "%s%s%s%s%s",
+                       if (sscanf(lbuf, "%39s%39s%39s%39s%39s",
                            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 ||
+                       if (sscanf(lbuf, "%39s%39s%39s%39s", f1, f2, f3, f4) != 4 ||
                            strcasecmp(f1, "time"))
                                break;
                        c_day(f2, f3, f4);
@@ -247,15 +247,10 @@ load(void)
 int
 users(void)
 {
-       static struct utmpentry *ohead = NULL;  
        struct utmpentry *ep;
        int nusers;
 
        nusers = getutentries(NULL, &ep);
-       if (ep != ohead) {
-               freeutentries(ep);
-               ohead = ep;
-       }
        return nusers;
 }