With a small update, it'll save perror() output: greerga@cambot:~/circle30bpl11/freopen$ tail ../log/syslog Tue Oct 21 09:27:28 :: Losing player: Azalin. Tue Oct 21 09:27:28 :: No connections. Going to sleep. Tue Oct 21 09:27:32 :: New connection. Waking up. gethostbyaddr: Error 0 Tue Oct 21 09:27:34 :: Azalin [134.053.147.032] has connected. Tue Oct 21 09:27:35 :: Azalin retrieving crash-saved items and entering game. Tue Oct 21 09:27:40 :: (GC) Shutdown by Azalin. Tue Oct 21 09:27:40 :: Closing all sockets. Tue Oct 21 09:27:40 :: Closing link to: Azalin. Tue Oct 21 09:27:40 :: Normal termination of game. Standard ANSI C function...MSVC claims to support it. diff -upPr -x *.o ../done/filelog/comm.c ./comm.c --- ../done/filelog/comm.c Mon Oct 20 15:07:44 1997 +++ ./comm.c Tue Oct 21 09:17:15 1997 @@ -144,7 +144,7 @@ int main(int argc, char **argv) dir = DFLT_DIR; /* Be nice to make this a command line option but the parser uses log() */ - if (*LOGFILE != '\0' && !(logfile = fopen(LOGFILE, "w"))) { + if (*LOGFILE != '\0' && !(logfile = freopen(LOGFILE, "w", stderr))) { fprintf(stdout, "Error opening log file!\n"); exit(1); } diff -upPr -x *.o ../done/filelog/utils.c ./utils.c --- ../done/filelog/utils.c Mon Oct 20 15:06:30 1997 +++ ./utils.c Tue Oct 21 09:26:47 1997 @@ -133,6 +133,7 @@ void log(char *str) tmstr = asctime(localtime(&ct)); *(tmstr + strlen(tmstr) - 1) = '\0'; fprintf(logfile, "%-19.19s :: %s\n", tmstr, str); + fflush(logfile); } @@ -166,8 +167,10 @@ void mudlog(char *str, char type, int le ct = time(0); tmp = asctime(localtime(&ct)); - if (file) + if (file) { fprintf(logfile, "%-19.19s :: %s\n", tmp, str); + fflush(logfile); + } if (level < 0) return; -- George Greer - Me@Null.net | Genius may have its limitations, but stupidity http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard +------------------------------------------------------------+ | 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/08/00 PST