Replace fDATIME with ANSI/POSIX clock_gettime(). Rip out DOS/AMIGA shims.
[open-adventure.git] / misc.c
diff --git a/misc.c b/misc.c
index e3e8320b5e4c6d67f7dbcd6b72ea69c476911f6f..18b0e6c20fa41a023991f4c3ff50a68c1c26508d 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -1,10 +1,15 @@
+#include <stdlib.h>
+#include <stdio.h>
 #include "main.h"
 #include "misc.h"
-#include <stdio.h>
+#include "funcs.h"
 
 #define TRUE  (0==0)
 #define FALSE (0!=0)
 
+/* hack to ignore GCC Unused Result */
+#define IGNORE(r) do{if(r){}}while(0)
+
 /*  I/O ROUTINES (SPEAK, PSPEAK, RSPEAK, SETPRM, GETIN, YES) */
 
 #undef SPEAK
@@ -839,7 +844,7 @@ void fBUG(NUM)long NUM; {
  *     28      INVALID MONTH RETURNED BY DATE FUNCTION
  *     29      TOO MANY PARAMETERS GIVEN TO SETPRM */
 
-       printf("Fatal error %d.  See source code for interpretation.\n",
+       printf("Fatal error %ld.  See source code for interpretation.\n",
           NUM);
        exit(FALSE);
 }
@@ -888,19 +893,15 @@ long I, VAL; static FILE *OPENED = NULL;
        if(MAP2[1] == 0)MPINIT();
 
        if(FIL) goto L15;
-       gets(INLINE+1);
+       IGNORE(fgets(INLINE+1, sizeof(INLINE)-1, stdin));
        if(feof(stdin)) score(1);
         goto L20;
 
 L15:   if(!OPENED){
-#ifdef AMIGA
-               OPENED=fopen("ram:adventure.text","r" /* NOT binary */);
-               if(!OPENED)
-#endif
                OPENED=fopen("adventure.text","r" /* NOT binary */);
                if(!OPENED){printf("Can't read adventure.text!\n"); exit(FALSE);}
                }
-       fgets(INLINE+1,100,OPENED);
+        IGNORE(fgets(INLINE+1,100,OPENED));
 
 L20:   LNLENG=0;
        /* 25 */ for (I=1; I<=100 && INLINE[I]!=0; I++) {
@@ -1002,12 +1003,12 @@ L10:    fclose(F);
        return;
 
 L20:   printf("\nFile name: ");
-       gets(NAME);
+       IGNORE(fgets(NAME, sizeof(NAME), stdin));
        F=fopen(NAME,(IN ? READ_MODE : WRITE_MODE));
        if(F == NULL) {printf("Can't open file, try again.\n"); goto L20;}
        return;
 
-L30:   if(IN)fread(ARR,4,250,F);
+L30:   if(IN)IGNORE(fread(ARR,4,250,F));
        if(!IN)fwrite(ARR,4,250,F);
        return;