diff options
author | hubertf <hubertf@NetBSD.org> | 2004-03-09 17:04:24 +0000 |
---|---|---|
committer | hubertf <hubertf@NetBSD.org> | 2004-03-09 17:04:24 +0000 |
commit | d9415b521c515095fba42397975441dfbfb487d8 (patch) | |
tree | 731648ee58873672e9ead73fa33f3321931c48cc /progress.c | |
parent | 3cac59fa5b5b8e6ebd1ec4c9a16728fcfa27cd9b (diff) | |
download | bsd-progress-d9415b521c515095fba42397975441dfbfb487d8.tar.gz bsd-progress-d9415b521c515095fba42397975441dfbfb487d8.tar.zst bsd-progress-d9415b521c515095fba42397975441dfbfb487d8.zip |
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.
Diffstat (limited to 'progress.c')
-rw-r--r-- | progress.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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 <sys/cdefs.h> #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 <sys/types.h> @@ -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; |