[CODE]Win95 log

From: Aaron Throckmorton (throck@NFINITY.COM)
Date: 09/05/98

Even though there are 2 snippets already out there for making Circle log
to a file in Windows95, neither one (of the ones I've seen) support the
full functionality of the log file.  Here is my code to fix this.  It
allows for logging to the dos window as well as to a file, with all
formatting codes properly displayed.

Output of STDOUT has to be redirected to log.txt in your batch file (
circle.exe >> log.txt).

First, at the top of utils.c, after all the includes put this line:

#include "stdarg.h"

Then, in basic_mud_log(), make theses changes:

void basic_mud_log(const char *format, ...)
  va_list args;
  time_t ct = time(0);

  char *time_s = asctime(localtime(&ct));

  time_s[strlen(time_s) - 1] = '\0';

- fprintf(logfile, "%-15.15s :: ", time_s + 4);
+ fprintf(stderr, "%-15.15s :: ", time_s + 4);
+ printf("%-15.15s :: ", time_s + 4);

  va_start(args, format);
- vfprintf(logfile, format, args);
+ vfprintf(stderr, format, args);
+ vprintf(format, args);

- fprintf(logfile, "\n");
+ fprintf(stderr, "\n");
+ printf("\n");
- fflush(logfile);
+ fflush(stderr);

Basically it comes down to changing all the logfile to stderr, and
adding standard printf statements for each write.

If you use this, please email me to let me know.  Also, if you have any
problems let me know, I would like to help out (as well as know how I
screwed it up  :)


     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |

This archive was generated by hypermail 2b30 : 12/15/00 PST