... | ... |
@@ -164,6 +164,8 @@ help (void) |
164 | 164 |
(" --no-warnings don't print and log warnings\n"); |
165 | 165 |
mprintf |
166 | 166 |
(" --stdout write to stdout instead of stderr\n"); |
167 |
+ mprintf |
|
168 |
+ (" --show-progress show download progress percentage\n"); |
|
167 | 169 |
mprintf ("\n"); |
168 | 170 |
mprintf |
169 | 171 |
(" --config-file=FILE read configuration from FILE.\n"); |
... | ... |
@@ -476,6 +478,9 @@ main (int argc, char **argv) |
476 | 476 |
if (optget (opts, "stdout")->enabled) |
477 | 477 |
mprintf_stdout = 1; |
478 | 478 |
|
479 |
+ if (optget (opts, "show-progress")->enabled) |
|
480 |
+ mprintf_progress = 1; |
|
481 |
+ |
|
479 | 482 |
/* initialize logger */ |
480 | 483 |
logg_verbose = mprintf_verbose ? 1 : optget (opts, "LogVerbose")->enabled; |
481 | 484 |
logg_time = optget (opts, "LogTime")->enabled; |
... | ... |
@@ -930,7 +930,7 @@ getfile_mirman (const char *srcfile, const char *destfile, |
930 | 930 |
percentage = (int) (100 * (float) totaldownloaded / totalsize); |
931 | 931 |
|
932 | 932 |
#ifdef HAVE_UNISTD_H |
933 |
- if (!mprintf_quiet && isatty(fileno(stdout))) |
|
933 |
+ if (!mprintf_quiet && (mprintf_progress || isatty(fileno(stdout)))) |
|
934 | 934 |
#else |
935 | 935 |
if (!mprintf_quiet) |
936 | 936 |
#endif |
... | ... |
@@ -76,6 +76,7 @@ const struct clam_option __clam_options[] = { |
76 | 76 |
{ NULL, "quiet", 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL, "", "" }, |
77 | 77 |
{ NULL, "leave-temps", 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_CLAMSCAN, "", "" }, |
78 | 78 |
{ NULL, "no-warnings", 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM, "", "" }, |
79 |
+ { NULL, "show-progress", 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM, "", "" }, |
|
79 | 80 |
{ NULL, "stdout", 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM | OPT_CLAMSCAN | OPT_CLAMDSCAN | OPT_SIGTOOL, "", "" }, |
80 | 81 |
{ NULL, "daemon", 'd', CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM, "", "" }, |
81 | 82 |
{ NULL, "no-dns", 0, CLOPT_TYPE_BOOL, MATCH_BOOL, 0, NULL, 0, OPT_FRESHCLAM, "", "" }, |
... | ... |
@@ -91,7 +91,7 @@ short logg_syslog; |
91 | 91 |
#endif |
92 | 92 |
|
93 | 93 |
short int mprintf_disabled = 0, mprintf_verbose = 0, mprintf_quiet = 0, |
94 |
- mprintf_stdout = 0, mprintf_nowarn = 0, mprintf_send_timeout = 100; |
|
94 |
+ mprintf_stdout = 0, mprintf_nowarn = 0, mprintf_send_timeout = 100, mprintf_progress = 0; |
|
95 | 95 |
|
96 | 96 |
#define ARGLEN(args, str, len) \ |
97 | 97 |
{ \ |
... | ... |
@@ -61,6 +61,6 @@ void mprintf(const char *str, ...) __attribute__((format(printf, 1, 2))); |
61 | 61 |
void mprintf(const char *str, ...); |
62 | 62 |
#endif |
63 | 63 |
|
64 |
-extern short int mprintf_disabled, mprintf_verbose, mprintf_quiet, mprintf_nowarn, mprintf_stdout, mprintf_send_timeout; |
|
64 |
+extern short int mprintf_disabled, mprintf_verbose, mprintf_quiet, mprintf_nowarn, mprintf_stdout, mprintf_send_timeout, mprintf_progress; |
|
65 | 65 |
|
66 | 66 |
#endif |