From d9415b521c515095fba42397975441dfbfb487d8 Mon Sep 17 00:00:00 2001 From: hubertf Date: Tue, 9 Mar 2004 17:04:24 +0000 Subject: Allow custom text printed before (left of) the progress bar from progress(1): miyu# cat openoffice-linux-1.1.0.tgz | progress -z -p 'Bytes written: ' dd of=/dev/null bs=1m Bytes written: 193 MB 13.83 MB/s 0+195211 records in and: miyu# progress -f openoffice-linux-1.1.0.tgz -z -p 'Bytes written: ' dd of=/dev/null bs=1m Bytes written: 28% |****** | 57919 KB 14.12 MB/s 00:09 ETA OK'd by lukem. --- progress.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'progress.c') diff --git a/progress.c b/progress.c index d47e46e..eaa3314 100644 --- a/progress.c +++ b/progress.c @@ -1,4 +1,4 @@ -/* $NetBSD: progress.c,v 1.7 2003/02/12 00:58:34 ross Exp $ */ +/* $NetBSD: progress.c,v 1.8 2004/03/09 17:04:24 hubertf Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include #ifndef lint -__RCSID("$NetBSD: progress.c,v 1.7 2003/02/12 00:58:34 ross Exp $"); +__RCSID("$NetBSD: progress.c,v 1.8 2004/03/09 17:04:24 hubertf Exp $"); #endif /* not lint */ #include @@ -73,7 +73,7 @@ static void usage(void) { fprintf(stderr, - "usage: %s [-z] [-f file] [-l length] cmd [args...]\n", + "usage: %s [-z] [-f file] [-l length] [-p prefix] cmd [args...]\n", getprogname()); exit(1); } @@ -96,8 +96,9 @@ main(int argc, char *argv[]) /* defaults: Read from stdin, 0 filesize (no completion estimate) */ fd = STDIN_FILENO; filesize = 0; + prefix=NULL; - while ((ch = getopt(argc, argv, "f:l:z")) != -1) + while ((ch = getopt(argc, argv, "f:l:p:z")) != -1) switch (ch) { case 'f': infile = optarg; @@ -106,6 +107,9 @@ main(int argc, char *argv[]) lflag++; filesize = strtoull(optarg, NULL, 0); break; + case 'p': + prefix = optarg; + break; case 'z': zflag++; break; -- cgit v1.2.3