diff arogue5/io.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 c49f7927b0fa
children
line wrap: on
line diff
--- a/arogue5/io.c	Sun Jan 31 13:45:07 2016 -0500
+++ b/arogue5/io.c	Sun Feb 07 14:39:21 2016 -0500
@@ -18,6 +18,9 @@
 #include <stdarg.h>
 #include "rogue.h"
 
+void doadd(char *fmt, va_list ap);
+void ministat(void);
+
 /*
  * msg:
  *	Display a message at the top of the screen.
@@ -27,6 +30,7 @@
 static int newpos = 0;
 
 /*VARARGS1*/
+void
 msg(char *fmt, ...)
 {
     va_list ap;
@@ -54,6 +58,7 @@
 /*
  * add things to the current message
  */
+void
 addmsg(char *fmt, ...)
 {
     va_list ap;
@@ -66,7 +71,8 @@
  * Display a new msg (giving him a chance to see the previous one if it
  * is up there with the --More--)
  */
-endmsg()
+void
+endmsg(void)
 {
     strncpy(huh, msgbuf, sizeof(huh));
 
@@ -96,6 +102,7 @@
     draw(msgw);
 }
 
+void
 doadd(char *fmt, va_list ap)
 {
     /*
@@ -113,9 +120,8 @@
  *	flgptr will be NULL if we don't know what the monster is yet!
  */
 
-step_ok(y, x, can_on_monst, flgptr)
-register int y, x, can_on_monst;
-register struct thing *flgptr;
+bool
+step_ok(int y, int x, int can_on_monst, struct thing *flgptr)
 {
     /* can_on_monst = MONSTOK if all we care about are physical obstacles */
     register struct linked_list *item;
@@ -156,7 +162,8 @@
  *	returns true if it is ok for type to shoot over ch
  */
 
-shoot_ok(ch)
+bool
+shoot_ok(char ch)
 {
     switch (ch)
     {
@@ -177,7 +184,8 @@
  *	getchar.
  */
 
-readchar()
+int
+readchar(void)
 {
     int ch;
 
@@ -195,10 +203,11 @@
 /*
  * status:
  *	Display the important stats line.  Keep the cursor where it was.
+ *	If display is TRUE, display unconditionally
  */
 
-status(display)
-bool display;	/* is TRUE, display unconditionally */
+void
+status(bool display)
 {
     register struct stats *stat_ptr, *max_ptr;
     register int oy = 0, ox = 0, temp;
@@ -327,7 +336,8 @@
     wmove(cw, oy, ox);
 }
 
-ministat()
+void
+ministat(void)
 {
     register int oy, ox, temp;
     static char buf[LINELEN];
@@ -367,9 +377,8 @@
  *	Sit around until the guy types the right key
  */
 
-wait_for(win,ch)
-WINDOW *win;
-register char ch;
+void
+wait_for(WINDOW *win, char ch)
 {
     register char c;
 
@@ -386,9 +395,8 @@
  *	function used to display a window and wait before returning
  */
 
-show_win(scr, message)
-register WINDOW *scr;
-char *message;
+void
+show_win(WINDOW *scr, char *message)
 {
     mvwaddstr(scr, 0, 0, message);
     touchwin(scr);
@@ -403,9 +411,8 @@
  * dbotline:
  *	Displays message on bottom line and waits for a space to return
  */
-dbotline(scr,message)
-WINDOW *scr;
-char *message;
+void
+dbotline(WINDOW *scr, char *message)
 {
 	mvwaddstr(scr,LINES-1,0,message);
 	draw(scr);
@@ -417,8 +424,8 @@
  * restscr:
  *	Restores the screen to the terminal
  */
-restscr(scr)
-WINDOW *scr;
+void
+restscr(WINDOW *scr)
 {
 	clearok(scr,TRUE);
 	touchwin(scr);
@@ -431,10 +438,7 @@
  */
 
 unsigned long
-netread(error, size, stream)
-int *error;
-int size;
-FILE *stream;
+netread(int *error, int size, FILE *stream)
 {
     unsigned long result = 0L,	/* What we read in */
 		  partial;	/* Partial value */
@@ -469,12 +473,13 @@
 /*
  * netwrite:
  *	Write out a byte, short, or long machine independently.
+ * value:	What to write
+ * size:	How much to write out
+ * stream:	Where to write it
  */
 
-netwrite(value, size, stream)
-unsigned long value;	/* What to write */
-int size;	/* How much to write out */
-FILE *stream;	/* Where to write it */
+int
+netwrite(unsigned long value, int size, FILE *stream)
 {
     int i;	/* Goes through value one byte at a time */
     char outc;	/* The next character to be written */