aboutsummaryrefslogtreecommitdiffstats
path: root/transact.c
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2009-05-04 19:01:05 +0000
committerMatthias Andree <matthias.andree@gmx.de>2009-05-04 19:01:05 +0000
commit2d5717089b8c2be49f449388c2f045de8c52a245 (patch)
tree87ad7231adca36e28348118f7115135b4c42a31e /transact.c
parent5f08bfb0ffbef853f1086157e8fb9c5185ac6a6e (diff)
downloadfetchmail-2d5717089b8c2be49f449388c2f045de8c52a245.tar.gz
fetchmail-2d5717089b8c2be49f449388c2f045de8c52a245.tar.bz2
fetchmail-2d5717089b8c2be49f449388c2f045de8c52a245.zip
Factor out dots ticker function.
svn path=/branches/BRANCH_6-3/; revision=5278
Diffstat (limited to 'transact.c')
-rw-r--r--transact.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/transact.c b/transact.c
index 7f3d8dc2..efb65f3c 100644
--- a/transact.c
+++ b/transact.c
@@ -361,6 +361,23 @@ static char *parse_received(struct query *ctl, char *bufp)
/* shared by readheaders and readbody */
static int sizeticker;
+/** Print ticker based on a amount of data transferred of \a bytes.
+ * Increments \a *tickervar by \a bytes, and if it exceeds
+ * \a SIZETICKER, print a dot and reduce *tickervar by \a SIZETICKER. */
+static void print_ticker(int *tickervar, int bytes)
+{
+ *tickervar += bytes;
+ while (*tickervar >= SIZETICKER)
+ {
+ if (outlevel > O_SILENT && run.showdots && !run.use_syslog)
+ {
+ fputc('.', stdout);
+ fflush(stdout);
+ }
+ *tickervar -= SIZETICKER;
+ }
+}
+
#define EMPTYLINE(s) (((s)[0] == '\r' && (s)[1] == '\n' && (s)[2] == '\0') \
|| ((s)[0] == '\n' && (s)[1] == '\0'))
@@ -595,16 +612,8 @@ int readheaders(int sock,
/* write the message size dots */
if ((outlevel > O_SILENT && outlevel < O_VERBOSE) && linelen > 0)
{
- sizeticker += linelen;
- while (sizeticker >= SIZETICKER)
- {
- if (outlevel > O_SILENT && run.showdots && !run.use_syslog)
- {
- fputc('.', stdout);
- fflush(stdout);
- }
- sizeticker -= SIZETICKER;
- }
+ print_ticker(&sizeticker, linelen);
+ }
}
/*
* Decode MIME encoded headers. We MUST do this before
@@ -1373,16 +1382,7 @@ int readbody(int sock, struct query *ctl, flag forward, int len)
/* write the message size dots */
if (linelen > 0)
{
- sizeticker += linelen;
- while (sizeticker >= SIZETICKER)
- {
- if (outlevel > O_SILENT && run.showdots && !run.use_syslog)
- {
- fputc('.', stdout);
- fflush(stdout);
- }
- sizeticker -= SIZETICKER;
- }
+ print_ticker(&sizeticker, linelen);
}
/* Mike Jones, Manchester University, 2006: