home
·
contact
·
privacy
projects
/
plomrogue
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Re-wrote map object system to use same structs for items and monsters, and switched...
[plomrogue]
/
src
/
readwrite.c
diff --git
a/src/readwrite.c
b/src/readwrite.c
index 09faaeb282dcb8a84731c5c1bce3c69b2dd41c77..657d8173dd674ecfa9528cfce9653ee5dd841449 100644
(file)
--- a/
src/readwrite.c
+++ b/
src/readwrite.c
@@
-2,7
+2,7
@@
#include "readwrite.h"
#include <stdio.h> /* for FILE typedef, fopen(), fgetc(), fputc(), fseek(),
#include "readwrite.h"
#include <stdio.h> /* for FILE typedef, fopen(), fgetc(), fputc(), fseek(),
- * sprintf(), fwrite()
+ * sprintf(), fwrite()
, ferror()
*/
#include <stdint.h> /* for uint8_t, uint16_t, uint32_t */
#include <string.h> /* for strlen()*/
*/
#include <stdint.h> /* for uint8_t, uint16_t, uint32_t */
#include <string.h> /* for strlen()*/
@@
-59,12
+59,14
@@
extern void try_fclose(FILE * file, struct World * w, char * f)
-extern
void
try_fgets(char * line, int linemax, FILE * file,
- struct World * w, char * f)
+extern
char *
try_fgets(char * line, int linemax, FILE * file,
+
struct World * w, char * f)
{
char * msg = trouble_msg(w, f, "fgets()");
{
char * msg = trouble_msg(w, f, "fgets()");
- exit_err(NULL == fgets(line, linemax, file), w, msg);
+ char * test = fgets(line, linemax, file);
+ exit_err(NULL == test && ferror(file), w, msg);
free(msg);
free(msg);
+ return test;
}
}