shithub: choc

Download patch

ref: 34a3dfd2803163e92216988a8194c596c61a711f
parent: a602d1dba6523e45a76d472f8fce31e92d820dab
author: Simon Howard <fraggle@gmail.com>
date: Wed Sep 7 17:30:42 EDT 2005

Remove non-ANSI C headers. Use standard C file I/O functions.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 84

--- a/src/m_menu.c
+++ b/src/m_menu.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: m_menu.c 66 2005-09-04 14:51:19Z fraggle $
+// $Id: m_menu.c 84 2005-09-07 21:30:42Z fraggle $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -22,6 +22,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.6  2005/09/07 21:30:42  fraggle
+// Remove non-ANSI C headers.  Use standard C file I/O functions.
+//
 // Revision 1.5  2005/09/04 14:51:19  fraggle
 // Display the correct quit messages according to which game is being played.
 // Remove "language" variable (do this through gettext, if ever)
@@ -46,12 +49,8 @@
 //-----------------------------------------------------------------------------
 
 static const char
-rcsid[] = "$Id: m_menu.c 66 2005-09-04 14:51:19Z fraggle $";
+rcsid[] = "$Id: m_menu.c 84 2005-09-07 21:30:42Z fraggle $";
 
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
 #include <stdlib.h>
 #include <ctype.h>
 
@@ -87,6 +86,7 @@
 #include "m_menu.h"
 
 
+extern void M_QuitDOOM(int);
 
 extern patch_t*		hu_font[HU_FONTSIZE];
 extern boolean		message_dontfuckwithme;
@@ -533,9 +533,9 @@
 //
 void M_ReadSaveStrings(void)
 {
-    int             handle;
-    int             count;
-    int             i;
+    FILE   *handle;
+    int     count;
+    int     i;
     char    name[256];
 	
     for (i = 0;i < load_end;i++)
@@ -545,15 +545,15 @@
 	else
 	    sprintf(name,SAVEGAMENAME"%d.dsg",i);
 
-	handle = open (name, O_RDONLY | 0, 0666);
-	if (handle == -1)
+	handle = fopen(name, "rb");
+	if (handle == NULL)
 	{
-	    strcpy(&savegamestrings[i][0],EMPTYSTRING);
+	    strcpy(&savegamestrings[i][0], EMPTYSTRING);
 	    LoadMenu[i].status = 0;
 	    continue;
 	}
-	count = read (handle, &savegamestrings[i], SAVESTRINGSIZE);
-	close (handle);
+	count = fread(&savegamestrings[i], 1, SAVESTRINGSIZE, handle);
+	fclose(handle);
 	LoadMenu[i].status = 1;
     }
 }