1 /* vi: set sw=4 ts=4: */
3 * Monitor a pipe with a simple progress display.
5 * Copyright (C) 2003 by Rob Landley <rob@landley.net>, Joey Hess
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
16 #define PIPE_PROGRESS_SIZE 4096
18 /* Read a block of data from stdin, write it to stdout.
19 * Activity is indicated by a '.' to stderr
21 int pipe_progress_main(int argc, char **argv)
23 RESERVE_CONFIG_BUFFER(buf, PIPE_PROGRESS_SIZE);
24 time_t t = time(NULL);
27 while ((len = fread(buf, 1, PIPE_PROGRESS_SIZE, stdin)) > 0) {
28 time_t new_time = time(NULL);
33 fwrite(buf, len, 1, stdout);
38 if (ENABLE_FEATURE_CLEAN_UP)
39 RELEASE_CONFIG_BUFFER(buf);