X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=src%2Flog.c;h=cbdf59fbc61f06e132f4f27f235a662257b11926;hp=078a7ac9d9c8d00ba7ba8f32b0d4bb6d97fd2d16;hb=714ccdcd844314cc3902fa4fd1b48757d9db9296;hpb=0a0d73a03f87ca6393d49869604922ee884c6021 diff --git a/src/log.c b/src/log.c index 078a7ac9..cbdf59fb 100644 --- a/src/log.c +++ b/src/log.c @@ -43,6 +43,19 @@ as that of the covered work. */ #include "utils.h" #include "log.h" +/* 2005-10-25 SMS. + VMS log files are often VFC record format, not stream, so fputs() can + produce multiple records, even when there's no newline terminator in + the buffer. The result is unsightly output with spurious newlines. + Using fprintf() instead of fputs(), along with inhibiting some + fflush() activity below, seems to solve the problem. +*/ +#ifdef __VMS +# define FPUTS( s, f) fprintf( (f), "%s", (s)) +#else /* def __VMS */ +# define FPUTS( s, f) fputs( (s), (f)) +#endif /* def __VMS [else] */ + /* This file impplement support for "logging". Logging means printing output, plus several additional features: @@ -307,7 +320,7 @@ logputs (enum log_options o, const char *s) return; CHECK_VERBOSE (o); - fputs (s, fp); + FPUTS (s, fp); if (save_context_p) saved_append (s); if (flush_log_p) @@ -397,7 +410,7 @@ log_vprintf_internal (struct logvprintf_state *state, const char *fmt, /* Writing succeeded. */ saved_append (write_ptr); - fputs (write_ptr, fp); + FPUTS (write_ptr, fp); if (state->bigmsg) xfree (state->bigmsg); @@ -416,7 +429,19 @@ logflush (void) { FILE *fp = get_log_fp (); if (fp) - fflush (fp); + { +/* 2005-10-25 SMS. + On VMS, flush only for a terminal. See note at FPUTS macro, above. +*/ +#ifdef __VMS + if (isatty( fileno( fp))) + { + fflush (fp); + } +#else /* def __VMS */ + fflush (fp); +#endif /* def __VMS [else] */ + } needs_flushing = false; } @@ -583,13 +608,13 @@ log_dump_context (void) { struct log_ln *ln = log_lines + num; if (ln->content) - fputs (ln->content, fp); + FPUTS (ln->content, fp); ROT_ADVANCE (num); } while (num != log_line_current); if (trailing_line) if (log_lines[log_line_current].content) - fputs (log_lines[log_line_current].content, fp); + FPUTS (log_lines[log_line_current].content, fp); fflush (fp); }