diff arogue5/main.c @ 218:56e748983fa8

Advanced Rogue 5: convert to ANSI function declarations. This still leaves over a thousand lines of warning messages, mostly related to the return types of daemons and fuses.
author John "Elwin" Edwards
date Sun, 07 Feb 2016 14:39:21 -0500
parents aac28331e71d
children 3d4252fa2ed3
line wrap: on
line diff
--- a/arogue5/main.c	Sun Jan 31 13:45:07 2016 -0500
+++ b/arogue5/main.c	Sun Feb 07 14:39:21 2016 -0500
@@ -43,10 +43,10 @@
 #define NFRUIT (sizeof(funfruit) / sizeof (char *))
 
 void open_records(void);
+bool holiday(void);
 
-main(argc, argv, envp)
-char **argv;
-char **envp;
+int
+main(int argc, char *argv[], char *envp[])
 {
     register char *env;
     int lowtime;
@@ -123,7 +123,6 @@
      * Check for a network update
      */
     if (argc == 2 && strcmp(argv[1], "-u") == 0) {
-	unsigned long netread();
 	int errcheck, errors = 0;
 	unsigned long amount;
 	short monster;
@@ -277,8 +276,8 @@
  *	Exit the program, printing a message.
  */
 
-fatal(s)
-char *s;
+void
+fatal(char *s)
 {
     clear();
     move(LINES-2, 0);
@@ -294,8 +293,8 @@
  *	Pick a very random number.
  */
 
-rnd(range)
-register int range;
+int
+rnd(int range)
 {
     return(range == 0 ? 0 : md_rand() % range);
 }
@@ -305,8 +304,8 @@
  *	roll a number of dice
  */
 
-roll(number, sides)
-register int number, sides;
+int
+roll(int number, int sides)
 {
     register int dtotal = 0;
 
@@ -336,10 +335,11 @@
 }
 # endif
 
-setup()
+void
+setup(void)
 {
 #ifdef CHECKTIME
-    int  checkout();
+    void  checkout();
 #endif
 
 #ifndef DUMP
@@ -392,7 +392,8 @@
  * refreshing things and looking at the proper times.
  */
 
-playit()
+void
+playit(void)
 {
     register char *opts;
 
@@ -416,7 +417,8 @@
 /*
  * see if the system is being used too much for this game
  */
-too_much()
+bool
+too_much(void)
 {
 #ifdef MAXLOAD
 	double avec[3];
@@ -435,7 +437,8 @@
  * author:
  *	See if a user is an author of the program
  */
-author()
+bool
+author(void)
 {
 	switch (md_getuid()) {
 #if AUTHOR
@@ -450,7 +453,24 @@
 
 
 #ifdef CHECKTIME
-checkout()
+/*
+ * checkout()'s version of msg.  If we are in the middle of a shell, do a
+ * printf instead of a msg to avoid the refresh.
+ */
+void
+chmsg(char *fmt, int arg)
+{
+	if (in_shell) {
+		printf(fmt, arg);
+		putchar('\n');
+		fflush(stdout);
+	}
+	else
+		msg(fmt, arg);
+}
+
+void
+checkout(void)
 {
 	static char *msgs[] = {
 	"The system is too loaded for games. Please leave in %d minutes",
@@ -482,23 +502,6 @@
 	    alarm(CHECKTIME * 60);
 	}
 }
-
-/*
- * checkout()'s version of msg.  If we are in the middle of a shell, do a
- * printf instead of a msg to avoid the refresh.
- */
-chmsg(fmt, arg)
-char *fmt;
-int arg;
-{
-	if (in_shell) {
-		printf(fmt, arg);
-		putchar('\n');
-		fflush(stdout);
-	}
-	else
-		msg(fmt, arg);
-}
 #endif
 
 #ifdef LOADAV
@@ -510,8 +513,8 @@
 	"_avenrun"
 };
 
-loadav(avg)
-reg double *avg;
+void
+loadav(double *avg)
 {
 	reg int kmem;
 
@@ -536,7 +539,8 @@
 #include <sys/types.h>
 #include <utmp.h>
 struct utmp buf;
-ucount()
+int
+ucount(void)
 {
 	reg struct utmp *up;
 	reg FILE *utmp;
@@ -559,7 +563,8 @@
  * holiday:
  *	Returns TRUE when it is a good time to play rogue
  */
-holiday()
+bool
+holiday(void)
 {
 	time_t now;
 	struct tm *localtime();