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 /src | |
parent | 159955668b23e32fb7cefa1638bb40b8b3a58fa9 (diff) | |
download | lynx-snapshots-5488a2e17cfeff78f8927f652ecb9750d7a28c29.tar.gz |
snapshot of project "lynx", label v2-8-1dev_17
Diffstat (limited to 'src')
-rw-r--r-- | src/HTAlert.c | 37 | ||||
-rw-r--r-- | src/HTAlert.h | 1 | ||||
-rw-r--r-- | src/LYCgi.c | 11 | ||||
-rw-r--r-- | src/LYLeaks.c | 1 | ||||
-rw-r--r-- | src/LYUtils.h | 3 | ||||
-rw-r--r-- | src/chrtrans/makeuctb.c | 9 |
6 files changed, 42 insertions, 20 deletions
diff --git a/src/HTAlert.c b/src/HTAlert.c index 084b550b..72f14f4a 100644 --- a/src/HTAlert.c +++ b/src/HTAlert.c @@ -55,6 +55,43 @@ PUBLIC void HTProgress ARGS1( statusline(Msg); } +/* Issue a read-progress message. HTReadProgress() +** ------------------------------ +*/ +PUBLIC void HTReadProgress ARGS2( + long, bytes, + long, total) +{ + static long kb_units = 1024000; + static time_t first, last; + char line[80]; + time_t now = time((time_t *)0); + char *units = "bytes"; + + if (bytes == 0) { + first = last = now; + } else if (bytes > 0) { + if (now != last) { + last = now; + if (total >= kb_units || bytes >= kb_units) { + if (bytes > 0) bytes /= 1024; + if (total > 0) total /= 1024; + units = "KB"; + } + if (total > 0) { + sprintf (line, "Read %ld of %ld %s of data.", bytes, total, units); + } else if (total < 0) { + sprintf (line, "Read %ld uncompressed %s of data.", bytes, units); + if (total < -1) + strcat(line, " (Press 'z' to abort)"); + } else { + sprintf (line, "Read %ld %s of data.", bytes, units); + } + _HTProgress(line); + } + } +} + PRIVATE BOOL conf_cancelled = NO; /* used by HTConfirm only - kw */ PUBLIC BOOL HTLastConfirmCancelled NOARGS diff --git a/src/HTAlert.h b/src/HTAlert.h index be80ee33..8f44c7a8 100644 --- a/src/HTAlert.h +++ b/src/HTAlert.h @@ -38,6 +38,7 @@ extern void HTAlert PARAMS((CONST char * Msg)); ** The input is a list of parameters for printf. */ extern void HTProgress PARAMS((CONST char * Msg)); +extern void HTReadProgress PARAMS((long bytes, long total)); extern BOOLEAN mustshow; #define _HTProgress(msg) mustshow = TRUE, HTProgress(msg) diff --git a/src/LYCgi.c b/src/LYCgi.c index 41d1ac33..e30d53f7 100644 --- a/src/LYCgi.c +++ b/src/LYCgi.c @@ -398,15 +398,10 @@ PRIVATE int LYLoadCGI ARGS4( close(fd1[1]); } - total_chars = 0; + HTReadProgress(total_chars = 0, 0); while((chars = read(fd2[0], buf, sizeof(buf))) > 0) { - char line[40]; - - total_chars += chars; - sprintf (line, "Read %d bytes of data.", total_chars); - HTProgress(line); - CTRACE(tfp, "LYNXCGI: Rx: %.*s\n", chars, buf); - + HTReadProgress(total_chars += chars, 0); + CTRACE(tfp, "LYNXCGI: Rx: %.*s\n", chars, buf); (*target->isa->put_block)(target, buf, chars); } #if !HAVE_WAITPID diff --git a/src/LYLeaks.c b/src/LYLeaks.c index 29845d30..222b48aa 100644 --- a/src/LYLeaks.c +++ b/src/LYLeaks.c @@ -15,7 +15,6 @@ #include <LYLeaks.h> #include <LYUtils.h> #include <ctype.h> -/*#include <stdio.h> included by HTUtils.h -- FM */ #define FREE(x) if (x) {free(x); x = NULL;} diff --git a/src/LYUtils.h b/src/LYUtils.h index 876e35f8..391e8ef0 100644 --- a/src/LYUtils.h +++ b/src/LYUtils.h @@ -1,9 +1,6 @@ - #ifndef LYUTILS_H #define LYUTILS_H -#include <stdio.h> - #ifndef HTLIST_H #include <HTList.h> #endif /* HTLIST_H */ diff --git a/src/chrtrans/makeuctb.c b/src/chrtrans/makeuctb.c index 874d971f..fda5f3e0 100644 --- a/src/chrtrans/makeuctb.c +++ b/src/chrtrans/makeuctb.c @@ -16,13 +16,7 @@ * version 2, or at your option any later version. */ -#ifdef NOTDEFINED -#include <stdio.h> -#include <stdlib.h> -#include <sysexits.h> -#include <string.h> -#include <ctype.h> -#else +#define DONT_USE_SOCKS5 #include <HTUtils.h> #include <tcp.h> /* @@ -31,7 +25,6 @@ #ifdef exit #undef exit #endif /* exit */ -#endif /* NODEFINED */ #ifndef TOLOWER #define TOLOWER(c) (isupper((unsigned char)c) ? tolower((unsigned char)c) : (c)) |