diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | daemon.c | 12 | ||||
-rw-r--r-- | driver.c | 12 | ||||
-rw-r--r-- | fetchmail.h | 1 |
4 files changed, 20 insertions, 6 deletions
@@ -5,6 +5,7 @@ * Julian Haight's fix for his 5.4.1 patch, which created a potential memory leak. * Minor bug fixes for SSL by Wolfram Kleff. +* Be more clever about when we suppress progress dots. fetchmail-5.4.1 (Tue Jun 6 23:24:22 EDT 2000), 19051 lines: @@ -205,4 +205,16 @@ nottyDetach: return(0); } +flag isafile(int fd) +/* is the given fd attached to a file? (used to control logging) */ +{ + struct stat stbuf; + + if (fstat(fd, &stbuf)) + return(0); + else if (stbuf.st_mode & (S_IFREG | S_IFBLK)) + return(1); + return(0); +} + /* daemon.c ends here */ @@ -533,7 +533,7 @@ static int readheaders(int sock, sizeticker += linelen; while (sizeticker >= SIZETICKER) { - if (!run.use_syslog && isatty(1)) + if (!run.use_syslog && !isafile(1)) { fputc('.', stdout); fflush(stdout); @@ -1060,7 +1060,7 @@ static int readheaders(int sock, free_str_list(&msgblk.recipients); return(PS_IOERR); } - else if ((run.poll_interval == 0 || nodetach) && outlevel >= O_VERBOSE && isatty(2)) + else if ((run.poll_interval == 0 || nodetach) && outlevel >= O_VERBOSE && !isafile(2)) fputs("#", stderr); /* write error notifications */ @@ -1170,7 +1170,7 @@ static int readbody(int sock, struct query *ctl, flag forward, int len) sizeticker += linelen; while (sizeticker >= SIZETICKER) { - if ((run.poll_interval == 0 || nodetach) && outlevel > O_SILENT && isatty(1)) + if ((run.poll_interval == 0 || nodetach) && outlevel > O_SILENT && !isafile(1)) { fputc('.', stdout); fflush(stdout); @@ -1228,7 +1228,7 @@ static int readbody(int sock, struct query *ctl, flag forward, int len) release_sink(ctl); return(PS_IOERR); } - else if (outlevel >= O_VERBOSE && isatty(1)) + else if (outlevel >= O_VERBOSE && !isafile(1)) { fputc('*', stdout); fflush(stdout); @@ -2050,7 +2050,7 @@ const int maxfetch; /* maximum number of messages to fetch */ */ if (protocol->fetch_body && !suppress_readbody) { - if (outlevel >= O_VERBOSE && isatty(1)) + if (outlevel >= O_VERBOSE && !isafile(1)) { fputc('\n', stdout); fflush(stdout); @@ -2104,7 +2104,7 @@ const int maxfetch; /* maximum number of messages to fetch */ /* tell server we got it OK and resynchronize */ if (protocol->trail) { - if (outlevel >= O_VERBOSE && isatty(1)) + if (outlevel >= O_VERBOSE && !isafile(1)) { fputc('\n', stdout); fflush(stdout); diff --git a/fetchmail.h b/fetchmail.h index fd5403ed..efb16e47 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -518,6 +518,7 @@ void dump_config(struct runctl *runp, struct query *querylist); int is_host_alias(const char *, struct query *); char *host_fqdn(void); char *rfc822timestamp(void); +flag isafile(int); void yyerror(const char *); int yylex(void); |