diff rogue4/mach_dep.c @ 215:1b73a8641b37

rogue4: fix most GCC5 warnings. Converting all function definitions to ANSI style accounts for most of the change. This has exposed other problems, such as daemons not actually being their stated type, that will require more careful solutions.
author John "Elwin" Edwards
date Wed, 27 Jan 2016 19:41:05 -0500
parents 5926ec314fd4
children d3968e9cb98d
line wrap: on
line diff
--- a/rogue4/mach_dep.c	Sat Jan 23 09:35:14 2016 -0500
+++ b/rogue4/mach_dep.c	Wed Jan 27 19:41:05 2016 -0500
@@ -47,11 +47,17 @@
 #endif
 #endif
 
+int too_much(void);
+bool author(void);
+void checkout(int s);
+void chmsg(char *fmt, int arg);
+
 /*
  * init_check:
  *	Check out too see if it is proper to play the game now
  */
-init_check()
+void
+init_check(void)
 {
     if (too_much())
     {
@@ -70,7 +76,8 @@
  *	Open up the score file for future use, and then
  *	setuid(getuid()) in case we are running setuid.
  */
-open_score()
+void
+open_score(void)
 {
 #ifdef SCOREFILE
     fd = open(SCOREFILE, O_RDWR | O_CREAT, 0666 );
@@ -82,7 +89,8 @@
     return;
 }
 
-void open_log(void)
+void
+open_log(void)
 {
 #ifdef LOGFILE
     lfd = open(LOGFILE, O_WRONLY | O_APPEND | O_CREAT, 0666);
@@ -96,12 +104,10 @@
  * setup:
  *	Get starting setup for all games
  */
-setup()
+void
+setup(void)
 {
     void  auto_save(), quit(), endit(), tstp();
-#ifdef CHECKTIME
-    int  checkout();
-#endif
 
     /*
      * make sure that large terminals don't overflow the bounds
@@ -158,7 +164,8 @@
  * start_score:
  *	Start the scoring sequence
  */
-start_score()
+void
+start_score(void)
 {
 #ifdef SIGALRM
     signal(SIGALRM, SIG_IGN);
@@ -169,8 +176,8 @@
  * issymlink:
  *	See if the file has a symbolic link
  */
-issymlink(sp)
-char *sp;
+bool
+issymlink(char *sp)
 {
 #ifdef S_IFLNK
     struct stat sbuf2;
@@ -188,7 +195,8 @@
  * too_much:
  *	See if the system is being used too much for this game
  */
-too_much()
+int
+too_much(void)
 {
 #ifdef MAXLOAD
     double avec[3];
@@ -208,7 +216,8 @@
  * author:
  *	See if a user is an author of the program
  */
-author()
+bool
+author(void)
 {
 #ifdef WIZARD
     if (wizard)
@@ -246,7 +255,7 @@
 	if (author())
 	{
 	    num_checks = 1;
-	    chmsg("The load is rather high, O exaulted one");
+	    chmsg("The load is rather high, O exaulted one", 0);
 	}
 	else if (num_checks++ == 3)
 	    fatal("Sorry.  You took to long.  You are dead\n");
@@ -265,7 +274,7 @@
 	if (num_checks)
 	{
 	    num_checks = 0;
-	    chmsg("The load has dropped back down.  You have a reprieve");
+	    chmsg("The load has dropped back down.  You have a reprieve", 0);
 	}
 #ifdef CHECKTIME
 #ifdef SIGALRM
@@ -280,9 +289,8 @@
  *	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;
+void
+chmsg(char *fmt, int arg)
 {
     if (in_shell)
     {
@@ -299,7 +307,8 @@
  *	lock the score file.  If it takes too long, ask the user if
  *	they care to wait.  Return TRUE if the lock is successful.
  */
-lock_sc()
+bool
+lock_sc(void)
 {
 #ifdef SCOREFILE
 #ifdef LOCKFILE
@@ -361,7 +370,8 @@
  * unlock_sc:
  *	Unlock the score file
  */
-unlock_sc()
+void
+unlock_sc(void)
 {
 #ifdef SCOREFILE
 #ifdef LOCKFILE
@@ -374,7 +384,8 @@
  * flush_type:
  *	Flush typeahead for traps, etc.
  */
-flush_type()
+void
+flush_type(void)
 {
     flushinp();
 }