diff -u cpipe-3.0.1/cmdline.c cpipe-3.0.1/cmdline.c --- cpipe-3.0.1/cmdline.c +++ cpipe-3.0.1/cmdline.c @@ -39,6 +39,10 @@ /* speedP = */ 0, /* speed = */ (double)0, /* speedC = */ 0, + /***** -p: optional prefix to each printed line */ + /* prefixP = */ 0, + /* prefix = */ (char*)0, + /* prefixC = */ 0, /***** uninterpreted rest of command line */ /* argc = */ 0, /* argv = */ (char**)0 @@ -712,7 +716,7 @@ void usage(void) { - fprintf(stderr,"%s"," [-b bsize] [-vt] [-vr] [-vw] [-ngr] [-s speed]\n"); + fprintf(stderr,"%s"," [-b bsize] [-vt] [-vr] [-vw] [-ngr] [-s speed] [-p prefix]\n"); fprintf(stderr,"%s"," copy stdin to stdout while counting bytes and reporting progress\n"); fprintf(stderr,"%s"," -b: buffer size in kB\n"); fprintf(stderr,"%s"," 1 int value between 1 and oo\n"); @@ -724,6 +728,8 @@ fprintf(stderr,"%s"," on read before starting to write\n"); fprintf(stderr,"%s"," -s: throughput speed limit in kB/s\n"); fprintf(stderr,"%s"," 1 double value between 1 and oo\n"); + fprintf(stderr,"%s"," -p: optional prefix to each printed line\n"); + fprintf(stderr,"%s"," 1 char* value\n"); fprintf(stderr,"%s"," version: 3.0.1\n"); fprintf(stderr,"%s"," "); exit(EXIT_FAILURE); @@ -774,6 +780,14 @@ continue; } + if( 0==strcmp("-p", argv[i]) ) { + int keep = i; + cmd.prefixP = 1; + i = getStringOpt(argc, argv, i, &cmd.prefix, 1); + cmd.prefixC = i-keep; + continue; + } + if( argv[i][0]=='-' ) { fprintf(stderr, "\n%s: unknown option `%s'\n\n", Program, argv[i]); diff -u cpipe-3.0.1/cpipe.c cpipe-3.0.1/cpipe.c --- cpipe-3.0.1/cpipe.c +++ cpipe-3.0.1/cpipe.c @@ -202,6 +202,15 @@ fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK); } + if( cmd->prefixP ) { + char *buf = malloc(strlen(cmd->prefix)+2); + sprintf(buf, "%s ", cmd->prefix); + cmd->prefix = buf; + } + else { + cmd->prefix = ""; + } + buf = malloc(cmd->bsize); if( !buf ) { fprintf(stderr, @@ -259,7 +268,8 @@ if( cmd->vtP ) { fprintf(stderr, - "thru: %7.3fms at %7sB/s (%7sB/s avg) %7sB\n", + "%sthru: %7.3fms at %7sB/s (%7sB/s avg) %7sB\n", + cmd->prefix, 1e3*dt, scale((double)count/dt, txt1), scale(TotalBytes/dtAll, txt2), diff -u cpipe-3.0.1/debian/changelog cpipe-3.0.1/debian/changelog --- cpipe-3.0.1/debian/changelog +++ cpipe-3.0.1/debian/changelog @@ -1,14 +1,11 @@ -cpipe (3.0.1-1ubuntu2) bionic; urgency=high +cpipe (3.0.1-2) unstable; urgency=low - * No change rebuild to pick up -fPIE compiler default + * Full migration to dh (closes: #931152) + * Fix linker command line to work with gold (closes: #611333) + * Added more details to description (closes: #493598) + * Optional printing of a prefix word (closes: #407559) - -- Balint Reczey Tue, 03 Apr 2018 12:17:38 +0000 - -cpipe (3.0.1-1ubuntu1) natty; urgency=low - - * Correct linking order to prevent FTBFS with newest toolchain. - - -- Angel Abad Fri, 28 Jan 2011 08:49:28 +0100 + -- Eduard Bloch Tue, 09 Jul 2019 23:31:24 +0200 cpipe (3.0.1-1) unstable; urgency=low diff -u cpipe-3.0.1/debian/compat cpipe-3.0.1/debian/compat --- cpipe-3.0.1/debian/compat +++ cpipe-3.0.1/debian/compat @@ -1 +1 @@ -5 +10 diff -u cpipe-3.0.1/debian/control cpipe-3.0.1/debian/control --- cpipe-3.0.1/debian/control +++ cpipe-3.0.1/debian/control @@ -4,13 +4,15 @@ -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Eduard Bloch -Build-Depends: debhelper (>> 5.0.0) -Standards-Version: 3.7.2 +Maintainer: Eduard Bloch +Build-Depends: debhelper (>= 10) +Standards-Version: 4.3.0 Package: cpipe Architecture: any -Depends: ${shlibs:Depends} -Description: counting pipe +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: data pipe forwarding utility for performance monitoring Cpipe copies its standard input to its standard output while measuring the time it takes to read an input buffer and write an output buffer. Statistics of average throughput and the total amount of bytes copied are printed to the standard error output. + . + Cpipe can also be used as alternative to the buffer utility for simple + usecases. diff -u cpipe-3.0.1/debian/rules cpipe-3.0.1/debian/rules --- cpipe-3.0.1/debian/rules +++ cpipe-3.0.1/debian/rules @@ -2,86 +2,14 @@ -# Sample debian/rules that uses debhelper. -# GNU copyright 1997 to 1999 by Joey Hess. -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 +export DEB_BUILD_MAINT_OPTIONS = hardening=+all +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/buildflags.mk -ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) - CFLAGS += -g -endif -ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) - INSTALL_PROGRAM += -s -endif +#LDFLAGS += --as-needed +#CFLAGS += -Wl,--as-needed -configure: configure-stamp -configure-stamp: -# dh_testdir -# - touch configure-stamp +%: + dh $@ +override_dh_auto_install: + $(MAKE) install BINDIR=$(CURDIR)/debian/cpipe/usr/bin MANDIR=$(CURDIR)/debian/cpipe/usr/share/man/man1 -build: build-stamp - -build-stamp: configure-stamp - dh_testdir - - $(MAKE) - - touch build-stamp - -clean: - dh_testdir - dh_testroot - rm -f build-stamp configure-stamp - - # Add here commands to clean up after the build process. - $(MAKE) clean - - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean -k - dh_installdirs - - # Add here commands to install the package into debian/cpipe. -# $(MAKE) install prefix=$(CURDIR)/debian/cpipe/usr - cp cpipe $(CURDIR)/debian/cpipe/usr/bin - - -# Build architecture-independent files here. -binary-indep: build install -# We have nothing to do by default. - -# Build architecture-dependent files here. -binary-arch: build install - dh_testdir - dh_testroot -# dh_installdebconf - dh_installdocs - dh_installexamples - dh_installmenu -# dh_installlogrotate -# dh_installemacsen -# dh_installpam -# dh_installmime -# dh_installinit - dh_installcron - dh_installman cpipe.1 - dh_installinfo -# dh_undocumented - dh_installchangelogs CHANGES - dh_link - dh_strip - dh_compress - dh_fixperms -# dh_makeshlibs - dh_installdeb -# dh_perl - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure diff -u cpipe-3.0.1/makefile cpipe-3.0.1/makefile --- cpipe-3.0.1/makefile +++ cpipe-3.0.1/makefile @@ -15,11 +15,11 @@ MANDIR=$(prefix)/man/man1 ## Your favorite compiler flags. -CFLAGS = -O2 -W -Wall -pedantic +#CFLAGS ?= -O2 -W -Wall -pedantic ######################################################################## cpipe: cpipe.o cmdline.o - $(CC) -o $@ cpipe.o cmdline.o -lm + $(CC) $(LDFLAGS) -o $@ cpipe.o cmdline.o -lm cpipe.o: cpipe.c cmdline.h only in patch2: unchanged: --- cpipe-3.0.1.orig/cmdline.cli +++ cpipe-3.0.1/cmdline.cli @@ -18,6 +18,8 @@ Double -s speed {throughput speed limit in kB/s} -r 1 oo +String -p prefix {optional prefix to each printed line} + Description { .B Cpipe copies its standard input to its standard output while measuring the only in patch2: unchanged: --- cpipe-3.0.1.orig/cmdline.h +++ cpipe-3.0.1/cmdline.h @@ -2,10 +2,10 @@ #define __cmdline__ /***** command line parser interface -- generated by clig - (http://wsd.iitb.fhg.de/~kir/clighome/) + (http://wsd.iitb.fhg.de/~geg/clighome/) The command line parser `clig': - (C) 1995---2001 Harald Kirsch (kirschh@lionbioscience.com) + (C) 1995-2004 Harald Kirsch (clig@geggus.net) *****/ typedef struct s_Cmdline { @@ -26,6 +26,10 @@ char speedP; double speed; int speedC; + /***** -p: optional prefix to each printed line */ + char prefixP; + char* prefix; + int prefixC; /***** uninterpreted command line parameters */ int argc; /*@null*/char **argv; only in patch2: unchanged: --- cpipe-3.0.1.orig/cpipe.1 +++ cpipe-3.0.1/cpipe.1 @@ -11,7 +11,7 @@ .\" it edited by clig, remove the respective pair of cligPart-lines. .\" .\" cligPart TITLE -.TH "cpipe" 1 "3.0.0" "Clig-manuals" "Programmer's Manual" +.TH "cpipe" 1 "3.0.1" "Clig-manuals" "Programmer's Manual" .\" cligPart TITLE end .\" cligPart NAME @@ -28,6 +28,7 @@ [-vw] [-ngr] [-s speed] +[-p prefix] .\" cligPart SYNOPSIS end @@ -52,6 +53,10 @@ throughput speed limit in kB/s, .br 1 Double value between 1 and oo. +.IP -p +optional prefix to each printed line, +.br +1 String value .\" cligPart OPTIONS end .\" cligPart DESCRIPTION only in patch2: unchanged: --- cpipe-3.0.1.orig/debian/source/format +++ cpipe-3.0.1/debian/source/format @@ -0,0 +1 @@ +1.0