diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 1998-06-25 20:46:00 -0400 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 1998-06-25 20:46:00 -0400 |
commit | 5488a2e17cfeff78f8927f652ecb9750d7a28c29 (patch) | |
tree | 061d9ca743d7c0a2fed37bd1e22cb1f83dd7d051 /WWW/Library/Implementation/HTFormat.c | |
parent | 159955668b23e32fb7cefa1638bb40b8b3a58fa9 (diff) | |
download | lynx-snapshots-5488a2e17cfeff78f8927f652ecb9750d7a28c29.tar.gz |
snapshot of project "lynx", label v2-8-1dev_17
Diffstat (limited to 'WWW/Library/Implementation/HTFormat.c')
-rw-r--r-- | WWW/Library/Implementation/HTFormat.c | 98 |
1 files changed, 21 insertions, 77 deletions
diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c index fb7705e3..e92848dc 100644 --- a/WWW/Library/Implementation/HTFormat.c +++ b/WWW/Library/Implementation/HTFormat.c @@ -54,8 +54,6 @@ PUBLIC long int HTMaxBytes = 0; /* No effective limit */ #define FREE(x) if (x) {free(x); x = NULL;} -extern int HTCheckForInterrupt NOPARAMS; - PUBLIC BOOL HTOutputSource = NO; /* Flag: shortcut parser to stdout */ /* extern BOOL interactive; LJM */ @@ -495,8 +493,7 @@ PUBLIC int HTCopy ARGS4( HTStream*, sink) { HTStreamClass targetClass; - char line[256]; - int bytes = 0; + int bytes; int rv = 0; /* Push the data down the stream @@ -507,6 +504,7 @@ PUBLIC int HTCopy ARGS4( ** ** This operation could be put into a main event loop */ + HTReadProgress(bytes = 0, 0); for (;;) { int status; @@ -587,12 +585,7 @@ PUBLIC int HTCopy ARGS4( #endif /* DISP_PARTIAL */ bytes += status; - if (anchor && anchor->content_length > 0) - sprintf(line, "Read %d of %d bytes of data.", - bytes, anchor->content_length); - else - sprintf(line, "Read %d bytes of data.", bytes); - HTProgress(line); + HTReadProgress(bytes, anchor ? anchor->content_length : 0); } /* next bufferload */ @@ -617,8 +610,7 @@ PUBLIC int HTFileCopy ARGS2( HTStream*, sink) { HTStreamClass targetClass; - char line[256]; - int status, bytes = 0, nreads = 0, nprogr = 0; + int status, bytes; int rv = HT_OK; /* Push the data down the stream @@ -627,9 +619,9 @@ PUBLIC int HTFileCopy ARGS2( /* Push binary from socket down sink */ + HTReadProgress(bytes = 0, 0); for (;;) { status = fread(input_buffer, 1, INPUT_BUFFER_SIZE, fp); - nreads++; if (status == 0) { /* EOF or error */ if (ferror(fp) == 0) { rv = HT_LOADED; @@ -655,38 +647,15 @@ PUBLIC int HTFileCopy ARGS2( #endif /* DISP_PARTIAL */ bytes += status; - if (nreads >= 100) { - /* - ** Show progress messages for local files, and check for - ** user interruption. Start doing so only after a certain - ** number of reads have been done, and don't update it on - ** every read (normally reading in a local file should be - ** speedy). - KW - */ - if (nprogr == 0) { - if (bytes < 1024000) { - sprintf(line, "Read %d bytes of data.", bytes); - } else { - sprintf(line, "Read %d KB of data. %s", - bytes/1024, - "(Press 'z' if you want to abort loading.)"); - } - HTProgress(line); - if (HTCheckForInterrupt()) { - _HTProgress ("Data transfer interrupted."); - if (bytes) { - rv = HT_INTERRUPTED; - } else { - rv = -1; - } - break; - } - nprogr++; - } else if (nprogr == 25) { - nprogr = 0; + HTReadProgress(bytes, -2); + if (HTCheckForInterrupt()) { + _HTProgress ("Data transfer interrupted."); + if (bytes) { + rv = HT_INTERRUPTED; } else { - nprogr++; + rv = -1; } + break; } } /* next bufferload */ @@ -707,8 +676,7 @@ PRIVATE int HTGzFileCopy ARGS2( HTStream*, sink) { HTStreamClass targetClass; - char line[256]; - int status, bytes = 0, nreads = 0, nprogr = 0; + int status, bytes; int gzerrnum; int rv = HT_OK; @@ -718,9 +686,9 @@ PRIVATE int HTGzFileCopy ARGS2( /* read and inflate gzipped file, and push binary down sink */ + HTReadProgress(bytes = 0, 0); for (;;) { status = gzread(gzfp, input_buffer, INPUT_BUFFER_SIZE); - nreads++; if (status <= 0) { /* EOF or error */ if (status == 0) { rv = HT_LOADED; @@ -752,39 +720,15 @@ PRIVATE int HTGzFileCopy ARGS2( #endif /* DISP_PARTIAL */ bytes += status; - if (nreads >= 100) { - /* - ** Show progress messages for local files, and check for - ** user interruption. Start doing so only after a certain - ** number of reads have been done, and don't update it on - ** every read (normally reading in a local file should be - ** speedy). - KW - */ - if (nprogr == 0) { - if (bytes < 1024000) { - sprintf(line, - "Read %d uncompressed bytes of data.", bytes); - } else { - sprintf(line, "Read %d uncompressed KB of data. %s", - bytes/1024, - "(Press 'z' to abort.)"); - } - HTProgress(line); - if (HTCheckForInterrupt()) { - _HTProgress ("Data transfer interrupted."); - if (bytes) { - rv = HT_INTERRUPTED; - } else { - rv = -1; - } - break; - } - nprogr++; - } else if (nprogr == 25) { - nprogr = 0; + HTReadProgress(bytes, -2); + if (HTCheckForInterrupt()) { + _HTProgress ("Data transfer interrupted."); + if (bytes) { + rv = HT_INTERRUPTED; } else { - nprogr++; + rv = -1; } + break; } } /* next bufferload */ |