comparison urogue/main.c @ 268:4ab49e42dd6a

UltraRogue: add logging. The log file's name is temporarily defined in main.c.
author John "Elwin" Edwards
date Sun, 26 Feb 2017 16:51:29 -0500
parents 08057be02f47
children a413bc97d3ea
comparison
equal deleted inserted replaced
267:911f0aa6e758 268:4ab49e42dd6a
26 #include <errno.h> 26 #include <errno.h>
27 #include "rogue.h" 27 #include "rogue.h"
28 28
29 #define SAVEDIR "." 29 #define SAVEDIR "."
30 #define SCOREFILE "/var/local/games/roguelike/urogue.scr" 30 #define SCOREFILE "/var/local/games/roguelike/urogue.scr"
31 #define LOGFILE "/var/local/games/roguelike/urogue.log"
31 32
32 FILE *fd_score = NULL; 33 FILE *fd_score = NULL;
34 FILE *file_log = NULL;
33 35
34 /* Command line options */ 36 /* Command line options */
35 37
36 int prscore; /* Print scores */ 38 int prscore; /* Print scores */
37 int prversion; /* Print version info */ 39 int prversion; /* Print version info */
104 106
105 fd_score = fopen(score_file, "r+"); 107 fd_score = fopen(score_file, "r+");
106 108
107 if (fd_score == NULL) 109 if (fd_score == NULL)
108 fd_score = fopen(score_file, "a+"); 110 fd_score = fopen(score_file, "a+");
111
112 #ifdef LOGFILE
113 file_log = fopen(LOGFILE, "a+");
114 #endif
109 115
110 if (!use_savedir) 116 if (!use_savedir)
111 md_normaluser(); 117 md_normaluser();
112 118
113 if ((env = getenv("OPTIONS")) != NULL) 119 if ((env = getenv("OPTIONS")) != NULL)