Mercurial > hg > early-roguelike
comparison rogue3/rip.c @ 19:a86ae56e1ed6
rogue3: make LOGFILE work with SAVEDIR
| author | edwarj4 |
|---|---|
| date | Wed, 11 Nov 2009 02:41:47 +0000 |
| parents | 95e2bbb7b6e0 |
| children | 8bd134f676be |
comparison
equal
deleted
inserted
replaced
| 18:95e2bbb7b6e0 | 19:a86ae56e1ed6 |
|---|---|
| 117 #else | 117 #else |
| 118 scoreboard = NULL; | 118 scoreboard = NULL; |
| 119 #endif | 119 #endif |
| 120 } | 120 } |
| 121 | 121 |
| 122 #if 0 /* not necessary */ | |
| 123 /* Same thing, but for the log file. Maybe combine them eventually. */ | 122 /* Same thing, but for the log file. Maybe combine them eventually. */ |
| 124 /* FIXME you don't know what this does */ | |
| 125 void open_log(void) | 123 void open_log(void) |
| 126 { | 124 { |
| 127 #ifdef LOGFILE | 125 #ifdef LOGFILE |
| 128 if (logfi != NULL) { | |
| 129 rewind(logfi); | |
| 130 return; | |
| 131 } | |
| 132 | |
| 133 logfi = fopen(LOGFILE, "a"); | 126 logfi = fopen(LOGFILE, "a"); |
| 134 | 127 |
| 135 if (logfi == NULL) | 128 if (logfi == NULL) |
| 136 { | 129 { |
| 137 fprintf(stderr, "Could not open %s for appending: %s\n", LOGFILE, strerror(errno)); | 130 fprintf(stderr, "Could not open %s for appending: %s\n", LOGFILE, strerror(errno)); |
| 140 #else | 133 #else |
| 141 logfi == NULL; | 134 logfi == NULL; |
| 142 #endif | 135 #endif |
| 143 return; | 136 return; |
| 144 } | 137 } |
| 145 #endif | |
| 146 | 138 |
| 147 /* VARARGS2 */ | 139 /* VARARGS2 */ |
| 148 void | 140 void |
| 149 score(int amount, int flags, int monst) | 141 score(int amount, int flags, int monst) |
| 150 { | 142 { |
| 353 strcat(logmessage, ltemp); | 345 strcat(logmessage, ltemp); |
| 354 } | 346 } |
| 355 else | 347 else |
| 356 return; | 348 return; |
| 357 | 349 |
| 358 logfi = fopen(LOGFILE, "a"); /* permissions? */ | |
| 359 if (logfi == NULL) | 350 if (logfi == NULL) |
| 360 return; | 351 return; |
| 361 /* and write it */ | 352 /* and write it */ |
| 362 md_lockfile(logfi); | 353 md_lockfile(logfi); |
| 363 fprintf(logfi, "%s", logmessage); | 354 fprintf(logfi, "%s", logmessage); |
