View Single Post

  #9 (permalink)  
Old 05-27-2005
Dave Gibson
 
Posts: n/a
Default Re: Bash progress bar command like in g4u (BSD)

Wunsch <nospam@svp> wrote:
[looking for port of NetBSD's progress to Linux, no joy yet]
> Nope it's this:
>
> http://cvsweb.netbsd.org/bsdweb.cgi/....bin/progress/
>
> But I tried to compile it didn't work. Progress is also developed by the
> author of Lukemftp and I think it uses progressbar.c/h from lukemftp.


Fetch these:

http://cvsweb.netbsd.org/bsdweb.cgi/.../progressbar.h
http://cvsweb.netbsd.org/bsdweb.cgi/.../progressbar.c
http://cvsweb.netbsd.org/bsdweb.cgi/...ess/progress.c
http://cvsweb.netbsd.org/bsdweb.cgi/...ess/progress.1

Apply this patch (patch -p 1 < this_thing):

[patch begins on next line]
diff -uNr progress.orig/Makefile progress/Makefile
--- progress.orig/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ progress/Makefile 2005-05-24 21:31:13.000000000 +0100
@@ -0,0 +1,5 @@
+DEFS=-D_GNU_SOURCE -DSTANDALONE_PROGRESS -Dlint -DSECSPERHOUR=3600
+CFLAGS=-I. -Wall -O2 $(DEFS)
+
+progress: progress.c progressbar.c
+ $(CC) $(CFLAGS) -o $@ $^
diff -uNr progress.orig/progress.c progress/progress.c
--- progress.orig/progress.c 2004-03-09 17:04:24.000000000 +0000
+++ progress/progress.c 2005-05-24 21:07:18.000000000 +0100
@@ -45,6 +45,14 @@
#include <sys/wait.h>
#include <netinet/in.h>
#include <arpa/ftp.h>
+#ifdef __linux__
+#include <sys/stat.h>
+#define setprogname(a) /* nothing */
+#define getprogname() program_invocation_short_name
+#define ttysize winsize
+#define TIOCGSIZE TIOCGWINSZ
+#define ts_cols ws_col
+#endif

#include <ctype.h>
#include <err.h>
diff -uNr progress.orig/progressbar.c progress/progressbar.c
--- progress.orig/progressbar.c 2004-03-09 17:04:24.000000000 +0000
+++ progress/progressbar.c 2005-05-24 21:06:54.000000000 +0100
@@ -56,6 +56,9 @@
#include <time.h>
#include <tzfile.h>
#include <unistd.h>
+#ifdef __linux__
+#include <sys/time.h>
+#endif

#include "progressbar.h"

diff -uNr progress.orig/tzfile.h progress/tzfile.h
--- progress.orig/tzfile.h 1970-01-01 01:00:00.000000000 +0100
+++ progress/tzfile.h 2005-05-24 21:07:56.000000000 +0100
@@ -0,0 +1 @@
+/* dummy tzfile.h */
[patch ends on previous line]

Then make. If make complains about a missing separator, check that
the line in Makefile containing "$(CC) $(CFLAGS) -o $@ $^" begins
with a tab character.

Note: you'll need to use '--' in the command line before the name
of the program you want to feed data to.
Reply With Quote