games/dm WARNS6 patch

Peter Avalos pavalos at theshell.com
Sat Aug 5 10:25:28 PDT 2006


-WARNS6 cleanup (1 warning)
-staticize functions
-ANSI function declarations

Can also be downloaded at:
http://www.theshell.com/~pavalos/wip/dm.diff

--Peter
Index: games/dm/Makefile
===================================================================
RCS file: /home/dcvs/src/games/dm/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- games/dm/Makefile	17 Jun 2003 04:25:23 -0000	1.2
+++ games/dm/Makefile	5 Aug 2006 17:16:03 -0000
@@ -7,5 +7,6 @@
 MAN=	dm.8 dm.conf.5
 BINGRP= games
 BINMODE=2555
+WARNS?=	6
 
 .include <bsd.prog.mk>
Index: games/dm/dm.c
===================================================================
RCS file: /home/dcvs/src/games/dm/dm.c,v
retrieving revision 1.3
diff -u -r1.3 dm.c
--- games/dm/dm.c	12 Nov 2003 14:53:52 -0000	1.3
+++ games/dm/dm.c	5 Aug 2006 17:15:21 -0000
@@ -59,20 +59,21 @@
 static char	*game,			/* requested game */
 		*gametty;		/* from tty? */
 
-void c_day (char *, char *, char *);
-void c_tty (char *);
-void c_game (char *, char *, char *, char *);
-void hour (int);
-double load (void);
-void nogamefile (void);
-void play (char **);
-void read_config (void);
-int users (void);
+static void	c_day(char *, char *, char *);
+static void	c_tty(char *);
+static void	c_game(char *, char *, char *, char *);
+static void	hour(int);
+static double	load(void);
+static void	nogamefile(void);
+static void	play(char **);
+static void	read_config(void);
+static int	users(void);
+#ifdef LOG
+static void	logfile(void);
+#endif
 
 int
-main(argc, argv)
-	int argc;
-	char *argv[];
+main(__unused int argc, char *argv[])
 {
 	char *cp;
 
@@ -98,9 +99,8 @@
  * play --
  *	play the game
  */
-void
-play(args)
-	char **args;
+static void
+play(char **args)
 {
 	char pbuf[MAXPATHLEN];
 
@@ -122,8 +122,8 @@
  * read_config --
  *	read through config file, looking for key words.
  */
-void
-read_config()
+static void
+read_config(void)
 {
 	FILE *cfp;
 	char lbuf[BUFSIZ], f1[40], f2[40], f3[40], f4[40], f5[40];
@@ -157,9 +157,8 @@
  * c_day --
  *	if day is today, see if okay to play
  */
-void
-c_day(s_day, s_start, s_stop)
-	char *s_day, *s_start, *s_stop;
+static void
+c_day(char *s_day, char *s_start, char *s_stop)
 {
 	static const char *days[] = {
 		"sunday", "monday", "tuesday", "wednesday",
@@ -190,9 +189,8 @@
  * c_tty --
  *	decide if this tty can be used for games.
  */
-void
-c_tty(tty)
-	char *tty;
+static void
+c_tty(char *tty)
 {
 	static int first = 1;
 	static char *p_tty;
@@ -212,9 +210,8 @@
  * c_game --
  *	see if game can be played now.
  */
-void
-c_game(s_game, s_load, s_users, s_priority)
-	char *s_game, *s_load, *s_users, *s_priority;
+static void
+c_game(char *s_game, char *s_load, char *s_users, char *s_priority)
 {
 	static int found;
 
@@ -239,8 +236,8 @@
  * load --
  *	return 15 minute load average
  */
-double
-load()
+static double
+load(void)
 {
 	double avenrun[3];
 
@@ -257,8 +254,8 @@
  *	todo: check idle time; if idle more than X minutes, don't
  *	count them.
  */
-int
-users()
+static int
+users(void)
 {
 
 	int nusers, utmp;
@@ -275,8 +272,8 @@
 	return(nusers);
 }
 
-void
-nogamefile()
+static void
+nogamefile(void)
 {
 	int fd, n;
 	char buf[BUFSIZ];
@@ -294,9 +291,8 @@
  * hour --
  *	print out the hour in human form
  */
-void
-hour(h)
-	int h;
+static void
+hour(int h)
 {
 	switch(h) {
 	case 0:
@@ -318,7 +314,8 @@
  * logfile --
  *	log play of game
  */
-logfile()
+static void
+logfile(void)
 {
 	struct passwd *pw;
 	FILE *lp;
Attachment:
pgp00009.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00009.pgp
Type: application/octet-stream
Size: 189 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20060805/fa4016b7/attachment-0018.obj>


More information about the Submit mailing list