27 Commits
Author SHA1 Message Date
Andrew Wood 303d3ea359 Corrected Markdown list formatting. 2023-07-30 20:11:30 +01:00
Andrew Wood 318954d21e Add link to issue describing terminal sizing bug. 2023-07-30 20:04:17 +01:00
Andrew Wood 85dd2603bf Added DEVELOPERS.md. 2023-07-30 19:59:19 +01:00
Andrew Wood b6c797af1a Track position movements due to reformatting. 2023-07-30 19:22:00 +01:00
Andrew Wood 40b9ef2a9d Version update for new release. 2023-07-30 18:56:09 +01:00
Andrew Wood 146add0ed3 Check for termios.h so that HAVE_TERMIOS_H is defined, otherwise terminal size detection is broken on Cygwin (issue GH#72). 2023-07-30 16:54:35 +01:00
Andrew Wood 911969c2a8 Cast char to int in isdigit() to satisfy GCC on Cygwin. 2023-07-30 16:52:31 +01:00
Andrew Wood 4b3b49806f Added notes about code reformatting, and "--help" word wrapping. 2023-07-29 22:37:16 +01:00
Andrew Wood 943c05a8a0 Reformatted with "indent" to a line length of 120. 2023-07-29 22:21:32 +01:00
Andrew Wood 630d92fef6 Added splint annotation. 2023-07-29 22:19:43 +01:00
Andrew Wood 34fe796806 Refactored "--help" to support multi-byte character locales when word wrapping, and clear all "splint" and "flawfinder" warnings. 2023-07-29 21:32:34 +01:00
Andrew Wood 907b449c6b Set line length to 120 in "make indent". 2023-07-29 21:29:22 +01:00
Andrew Wood b59b1bad4b Added note about DEBUG. 2023-07-28 23:16:41 +01:00
Andrew Wood 7e374be0d7 Minor spacing changes due to "indent". 2023-07-28 23:15:09 +01:00
Andrew Wood b9f96d9508 Provide new option "--debug" instead of using insecure environment variable DEBUG. 2023-07-28 23:14:14 +01:00
Andrew Wood 08a8c2ea70 Version bump and first changes listed. 2023-07-28 22:36:42 +01:00
Andrew Wood 1f103d6a11 Include POSIX library in splint calls. 2023-07-28 22:35:50 +01:00
Andrew Wood 7f3924db77 Added "make analyse" to run analysis tools on the source. 2023-07-28 22:28:07 +01:00
Andrew Wood cd9f057f15 Removed incorrect undef HAVE_STDBOOL_H which caused standard boolean types to be redefined unnecessarily. 2023-07-28 21:55:57 +01:00
Andrew Wood 7088833627 Closed issue #70 - the problem was successfully reproduced with 1.7.0 and then observed to have been resolved in 1.7.18. 2023-07-28 21:38:42 +01:00
Andrew Wood 57f8daff30 Closed issue #69 - confirmation received that this is fixed in 1.7.18. 2023-07-28 21:33:12 +01:00
Andrew Wood 275cc6c10d Updated "make release" to sign using a specific key, and only do tar.gz files. 2023-07-28 17:57:55 +01:00
Andrew Wood 8491b5cdd5 Updated "make release" for upcoming change. 2023-07-28 17:50:12 +01:00
Andrew Wood 6496c8785b Removed an obsolete step. 2023-07-28 17:40:44 +01:00
Andrew Wood 506ec4a8ec Updating as a result of msgmerge during release. 2023-07-28 17:34:29 +01:00
Andrew Wood 5a140b689f Updated for new release 2023-07-28 11:10:30 +01:00
Andrew Wood 38ddb5e32a Corrected language list in NLS support. 2023-07-28 11:08:49 +01:00
39 changed files with 2197 additions and 1873 deletions
+2 -7
View File
@@ -16,6 +16,8 @@ or "`man pv`" after installation.
Changes are listed in "[doc/NEWS.md](./doc/NEWS.md)". The to-do list is "[doc/TODO.md](./doc/TODO.md)".
Developers and translators, please see "[doc/DEVELOPERS.md](./doc/DEVELOPERS.md)".
Compilation
-----------
@@ -29,13 +31,6 @@ systems, so if typing "`make`" gives an error, try "`gmake`" instead.
See the file "[doc/INSTALL](./doc/INSTALL)" for more about the _configure_ script.
Developers note that you can run "`./configure --enable-debugging`" to cause
debugging support to be built in, and the `--enable-profiling` option builds
in profiling support (see "`man gprof`"). Also note that running
"`make index`" will generate an HTML code index (using _ctags_ and
_cproto_); this index lists all files used, all functions defined, and all
TODOs marked in the code.
Author and acknowledgements
---------------------------
+4 -5
View File
@@ -4,9 +4,6 @@ dnl Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023 Andrew Wood
dnl
dnl Distributed under the Artistic License v2.0; see `doc/COPYING'.
dnl Supported languages
ALL_LINGUAS="de fr pl pt"
AC_INIT
AC_CONFIG_SRCDIR([src/main/version.c])
AC_CONFIG_AUX_DIR(autoconf/scripts)
@@ -43,6 +40,8 @@ AC_CHECK_FUNCS(memcpy basename vsnprintf strlcat)
AC_CHECK_FUNCS(fdatasync)
AC_CHECK_FUNCS(fpathconf sysconf posix_memalign)
AC_CHECK_HEADERS(limits.h)
AC_CHECK_HEADERS(wctype.h)
AC_CHECK_HEADERS(termios.h)
AC_ARG_ENABLE(debugging,
[ --enable-debugging compile with debugging support],
@@ -97,7 +96,7 @@ yes
#endif
], [LIBS="$LIBS -lc128"])
dnl Native Language Suppot
dnl Native Language Support
if test "$NLS_SUPPORT" = "yes"; then
AC_DEFINE([ENABLE_NLS], [1], [Enable native language support])
AC_PATH_PROG(MSGFMT, msgfmt, NOMSGFMT)
@@ -116,7 +115,7 @@ if test "$NLS_SUPPORT" = "yes"; then
fi
CATOBJEXT=.mo
INSTOBJEXT=.mo
for lang in $ALL_LINGUAS; do
for lang in de fr pl pt; do
GMOFILES="$GMOFILES $lang.gmo"
POFILES="$POFILES \$(srcdir)/src/nls/$lang.po"
CATALOGS="$CATALOGS src/nls/$lang$CATOBJEXT";
+6
View File
@@ -108,6 +108,9 @@
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
@@ -117,6 +120,9 @@
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define to 1 if you have the <wctype.h> header file. */
#undef HAVE_WCTYPE_H
/* Define to 1 if the system has the type `_Bool'. */
#undef HAVE__BOOL
+5 -1
View File
@@ -2,7 +2,7 @@
# Compilation rules.
#
.SUFFIXES: .c .d .o
.SUFFIXES: .c .d .o .e
.c.o:
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
@@ -11,6 +11,10 @@
sh $(srcdir)/autoconf/scripts/depend.sh \
$(CC) $< $(<:%.c=%) $(srcdir) $(CFLAGS) $(CPPFLAGS) > $@
.c.e:
-splint -badflag +posixlib $(CPPFLAGS) $< > $@ 2>&1
-flawfinder $< >> $@ 2>&1
#
# Native language support
#
+16 -11
View File
@@ -2,8 +2,8 @@
# Rules for all phony targets.
#
.PHONY: all help make dep depend test check \
clean depclean indentclean distclean cvsclean svnclean \
.PHONY: all help make dep depend test check analyse \
clean depclean analysisclean indentclean distclean gitclean \
index manhtml indent update-po \
doc dist release \
install uninstall
@@ -22,11 +22,13 @@ help:
@echo
@echo ' make rebuild the Makefile (after adding new files)'
@echo ' dep / depend rebuild .d (dependency) files'
@echo ' clean remove .o (object) and .c~ (backup) files'
@echo ' analyse run analysis tools on all .c files'
@echo ' clean remove .o (object) files'
@echo ' depclean remove .d (dependency) files'
@echo ' analysisclean remove .e (analysis) files'
@echo ' indentclean remove files left over from "make indent"'
@echo ' distclean remove everything not distributed'
@echo ' cvsclean remove everything not in CVS/SVN'
@echo ' gitclean remove everything not in version control'
@echo
@echo ' index generate an HTML index of source code'
@echo ' manhtml output HTML man page to stdout'
@@ -54,12 +56,17 @@ dep depend: $(alldep)
cat $(alldep) >> $(srcdir)/autoconf/make/depend.mk~
sh ./config.status
analyse: $(allanalysis)
clean:
rm -f $(allobj)
depclean:
rm -f $(alldep)
analysisclean:
rm -f $(allanalysis)
indentclean:
cd $(srcdir) && for FILE in $(allsrc); do rm -f ./$${FILE}~; done
@@ -78,13 +85,13 @@ update-po: $(srcdir)/src/nls/$(PACKAGE).pot
fi; \
done
distclean: clean depclean
distclean: clean depclean analysisclean
rm -f $(alltarg) src/include/config.h
rm -rf $(package)-$(version).tar* $(package)-$(version)
rm -f *.html config.*
rm Makefile
cvsclean svnclean: distclean
gitclean: distclean
rm -f doc/lsm
rm -f doc/quickref.1
rm -f configure
@@ -94,7 +101,7 @@ cvsclean svnclean: distclean
echo > $(srcdir)/autoconf/make/modules.mk~
doc:
:
-true
index:
(cd $(srcdir); sh autoconf/scripts/index.sh $(srcdir)) > index.html
@@ -111,7 +118,7 @@ manhtml:
| sed -e '1,/<HR/d' -e '/<H2>Index/,/<HR/d' \
indent:
cd $(srcdir) && indent -npro -kr -i8 -cd42 -c45 $(allsrc)
cd $(srcdir) && indent -npro -kr -i8 -cd42 -c45 -l120 $(allsrc)
dist: doc update-po
rm -rf $(package)-$(version)
@@ -177,7 +184,5 @@ uninstall:
fi
release: dist
zcat $(package)-$(version).tar.gz | bzip2 > $(package)-$(version).tar.bz2
-gpg --list-secret-keys 2>&1 | grep -Fq 'uid' && gpg -ab *.tar.gz && rename .asc .txt *.tar.gz.asc
-gpg --list-secret-keys 2>&1 | grep -Fq 'uid' && gpg -ab *.tar.bz2 && rename .asc .txt *.tar.bz2.asc
-gpg --list-secret-keys 2>&1 | grep -F 'uid' | grep -Fq "$(MAINTAINER)" && gpg -u "$(MAINTAINER)" -ab *.tar.gz && cp $(package)-$(version).tar.gz.asc $(package)-$(version).tar.gz.txt
chmod 644 $(package)-$(version)*
+5
View File
@@ -39,6 +39,7 @@ printf "%s" "Scanning for source files: "
allsrc=$("${FIND}" src -type f -name "*.c" -print)
allobj=$(echo "${allsrc}" | tr ' ' '\n' | sed 's/\.c$/.o/')
alldep=$(echo "${allsrc}" | tr ' ' '\n' | sed 's/\.c$/.d/')
allanalysis=$(echo "${allsrc}" | tr ' ' '\n' | sed 's/\.c$/.e/')
echo "$(echo "${allsrc}" | wc -w | tr -d ' ') found"
@@ -118,6 +119,10 @@ printf "%s" "alldep = "
echo "$alldep" | tr '\n' ' ' | sed -e 's/ $//;s/ / \\!/g' | tr '!' '\n'
echo
echo
printf "%s" "allanalysis = "
echo "$allanalysis" | tr '\n' ' ' | sed -e 's/ $//;s/ / \\!/g' | tr '!' '\n'
echo
echo
} >> "${listingsFile}"
echo >> "${linkingRulesFile}"
+1
View File
@@ -82,5 +82,6 @@ is acknowledged and greatly appreciated:
* [Dave Beckett](https://github.com/dajobe) - added "`@filename`" syntax to "`--size`", and corrected an autoconf problem with stat64 on OS X
* [Volodymyr Bychkovyak](https://github.com/vbychkoviak) - provided fix for rate limit behaviour with bursty traffic
* [Nick Black](https://nick-black.com) - added "`--bits`" option
* [Andrew Schulman](https://github.com/andrew-schulman) - provided reproducible example of terminal size detection issue in 1.7.17/1.7.18
---
+125
View File
@@ -0,0 +1,125 @@
Notes for developers and translators
====================================
The following "`configure`" options will be of interest to developers and
translators:
* `--enable-debugging` - build in debugging support
* `--enable-profiling` - build in support for profiling
* `--enable-static-nls` - compile translations directly into the program
These "`make`" targets are available:
* `make help` - describe all of the "`.PHONY`" targets
* `make index` - generate a source code index
* `make analyse` - run _splint_ and _flawfinder_ on all C source files
Debugging and profiling support
-------------------------------
When "`./configure --enable-debugging`" is used, the "`pv`" produced by
"`make`" will support an extra option, "`--debug FILE`", which will cause
debugging output to be written to *FILE*. This is not recommended for
production builds due to the extra processing it introduces, and the
potential size of the output.
Within the code, "`debug()`" is used in a similar way to "`printf()`". It
will automatically include the calling function, source file, and line
number, so they don't need to be included in the parameters. When debugging
support is not enabled, it evaluates to a null statement.
This does mean that if you call "`debug()`", make sure it has no side
effects, as they won't be present in builds without debugging support.
Builds produced after "`./configure --enable-profiling`" will write profile
data when run, to be used with _gprof_. See "`man gprof`" for details.
Source code indexing
--------------------
Running "`make index`" calls a script which uses _cproto_ and _ctags_ to
generate a single file, "`index.html`", which lists all C source files, all
functions within them, and all TODOs marked in the code.
It relies on each function having a comment block directly before it,
describing what it does.
The indexing script pre-dates the author's knowledge of documentation
generation tools like Doxygen, and is over 20 years old. If it contains
bugs, then rather than fixing them, it may be worth looking at how to alter
the C sources to better suit widely available documentation generation
tools. Please open issues or start discussions about this if it comes up.
Source code analysis
--------------------
Running "`make analyse`" runs _splint_ and _flawfinder_ on all C sources,
writing the output of both programs to files named "`*.e`" for each "`*.c`".
There are no dependency rules set up for these "`.e`" files, so if a header
file is altered, either run "`make analysisclean`", manually remove the
relevant "`.e`" files, or update the timestamp of the relevant "`.c`" files
before running "`make analyse`" again.
The eventual goal is for all C source files to generate zero warnings from
either tool.
Translation notes
-----------------
The message catalogues used to translate program messages into other
languages are in the "`src/nls/`" directory, named "`xx.po`", where "`xx`"
is the ISO 639-1 2-letter language code, such as "`fr`" for French.
Each of these files contains lines like this:
#: src/pv/cursor.c:85
msgid "failed to get terminal name"
msgstr "erro ao ler o nome do terminal"
The comment line, starting "`#`", shows the source filename and line number
at which this message can be found. The "`msgid`" is the original message
in the program, in English. The "`msgstr`" is the translated text.
It is the "`msgstr`" lines which need to be updated by translators.
Message catalogue files should all be encoded as UTF-8.
To quickly test translations, use "`./configure --enable-static-nls`". This
is not recommended for production use, because it replaces the system
internationalisation libraries with some very simplistic alternatives, but
it has the benefit of compiling the message catalogues directly into the
program.
This means that after making a change to a "`.po`" file, do this:
make
LANG=de LC_ALL=en_GB.UTF-8 ./pv --help
Replace "`--help`" with whatever is appropriate for your test. In this
example, the language being tested is "`de`" (German), on a system which is
otherwise running in English with UTF-8 support.
To add a new language, edit "`autoconf/configure.in`". Look for this line:
for lang in de fr pl pt; do
Add the new language code before the "`; do`".
Create the new message catalogue file under "`src/nls/`" by copying
"`src/nls/pv.pot`" to "`src/nls/xx.po`", where "`xx`" is the language code,
and adjusting it.
Then run "`./generate.sh`" to generate a new "`configure`" script; you will
need to run "`./configure --enable-static-nls`" and "`make`" afterwards.
When the source code is updated, running "`make`" will update the "`pv.pot`"
file so that it lists where all the messages are in the source, and running
"`make update-po`" will use _msgmerge_ to update all of the "`.po`" files
from the updated "`pv.pot`" file. After doing this, look for missing
translations (empty "`msgstr`" lines) or translations marked as "fuzzy", as
these will need to be corrected by translators.
+68
View File
@@ -1,4 +1,18 @@
1.7.24 - 30 July 2023
* fix: correct terminal size detection, broken in 1.7.17 by the configuration script rewrite ([GH#72](https://github.com/a-j-wood/pv/issues/72))
* security: removed *DEBUG* environment variable in debug mode, added "`--debug`" instead
* cleanup: added "`make analyse`" to run "`splint`" and "`flawfinder`" on all source files
* cleanup: corrected detection of boolean capability
* cleanup: word wrapping of "`--help`" output is now multi-byte locale aware
* cleanup: adjusted "`indent`" rules to line length of 120 and reformatted code
1.7.18 - 28 July 2023
* fix: language file installation had been broken by the configuration script rewrite
1.7.17 - 27 July 2023
* feature: new "`--sync`" option to flush cache to disk after every write (related to [GH#6](https://github.com/a-j-wood/pv/issues/6), to improve accuracy when writing to slow disks)
* feature: new "`--direct-io`" option to bypass cache - implements [GH#29 "Option to enable *O_DIRECT*"](https://github.com/a-j-wood/pv/issues/29) - requested by Romain Kang, Jacek Wielemborek
* fix: correct byte prefix size to 2 spaces in rate display, so progress display size remains constant at low transfer rates
@@ -18,6 +32,7 @@
* cleanup: rewrote all local shell scripts to pass analysis by [ShellCheck](https://www.shellcheck.net)
1.7.0 - 17 July 2023
* dropped: support for Red Hat Enterprise Linux and its derivatives has been dropped; removed the RPM spec file, and will no longer build binaries
* feature: the "`--size`" option now accepts "`@filename`" to use the size of another file (pull request [#57](https://github.com/a-j-wood/pv/pull/57) supplied by [Dave Beckett](https://github.com/dajobe))
* feature: the "`--watchfd`" option is now available on OS X (pull request [#60](https://github.com/a-j-wood/pv/pull/60) supplied by [christoph-zededa](https://github.com/christoph-zededa))
@@ -40,9 +55,11 @@
* docs: moved NEWS to NEWS.md, converted it to UTF-8, and altered it to Markdown format
1.6.20 - 12 September 2021
* fix: add missing `stddef.h` include to `number.c` (Sam James)
1.6.19 - 5 September 2021
* fix: starting pv in the background no longer immediately stops unless the transfer is to/from the terminal (Andriy Gapon, Jonathan Elchison)
* fix: using "`-B`", "`-A`", or "`-T`" now switches on "`-C`" implicitly (Johannes Gerer, André Stapf)
* fix: AIX build fixes (Peter Korsgaard)
@@ -70,6 +87,7 @@
* (r203,205) marked unused arguments with GCC unused attribute, started using boolean data type for flags, corrected more compiler warnings
1.6.6 - 30 June 2017
* (r161) use `%llu` instead of `%Lu` for better compatibility (Eric A. Borisch)
* (r162) (#1532) fix target buffer size ("`-B`") being ignored (AndCycle, Ilya Basin, Antoine Beaupré)
* (r164) cap read/write sizes, and check elapsed time during read/write cycles, to avoid display hangs with large buffers or slow media; also remove `select()` call from repeated_write function as it slows the transfer down and the wrapping `alarm()` means it is unnecessary
@@ -78,6 +96,7 @@
* (r175) report error in "`-d`" if process fd directory is unreadable, or if process disappears before we start the main loop (Jacek Wielemborek)
1.6.0 - 15 March 2015
* fix lstat64 support when unavailable - separate patches supplied by Ganael Laplanche and Peter Korsgaard
* (#1506) new option "`-D`" / "`--delay-start`" to only show bar after N seconds (Damon Harper)
* new option "`--fineta`" / "`-I`" to show ETA as time of day rather than time remaining - patch supplied by Erkki Seppälä (r147)
@@ -89,20 +108,24 @@
* output errors on a new line to avoid overwriting transfer bar
1.5.7 - 26 August 2014
* show KiB instead of incorrect kiB (Debian bug #706175)
* (#1284) do not gzip man page, for non-Linux OSes (Bob Friesenhahn)
* work around "awk" bug in `tests/016-numeric-timer` in decimal "," locales
* fix "`make rpm`" and "`make srpm`", extend "`make release`" to sign releases
1.5.3 - 4 May 2014
* remove *SPLICE_F_NONBLOCK* to fix problem with slow `splice()` (Jan Seda)
1.5.2 - 10 February 2014
* allow "`--watchfd`" to look at block devices
* let "`--watchfd PID:FD`" work with "`--size N`"
* moved contributors out of the manual as the list was too long (NB everyone is still listed in the README and always will be)
1.5.1 - 23 January 2014
* new option "`--watchfd`" - suggested by Jacek Wielemborek and "fdwatch"
* use non-block flag with `splice()`
* new display option "`--buffer-percent`", suggested by Kim Krecht
@@ -112,6 +135,7 @@
* fix for single fd leak on exit (Cristian Ciupitu)
1.4.12 - 5 August 2013
* new option "`--null`" - patch supplied by Zing Shishak
* AIX build fix (add "`-lc128`") - with help from Pawel Piatek
* AIX "`-c`" fixes - with help from Pawel Piatek
@@ -120,18 +144,22 @@
* fix for `splice()` not using stdin - patch from Zev Weiss
1.4.6 - 22 January 2013
* added patch from Pawel Piatek to omit *O_NOFOLLOW* in AIX
1.4.5 - 10 January 2013
* updated manual page to show known problem with "`-R`" on Cygwin
1.4.4 - 11 December 2012
* added debugging, see "`pv -h`" when `configure` is run with "`--enable-debugging`"
* rewrote cursor positioning code used when IPC is unavailable (Cygwin)
* fixed cursor positioning cursor read answerback problem (Cygwin/Solaris)
* fixed bug causing crash when progress displayed with too-small terminal
1.4.0 - 6 December 2012
* new option "`--skip-errors`" commissioned by Jim Salter
* if stdout is a block device, and we don't know the total size, use the size of that block device as the total (Peter Samuelson)
* new option "`--stop-at-size`" to stop after "`--size`" bytes
@@ -140,27 +168,32 @@
* refactored large chunks of code to make it more readable and to replace most static variables with a state structure
1.3.9 - 5 November 2012
* allow "`--format`" parameters to be sent with "`--remote`"
* configure option "`--disable-ipc`"
* added tests for "`--numeric`" with "`--timer`" and "`--bytes`"
* added tests for "`--remote`"
1.3.8 - 29 October 2012
* new "`--pidfile`" option to save process ID to a file
* integrated patch for "`--numeric`" with "`--timer`" and "`--bytes`" (Sami Liedes)
* removed signalling from "`--remote`" to prevent accidental process kills
* new "`--format`" option (originally Vladimir Pal / Vladimir Ermakov)
1.3.4 - 27 June 2012
* new "`--disable-splice`" configure script option
* fixed line mode size count with multiple files (Moritz Barsnick)
* fixes for AIX core dumps (Pawel Piatek)
1.3.1 - 9 June 2012
* do not use `splice()` if the write buffer is not empty (Thomas Rachel)
* added test 15 (pipe transfers), and new test script
1.3.0 - 5 June 2012
* added Tiger build patch from Olle Jonsson
* fix 1024-boundary display garble (Debian bug #586763)
* use `splice`(2) where available (Debian bug #601683)
@@ -172,6 +205,7 @@
* remove `LD=ld` from `vars.mk` to fix cross-compilation (paintitgray/PV#1291)
1.2.0 - 14 December 2010
* integrated improved SI prefixes and "`--average-rate`" (Henry Gebhardt)
* return nonzero if exiting due to *SIGTERM* (Martin Baum)
* patch from Phil Rutschman to restore terminal properly on exit
@@ -185,12 +219,14 @@
* fixed potential NULL deref in transfer (Elias Pipping / LLVM/Clang)
1.1.4 - 6 March 2008
* patch from Elias Pipping correcting compilation failure on Darwin 9
* patch from Patrick Collison correcting similar problems on OS X
* trap *SIGINT* / *SIGHUP* / *SIGTERM* so we clean up IPCs on exit (Laszlo Ersek)
* abort if numeric option, eg "`-L`", has non-numeric value (Boris Lohner)
1.1.0 - 30 August 2007
* new option "`--remote`" ("`-R`") to control an already-running process
* new option "`--line-mode`" ("`-l`") to count lines instead of bytes
* fix for "`-L`" to be less resource intensive
@@ -200,15 +236,18 @@
* removed "`/debian`" directory at request of new Debian maintainer
1.0.1 - 4 August 2007
* licensing change from Artistic to Artistic 2.0
* removed the "`-l`" / "`--license`" option
1.0.0 - 2 August 2007
* act more like "`cat`" - just skip unreadable files, don't abort
* removed text version of manual page, and obsolete Info file generation
* code cleanup and separation of PV internals from CLI front-end
0.9.9 - 5 February 2007
* new option "`--buffer-size`" ("`-B`") suggested by Mark Tomich
* build fix: HP/UX largefile compile fix from Timo Savinen
* maintain better buffer filling during transfers
@@ -216,65 +255,81 @@
* dropped support for the Texinfo manual
0.9.6 - 27 February 2006
* bugfix: `key_t` incompatibility with Cygwin
* bugfix: interval ("`-i`") parameter parses numbers after decimal point
* build fix: use static NLS if `msgfmt` is unavailable
* on the final update, blank out the now-zero ETA
0.9.2 - 1 September 2005
* Daniel Roethlisberger patch: use lockfiles if terminal locking fails
0.9.1 - 16 June 2005
* minor RPM spec file fix for Fedora Core 4
0.9.0 - 15 November 2004
* minor NLS bugfix
0.8.9 - 6 November 2004
* decimal values now accepted for rate and size, eg "`-L 1.23M`"
* code cleanup
* developers: "`make help`" now lists Makefile targets
0.8.6 - 29 June 2004
* use `uu_lock()` for terminal locking on FreeBSD
0.8.5 - 2 May 2004
* cursor positioning ("`-c`") reliability improved on systems with IPC
* minor fix: made test 005 more reliable
* new option "`--height`" ("`-H`")
0.8.2 - 24 April 2004
* allow k,m,g,t suffixes on numbers
* added "`srpm`" and "`release`" Makefile targets
0.8.1 - 19 April 2004
* bugfix in cursor positioning ("`-c`")
0.8.0 - 12 February 2004
* replaced GNU getopt with my library code
* replaced GNU gettext with my very minimal replacement
* use *DESTDIR* instead of *RPM_BUILD_ROOT* for optional installation prefix
* looked for flaws using RATS, cleaned up code
0.7.0 - 8 February 2004
* display buffer management fixes (thanks Cédric Delfosse)
* replaced "`--enable-debug`" with "`--enable-debugging`" and "`--enable-profiling`"
0.6.4 - 14 January 2004
* fixed minor bug in RPM installation
* bugfix in "`make index`" (only of interest to developers)
0.6.3 - 22 December 2003
* fixed transient bug that reported "resource unavailable" occasionally
0.6.2 - 6 August 2003
* block devices now have their size read correctly, so "`pv /dev/hda1`" works
* minor code cleanups (mainly removal of CVS "Id" tags)
0.6.0 - 3 August 2003
* doing *^Z* then "`bg`" then "`fg`" now continues displaying
0.5.9 - 23 July 2003
* fix for test 007 when not in C locale
* fix for build process to use *CPPFLAGS*
* fix for build process to use correct i18n libraries
@@ -283,32 +338,38 @@
* fixes for building on Mac OS X
0.5.3 - 4 May 2003
* added Polish translation thanks to Bartosz Feński <fenio@o2.pl> <http://skawina.eu.org/> and Krystian Zubel
* moved `doc/debian` to `./debian` at insistence of common sense
* minor Solaris 8 compatibility fixes
* seems to compile and test OK on Mac OS X
0.5.0 - 15 April 2003
* added French translation thanks to Stéphane Lacasse <stephane@gorfou.ca>
* added German translation thanks to Marcos Kreinacke <public@kreinacke.com>
* switched LGPL reference from "Library" to "Lesser"
0.4.9 - 18 February 2003
* support for >2GB files added where available (Debian bug #180986)
* added `doc/debian` dir (from Cédric Delfosse)
* added "`make rpm`" and "`make deb`" targets to build RPM and Debian packages
* added a "`make pv-static`" rule to build a statically linked version
0.4.5 - 13 December 2002
* added Portuguese (Brazilian) translation thanks to Eduardo Aguiar
0.4.4 - 7 December 2002
* pause/resume support - don't count time while stopped
* stop output when resumed in the background
* terminal size change support
* bugfix: "`<=>`" indicator no longer sticks at right hand edge
0.4.0 - 27 November 2002
* allow decimal interval values, eg 0.1, 0.5, etc
* some simple tests added ("`make check`")
* smoother throughput limiting ("`--rate-limit`"), now done in 0.1sec chunks
@@ -319,10 +380,12 @@
* use `fcntl()` instead of `flock()` for Solaris compatibility
0.3.0 - 25 November 2002
* handle broken output pipe gracefully
* continue updating display even when output pipe is blocking
0.2.6 - 21 October 2002
* we now ignore *EINTR* on `select()`
* variable-size buffer (still need to add code to change size)
* added (tentative) support for internationalisation
@@ -333,25 +396,30 @@
* added "`--quiet`" option (no output at all) to be used with "`--rate-limit`"
0.2.5 - 23 July 2002
* added *[FILE]...* arguments, like "`cat`"
* function separation in code
* some bug fixes related to numeric overflow
0.2.3 - 19 July 2002
* Texinfo manual written, man page updated
* byte counter added
0.2.0 - 18 July 2002
* ETA counter added
* screen width estimation added
* progress bar added
0.1.0 - 17 July 2002
* main loop created
* rate counter added
* elapsed time counter added
* percentage calculation added
0.0.1 - 16 July 2002
* package created
* first draft of man page written
-3
View File
@@ -8,9 +8,6 @@ Bugs
* ([GH#20](https://github.com/a-j-wood/pv/issues/20)) Terminal state is not restored correctly in all cases (VA)
* ([GH#24](https://github.com/a-j-wood/pv/issues/24)) Race condition with multiple "`pv -c`" leaves terminal state inconsistent (Lars Ellenberg, Viktor Ashirov)
* ([GH#34](https://github.com/a-j-wood/pv/issues/34)) Continue timer even if input or output is blocking (Martin Probst - Jun 2017)
* ([GH#69](https://github.com/a-j-wood/pv/issues/69)) Configure issue for stat64
* ([GH#70](https://github.com/a-j-wood/pv/issues/70)) New compilation warnings
* ([GH#71](https://github.com/a-j-wood/pv/issues/71)) Debian complains about old OpenPGP signatures
Feature requests
----------------
+1 -1
View File
@@ -1 +1 @@
1.7.17
1.7.24
+1 -1
View File
@@ -1,7 +1,7 @@
Begin3
Title: @PACKAGE@
Version: @VERSION@
Entered-date: 27JUL23
Entered-date: 30JUL23
Description: A tool for monitoring the progress of data through a
pipeline. It can be inserted into any normal pipeline
between two processes to give a visual indication of how
+1 -2
View File
@@ -10,10 +10,9 @@ Before releasing a new version, go through this checklist:
- make test
- commit to repository
- wipe build directory, re-run generate.sh and configure
- make release
- make release MAINTAINER=<signing-user>
- make manhtml | tidy -asxhtml | sed -e '1,/<body>/d' -e '/<\/body>/,$d'
- update HTML for todo and news
- copy and sign tar.gz to HTML directory (sig as both .asc and .txt)
- submit new release to Sourceforge
- upload HTML
- check validator results for project page and manual
-1
View File
@@ -26,7 +26,6 @@
#endif
/* Boolean type support */
#undef HAVE_STDBOOL_H
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
#else
+12 -8
View File
@@ -29,22 +29,26 @@
#else
# define _(String) minigettext (String)
# define N_(String) (String)
# define setlocale minisetlocale
# ifdef HAVE_LOCALE_H
# include <locale.h>
# else
# define setlocale minisetlocale
# ifndef LC_ALL
# define LC_ALL ""
# endif
# endif
# define bindtextdomain minibindtextdomain
# define textdomain minitextdomain
# ifndef LC_ALL
# define LC_ALL ""
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
char *minisetlocale(char *, char *);
char *minibindtextdomain(char *, char *);
char *minitextdomain(char *);
char *minigettext(char *);
char *minisetlocale(const char *, const char *);
char *minibindtextdomain(const char *, const char *);
char *minitextdomain(const char *);
char *minigettext(const char *);
#ifdef __cplusplus
}
+6 -1
View File
@@ -170,7 +170,7 @@ extern void pv_state_free(pvstate_t);
#ifdef ENABLE_DEBUGGING
# if __STDC_VERSION__ < 199901L
# if __STDC_VERSION__ < 199901L && !defined(__func__)
# if __GNUC__ >= 2
# define __func__ __FUNCTION__
# else
@@ -182,6 +182,11 @@ extern void pv_state_free(pvstate_t);
# define debug(x,...) do { } while (0)
#endif
/*
* Set the debugging destination file, if debugging is enabled.
*/
void debugging_output_destination(const char *);
/*
* Output debugging information, if debugging is enabled.
*/
+2 -4
View File
@@ -72,8 +72,7 @@ int minigetopt(int argc, char **argv, char *optstring)
if (0 == optstring[i]) {
minioptopt = optchar;
if (miniopterr)
fprintf(stderr, "%s: invalid option -- %c\n",
argv[0], optchar);
fprintf(stderr, "%s: invalid option -- %c\n", argv[0], optchar);
return '?';
}
@@ -103,8 +102,7 @@ int minigetopt(int argc, char **argv, char *optstring)
nextchar = 0;
minioptind++;
if (minioptind >= argc) {
fprintf(stderr, "%s: option `-%c' requires an argument\n",
argv[0], optchar);
fprintf(stderr, "%s: option `-%c' requires an argument\n", argv[0], optchar);
return ':';
}
minioptarg = argv[minioptind++];
+9 -9
View File
@@ -38,25 +38,25 @@ struct msgtable_s *minigettext__gettable(char *a)
}
#endif /* ENABLE_NLS */
char *minisetlocale(char *a, char *b)
char *minisetlocale(const char *a, const char *b)
{
return NULL;
}
char *minibindtextdomain(char *a, char *b)
char *minibindtextdomain(const char *a, const char *b)
{
return NULL;
}
char *minitextdomain(char *a)
char *minitextdomain(const char *a)
{
return NULL;
}
char *minigettext(char *msgid)
char *minigettext(const char *msgid)
{
static struct msgtable_s *table = NULL;
static int tried_lang = 0;
@@ -64,7 +64,7 @@ char *minigettext(char *msgid)
int i;
if (NULL == msgid)
return msgid;
return NULL;
if (0 == tried_lang) {
lang = getenv("LANGUAGE");
@@ -93,19 +93,19 @@ char *minigettext(char *msgid)
}
if (NULL == table)
return msgid;
return (char *) msgid;
for (i = 0; table[i].msgid; i++) {
if (0 == strcmp(table[i].msgid, msgid)) {
if (0 == table[i].msgstr)
return msgid;
return (char *) msgid;
if (0 == table[i].msgstr[0])
return msgid;
return (char *) msgid;
return table[i].msgstr;
}
}
return msgid;
return (char *) msgid;
}
#endif /* HAVE_GETTEXT */
+52 -18
View File
@@ -18,57 +18,91 @@
#ifdef ENABLE_DEBUGGING
/*@null@*/ static const char *debug_filename = NULL;
/*
* Output debugging information to the file given in the DEBUG environment
* variable, if it is defined.
* Set the destination for debugging information.
*/
void debugging_output(const char *function, const char *file, int line,
const char *format, ...)
void debugging_output_destination(const char *filename)
{
debug_filename = filename;
}
/*
* Output debugging information to the file specified earlier by a call to
* debugging_output_destination(), if any.
*/
void debugging_output(const char *function, const char *file, int line, const char *format, ...)
{
static bool tried_open = false;
static FILE *debugfptr = NULL;
char *debugfile;
va_list ap;
time_t t;
struct tm *tm;
char tbuf[128];
char tbuf[128]; /* flawfinder: ignore */
/*
* flawfinder note: tbuf is only written to by strftime() which
* takes its size, and we enforce string termination.
*/
if (false == tried_open) {
debugfile = getenv("DEBUG");
if (NULL != debugfile)
debugfptr = fopen(debugfile, "a");
if (NULL != debug_filename) {
debugfptr = fopen(debug_filename, "a"); /* flawfinder: ignore */
/*
* flawfinder note: caller directly controls
* filename, the safest we can manage is to use
* append mode.
*/
}
tried_open = true;
}
if (NULL == debugfptr)
if (NULL == debugfptr) {
return;
}
(void) time(&t);
tm = localtime(&t);
tbuf[0] = '\0';
if (0 == strftime(tbuf, sizeof(tbuf), "%Y-%m-%d %H:%M:%S", tm))
if (0 == strftime(tbuf, sizeof(tbuf), "%Y-%m-%d %H:%M:%S", tm)) {
tbuf[0] = '\0';
}
tbuf[sizeof(tbuf) - 1] = '\0'; /* enforce termination */
(void) fprintf(debugfptr, "[%s] (%d) %s (%s:%d): ", tbuf, getpid(),
function, file, line);
(void) fprintf(debugfptr, "[%s] (%d) %s (%s:%d): ", tbuf, getpid(), function, file, line);
va_start(ap, format);
(void) vfprintf(debugfptr, format, ap);
(void) vfprintf(debugfptr, format, ap); /* flawfinder: ignore */
va_end(ap);
/*
* flawfinder note: vfprintf format is explicitly controlled by the
* caller of this function - no mitigation possible or desirable.
*/
(void) fprintf(debugfptr, "\n");
(void) fflush(debugfptr);
}
#else /* ! ENABLE_DEBUGGING */
/*
* Stub debugging destination function.
*/
void debugging_output_destination( __attribute__((unused))
const char *filename)
{
}
/*
* Stub debugging output function.
*/
void debugging_output( __attribute__ ((unused))
const char *function, __attribute__ ((unused))
const char *file, __attribute__ ((unused))
int line, __attribute__ ((unused))
void debugging_output( __attribute__((unused))
const char *function, __attribute__((unused))
const char *file, __attribute__((unused))
int line, __attribute__((unused))
const char *format, ...)
{
}
+556 -190
View File
@@ -12,12 +12,264 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#if defined(ENABLE_NLS) && defined(HAVE_WCHAR_H)
#include <wchar.h>
#if defined(HAVE_WCTYPE_H)
#include <wctype.h>
#endif
#endif
struct optdesc_s {
char *optshort;
char *optlong;
char *param;
char *description;
/*
* Return the number of display columns needed to show the given string.
*
* To do this, we convert it to a wide character string, and use the wide
* character display width function "wcswidth()" on it.
*
* If NLS is disabled, or the string cannot be converted, this is just the
* same as "strlen()".
*/
static size_t display_width(const char *string)
{
size_t width;
#if defined(ENABLE_NLS) && defined(HAVE_WCHAR_H)
size_t wide_char_count;
size_t wide_string_buffer_size;
wchar_t *wide_string;
if (NULL == string)
return 0;
/*@-nullpass@ */
/*
* splint note: mbstowcs() manual page on Linux explicitly says it
* takes NULL.
*/
wide_char_count = mbstowcs(NULL, string, 0);
/*@+nullpass@ */
if (wide_char_count == (size_t) -1) {
debug("%s: %s: %s", "mbstowcs", string, strerror(errno));
return strlen(string); /* flawfinder: ignore */
/*
* flawfinder rationale: we have already checked for NULL,
* and we don't know the size of the originating buffer so
* can't use strnlen(); it is up to the caller to provide a
* terminated string.
*/
}
wide_string_buffer_size = sizeof(*wide_string) * (1 + wide_char_count);
wide_string = malloc(wide_string_buffer_size);
if (NULL == wide_string) {
perror("malloc");
return strlen(string); /* flawfinder: ignore */
/* flawfinder rationale: see above. */
}
memset(wide_string, 0, wide_string_buffer_size);
if (mbstowcs(wide_string, string, 1 + wide_char_count) == (size_t) -1) {
debug("%s: %s: %s", "mbstowcs", string, strerror(errno));
width = strlen(string); /* flawfinder: ignore */
/* flawfinder rationale: see above. */
} else if (NULL != wide_string) {
/*@-unrecog @ */
/* splint seems unable to see the prototype. */
width = wcswidth(wide_string, wide_char_count);
/*@+unrecog @ */
} else {
width = 0;
}
free(wide_string);
#else /* ! defined(ENABLE_NLS) && defined(HAVE_WCHAR_H) */
if (NULL == string)
return 0;
width = strlen(string); /* flawfinder: ignore */
/* flawfinder rationale: see above. */
#endif /* defined(ENABLE_NLS) && defined(HAVE_WCHAR_H) */
return width;
}
/*
* The 7-bit ASCII version of display_word_wrap() below - does not
* understand multi-byte characters.
*/
static void display_word_wrap_7bit(const char *string, size_t display_width, size_t left_margin)
{
const char *start;
const char *end;
if (NULL == string)
return;
start = string;
while (strlen(start) > display_width) { /* flawfinder: ignore */
/* flawfinder rationale: see above. */
end = start + display_width;
while ((end > start) && (end[0] != ' '))
end--;
if (end == start) {
end = start + display_width;
} else {
end++;
}
printf("%.*s", (int) (end - start), start);
if (end == start)
end++;
start = end;
if (start[0] != '\0')
printf("\n%*s", (int) left_margin, "");
}
printf("%s", start);
}
/*
* Output a string to standard output, word wrapping to "display_width"
* display character positions, and left-padding any new lines after the
* first one with "left_margin" spaces.
*
* Wide characters are handled if NLS is enabled, but if they can't be, this
* falls back to a version which just counts bytes as characters.
*/
static void display_word_wrap(const char *string, size_t display_width, size_t left_margin)
{
#if defined(ENABLE_NLS) && defined(HAVE_WCHAR_H)
size_t wide_char_count;
size_t wide_string_buffer_size;
wchar_t *wide_string;
size_t start_idx, end_idx, chars_remaining;
if (NULL == string)
return;
/*@-nullpass@ */
/* splint note: see earlier mbstowcs() call. */
wide_char_count = mbstowcs(NULL, string, 0);
/*@+nullpass@ */
if (wide_char_count == (size_t) -1) {
debug("%s: %s: %s", "mbstowcs", string, strerror(errno));
display_word_wrap_7bit(string, display_width, left_margin);
return;
}
wide_string_buffer_size = sizeof(*wide_string) * (1 + wide_char_count);
wide_string = malloc(wide_string_buffer_size);
if (NULL == wide_string) {
perror("malloc");
display_word_wrap_7bit(string, display_width, left_margin);
return;
}
memset(wide_string, 0, wide_string_buffer_size);
if (mbstowcs(wide_string, string, 1 + wide_char_count) == (size_t) -1) {
debug("%s: %s: %s", "mbstowcs", string, strerror(errno));
free(wide_string);
display_word_wrap_7bit(string, display_width, left_margin);
return;
}
start_idx = 0;
chars_remaining = wide_char_count;
while (chars_remaining > 0 && wcswidth(&(wide_string[start_idx]), chars_remaining) > display_width) {
size_t next_idx;
end_idx = start_idx + display_width;
while ((end_idx > start_idx) && (!iswspace(wide_string[end_idx])))
end_idx--;
if (end_idx == start_idx) {
end_idx = start_idx + display_width;
} else {
end_idx++;
}
next_idx = end_idx;
if (end_idx == start_idx)
next_idx++;
while (start_idx < end_idx && start_idx < wide_char_count) {
char multi_byte_string[MB_CUR_MAX + 1]; /* flawfinder: ignore */
/*
* flawfinder rationale: array is explicitly
* cleared, large enough according to the wctomb()
* manual, and we explicitly terminate the string.
*/
memset(multi_byte_string, 0, MB_CUR_MAX + 1);
if (wctomb(multi_byte_string, wide_string[start_idx]) >= 0) {
multi_byte_string[MB_CUR_MAX] = '\0';
printf("%s", multi_byte_string);
}
start_idx++;
}
start_idx = next_idx;
if (start_idx < wide_char_count)
printf("\n%*s", (int) left_margin, "");
chars_remaining = wide_char_count - start_idx;
}
while (start_idx < wide_char_count) {
char multi_byte_string[MB_CUR_MAX + 1]; /* flawfinder: ignore */
/* flawfinder rationale as above. */
memset(multi_byte_string, 0, MB_CUR_MAX + 1);
if (wctomb(multi_byte_string, wide_string[start_idx]) >= 0) {
multi_byte_string[MB_CUR_MAX] = '\0';
printf("%s", multi_byte_string);
}
start_idx++;
}
free(wide_string);
#else /* ! defined(ENABLE_NLS) && defined(HAVE_WCHAR_H) */
display_word_wrap_7bit(string, display_width, left_margin);
#endif /* defined(ENABLE_NLS) && defined(HAVE_WCHAR_H) */
}
/*
* Structure holding the displayed descriptions of each option - the short
* option such as "-s", its long counterpart such as "--size", the name of
* its argument such as "SIZE", and the description of what the option does.
* Any of them may be NULL.
*
* In the initialiser for this structure, translatable strings are wrapped
* with N_() to indicate that they are to be translated into the operator's
* language by this function at run-time.
*
* Note that "opt_short" and "opt_long" should never be marked as
* translatable, as they must remain consistent across all locales.
*
* The list is terminated with a NULL opt_short value - to leave a gap, set
* opt_short to an empty string instead.
*/
struct option_definition_s {
/*@null@ */ const char *opt_short;
/*@null@ */ const char *opt_long;
/*@null@ *//*@observer@ */ const char *opt_argument;
/*@null@ *//*@observer@ */ const char *opt_description;
struct {
/*
* Structure holding the width, in display character
* positions, of the individual parts of the description of
* each option - calculated after initialisation, so that
* translation can be performed.
*/
size_t opt_short;
size_t opt_long;
size_t opt_argument;
size_t opt_description;
} width;
};
@@ -26,197 +278,311 @@ struct optdesc_s {
*/
void display_help(void)
{
struct optdesc_s optlist[] = {
{"-p", "--progress", 0,
N_("show progress bar")},
{"-t", "--timer", 0,
N_("show elapsed time")},
{"-e", "--eta", 0,
N_("show estimated time of arrival (completion)")},
{"-I", "--fineta", 0,
N_
("show absolute estimated time of arrival (completion)")},
{"-r", "--rate", 0,
N_("show data transfer rate counter")},
{"-a", "--average-rate", 0,
N_("show data transfer average rate counter")},
{"-m", "--average-rate-window", N_("SEC"),
N_
("compute average rate over past SEC seconds (default 30s)")},
{"-b", "--bytes", 0,
N_("show number of bytes transferred")},
{"-8", "--bits", 0,
N_("show number of bits transferred")},
{"-T", "--buffer-percent", 0,
N_("show percentage of transfer buffer in use")},
{"-A", "--last-written", _("NUM"),
N_("show NUM bytes last written")},
{"-F", "--format", N_("FORMAT"),
N_("set output format to FORMAT")},
{"-n", "--numeric", 0,
N_("output percentages, not visual information")},
{"-q", "--quiet", 0,
N_("do not output any transfer information at all")},
{"", 0, 0, 0},
{"-W", "--wait", 0,
N_("display nothing until first byte transferred")},
{"-D", "--delay-start", N_("SEC"),
N_("display nothing until SEC seconds have passed")},
{"-s", "--size", N_("SIZE"),
N_("set estimated data size to SIZE bytes")},
{"-l", "--line-mode", 0,
N_("count lines instead of bytes")},
{"-0", "--null", 0,
N_("lines are null-terminated")},
{"-i", "--interval", N_("SEC"),
N_("update every SEC seconds")},
{"-w", "--width", N_("WIDTH"),
N_("assume terminal is WIDTH characters wide")},
{"-H", "--height", N_("HEIGHT"),
N_("assume terminal is HEIGHT rows high")},
{"-N", "--name", N_("NAME"),
N_("prefix visual information with NAME")},
{"-f", "--force", 0,
N_("output even if standard error is not a terminal")},
{"-c", "--cursor", 0,
N_("use cursor positioning escape sequences")},
{"", 0, 0, 0},
{"-L", "--rate-limit", N_("RATE"),
N_("limit transfer to RATE bytes per second")},
{"-B", "--buffer-size", N_("BYTES"),
N_("use a buffer size of BYTES")},
{"-C", "--no-splice", 0,
N_("never use splice(), always use read/write")},
{"-E", "--skip-errors", 0,
N_("skip read errors in input")},
{"-S", "--stop-at-size", 0,
N_("stop after --size bytes have been transferred")},
{"-Y", "--sync", 0,
N_("flush cache to disk after every write")},
{"-K", "--direct-io", 0,
N_("use direct I/O to bypass cache")},
struct option_definition_s option_definitions[] = {
{ "-p", "--progress", NULL,
N_("show progress bar"),
{ 0, 0, 0, 0} },
{ "-t", "--timer", NULL,
N_("show elapsed time"),
{ 0, 0, 0, 0} },
{ "-e", "--eta", NULL,
N_("show estimated time of arrival (completion)"),
{ 0, 0, 0, 0} },
{ "-I", "--fineta", NULL,
N_("show absolute estimated time of arrival (completion)"),
{ 0, 0, 0, 0} },
{ "-r", "--rate", NULL,
N_("show data transfer rate counter"),
{ 0, 0, 0, 0} },
{ "-a", "--average-rate", NULL,
N_("show data transfer average rate counter"),
{ 0, 0, 0, 0} },
{ "-m", "--average-rate-window", N_("SEC"),
N_("compute average rate over past SEC seconds (default 30s)"),
{ 0, 0, 0, 0} },
{ "-b", "--bytes", NULL,
N_("show number of bytes transferred"),
{ 0, 0, 0, 0} },
{ "-8", "--bits", NULL,
N_("show number of bits transferred"),
{ 0, 0, 0, 0} },
{ "-T", "--buffer-percent", NULL,
N_("show percentage of transfer buffer in use"),
{ 0, 0, 0, 0} },
{ "-A", "--last-written", _("NUM"),
N_("show NUM bytes last written"),
{ 0, 0, 0, 0} },
{ "-F", "--format", N_("FORMAT"),
N_("set output format to FORMAT"),
{ 0, 0, 0, 0} },
{ "-n", "--numeric", NULL,
N_("output percentages, not visual information"),
{ 0, 0, 0, 0} },
{ "-q", "--quiet", NULL,
N_("do not output any transfer information at all"),
{ 0, 0, 0, 0} },
{ "", NULL, NULL, NULL, { 0, 0, 0, 0} },
{ "-W", "--wait", NULL,
N_("display nothing until first byte transferred"),
{ 0, 0, 0, 0} },
{ "-D", "--delay-start", N_("SEC"),
N_("display nothing until SEC seconds have passed"),
{ 0, 0, 0, 0} },
{ "-s", "--size", N_("SIZE"),
N_("set estimated data size to SIZE bytes"),
{ 0, 0, 0, 0} },
{ "-l", "--line-mode", NULL,
N_("count lines instead of bytes"),
{ 0, 0, 0, 0} },
{ "-0", "--null", NULL,
N_("lines are null-terminated"),
{ 0, 0, 0, 0} },
{ "-i", "--interval", N_("SEC"),
N_("update every SEC seconds"),
{ 0, 0, 0, 0} },
{ "-w", "--width", N_("WIDTH"),
N_("assume terminal is WIDTH characters wide"),
{ 0, 0, 0, 0} },
{ "-H", "--height", N_("HEIGHT"),
N_("assume terminal is HEIGHT rows high"),
{ 0, 0, 0, 0} },
{ "-N", "--name", N_("NAME"),
N_("prefix visual information with NAME"),
{ 0, 0, 0, 0} },
{ "-f", "--force", NULL,
N_("output even if standard error is not a terminal"),
{ 0, 0, 0, 0} },
{ "-c", "--cursor", NULL,
N_("use cursor positioning escape sequences"),
{ 0, 0, 0, 0} },
{ "", NULL, NULL, NULL, { 0, 0, 0, 0} },
{ "-L", "--rate-limit", N_("RATE"),
N_("limit transfer to RATE bytes per second"),
{ 0, 0, 0, 0} },
{ "-B", "--buffer-size", N_("BYTES"),
N_("use a buffer size of BYTES"),
{ 0, 0, 0, 0} },
{ "-C", "--no-splice", NULL,
N_("never use splice(), always use read/write"),
{ 0, 0, 0, 0} },
{ "-E", "--skip-errors", NULL,
N_("skip read errors in input"),
{ 0, 0, 0, 0} },
{ "-S", "--stop-at-size", NULL,
N_("stop after --size bytes have been transferred"),
{ 0, 0, 0, 0} },
{ "-Y", "--sync", NULL,
N_("flush cache to disk after every write"),
{ 0, 0, 0, 0} },
{ "-K", "--direct-io", NULL,
N_("use direct I/O to bypass cache"),
{ 0, 0, 0, 0} },
#ifdef HAVE_IPC
{"-R", "--remote", N_("PID"),
N_("update settings of process PID")},
{ "-R", "--remote", N_("PID"),
N_("update settings of process PID"),
{ 0, 0, 0, 0} },
#endif /* HAVE_IPC */
{"", 0, 0, 0},
{"-P", "--pidfile", N_("FILE"),
N_("save process ID in FILE")},
{"", 0, 0, 0},
{"-d", "--watchfd", N_("PID[:FD]"),
N_("watch file FD opened by process PID")},
{"", 0, 0, 0},
{"-h", "--help", 0,
N_("show this help and exit")},
{"-V", "--version", 0,
N_("show version information and exit")},
{0, 0, 0, 0}
};
unsigned int i, col1max = 0, tw = 77;
char *optbuf;
size_t optbuf_size;
printf(_("Usage: %s [OPTION] [FILE]..."), PROGRAM_NAME);
printf("\n%s\n\n",
_
("Concatenate FILE(s), or standard input, to standard output,\n"
"with monitoring."));
for (i = 0; optlist[i].optshort; i++) {
unsigned int width = 0;
char *param;
width = 2 + (unsigned int) strlen(optlist[i].optshort);
#ifdef HAVE_GETOPT_LONG
if (optlist[i].optlong)
width +=
2 + (unsigned int) strlen(optlist[i].optlong);
#endif
param = optlist[i].param;
if (param)
param = _(param);
if (param)
width += 1 + strlen(param);
if (width > col1max)
col1max = width;
}
col1max++;
optbuf_size = 16 + col1max;
optbuf = malloc(optbuf_size);
if (NULL == optbuf) {
fprintf(stderr, "%s: %s\n", PROGRAM_NAME, strerror(errno));
exit(EXIT_FAILURE);
}
for (i = 0; optlist[i].optshort; i++) {
char *param;
char *description;
char *start;
char *end;
if ('\0' == optlist[i].optshort[0]) {
printf("\n");
continue;
}
param = optlist[i].param;
if (param)
param = _(param);
description = optlist[i].description;
if (description)
description = _(description);
(void) pv_snprintf(optbuf, optbuf_size, "%s%s%s%s%s",
optlist[i].optshort,
#ifdef HAVE_GETOPT_LONG
optlist[i].optlong ? ", " : "",
optlist[i].
optlong ? optlist[i].optlong : "",
#else
"", "",
#endif
param ? " " : "", param ? param : "");
printf(" %-*s ", (int) (col1max - 2), optbuf);
if (NULL == description) {
printf("\n");
continue;
}
start = description;
while ((unsigned int) strlen(start) > tw - col1max) {
end = start + tw - col1max;
while ((end > start) && (end[0] != ' '))
end--;
if (end == start) {
end = start + tw - col1max;
} else {
end++;
}
printf("%.*s\n%*s ", (int) (end - start), start,
(int) col1max, "");
if (end == start)
end++;
start = end;
}
printf("%s\n", start);
}
{ "", NULL, NULL, NULL, { 0, 0, 0, 0} },
{ "-P", "--pidfile", N_("FILE"),
N_("save process ID in FILE"),
{ 0, 0, 0, 0} },
{ "", NULL, NULL, NULL, { 0, 0, 0, 0} },
{ "-d", "--watchfd", N_("PID[:FD]"),
N_("watch file FD opened by process PID"),
{ 0, 0, 0, 0} },
{ "", NULL, NULL, NULL, { 0, 0, 0, 0} },
{ "-h", "--help", NULL,
N_("show this help and exit"),
{ 0, 0, 0, 0} },
{ "-V", "--version", NULL,
N_("show version information and exit"),
{ 0, 0, 0, 0} },
#ifdef ENABLE_DEBUGGING
printf("\n");
printf("%s",
_
("Debugging is enabled; export the DEBUG environment variable to define the\noutput filename.\n"));
{ "-!", "--debug", N_("FILE"),
N_("write debug logs to FILE"),
{ 0, 0, 0, 0} },
#endif
{ NULL, NULL, NULL, NULL, { 0, 0, 0, 0} }
};
unsigned int option_index;
size_t widest_option_width = 0;
size_t description_left_margin = 0;
size_t min_description_width = 50;
size_t right_margin = 77;
const char *program_description;
const char *bug_report_note;
unsigned int terminal_width = 0, terminal_height = 0;
pv_screensize(&terminal_width, &terminal_height);
if (terminal_width > 5) {
right_margin = (size_t) (terminal_width - 3);
}
/*@-formatconst@ */
/*
* splint note: unavoidable use of %s in translated string. Should
* be hard to exploit - the message catalogue would have to be
* replaced or forced to load from another location.
*/
printf(_("Usage: %s [OPTION] [FILE]..."), PROGRAM_NAME);
/*@+formatconst@ */
printf("\n");
printf(_("Please report any bugs to %s."), BUG_REPORTS_TO);
/*@-mustfreefresh@ */
/*
* splint note: the gettext calls made by _() cause memory leak
* warnings, but in this case it's unavoidable, and mitigated by the
* fact we only translate each string once.
*/
program_description = _("Concatenate FILE(s), or standard input, to standard output, with monitoring.");
if (NULL != program_description) {
display_word_wrap(program_description, right_margin, 0);
printf("\n");
}
printf("\n");
/*
* Translate the help text, and calculate the displayed width of
* each part of each option definition. The total display width of
* the short option, long option, and option argument together form
* the "option" width - we look for the widest one to calculate the
* left margin for all of the descriptions to start at.
*/
for (option_index = 0; NULL != option_definitions[option_index].opt_short; option_index++) {
struct option_definition_s *definition;
size_t option_width;
definition = &(option_definitions[option_index]);
option_width = 0;
definition->width.opt_short = display_width(definition->opt_short);
definition->width.opt_long = 0;
definition->width.opt_argument = 0;
definition->width.opt_description = 0;
if (NULL != definition->opt_long) {
definition->width.opt_long = display_width(definition->opt_long);
}
if (NULL != definition->opt_argument) {
/*@observer@ */ const char *translated;
translated = _(definition->opt_argument);
if (NULL != translated) {
definition->opt_argument = translated;
}
definition->width.opt_argument = display_width(definition->opt_argument);
}
if (NULL != definition->opt_description) {
/*@observer@ */ const char *translated;
translated = _(definition->opt_description);
if (NULL != translated) {
definition->opt_description = translated;
}
definition->width.opt_description = display_width(definition->opt_description);
}
/*
* The option_width is padded with a left margin of 2
* spaces, a ", " between the short and long options, a
* space between the long option and the argument, and two
* spaces after the argument:
*
* " <short>, <long> <arg> <description>"
*
* If we don't have getopt_long() then ", <long>" is omitted.
*/
option_width += 2 + definition->width.opt_short; /* " short" */
#ifdef HAVE_GETOPT_LONG
option_width += 2 + definition->width.opt_long; /* ", <long>" */
#endif
option_width += 1 + definition->width.opt_argument; /* " ARG" */
option_width += 2; /* final 2 spaces */
if (option_width > widest_option_width) {
widest_option_width = option_width;
}
}
/*
* Set the left margin for the option descriptions, based on the
* widest option width, or (right margin - min_description_width),
* whichever is less, so that there is always room for
* "min_description_width" characters of description.
*/
description_left_margin = right_margin - min_description_width;
if (widest_option_width < description_left_margin) {
description_left_margin = widest_option_width;
}
debug("%s: description_left_margin=%d, widest_option_width=%d, right_margin=%d", "help display",
(int) description_left_margin, (int) widest_option_width, (int) right_margin);
/*
* Display each of the option definitions, word wrapping the
* descriptions.
*/
for (option_index = 0; NULL != option_definitions[option_index].opt_short; option_index++) {
struct option_definition_s *definition;
size_t option_width;
definition = &(option_definitions[option_index]);
option_width = 0;
if (definition->width.opt_short > 0 && NULL != definition->opt_short) {
printf(" %s", definition->opt_short);
option_width += 2 + definition->width.opt_short;
}
#ifdef HAVE_GETOPT_LONG
if (definition->width.opt_long > 0 && NULL != definition->opt_long) {
printf(", %s", definition->opt_long);
option_width += 2 + definition->width.opt_long;
}
#endif
if (definition->width.opt_argument > 0 && NULL != definition->opt_argument) {
printf(" %s", definition->opt_argument);
option_width += 1 + definition->width.opt_argument;
}
/* Just start a new line if there's no description. */
if ((0 == definition->width.opt_description) || (NULL == definition->opt_description)) {
printf("\n");
continue;
}
/*
* If the option is too wide, start a new line for the
* description. In both cases, pad with spaces up to the
* description left margin.
*/
if (option_width > description_left_margin) {
printf("\n%*s", (int) description_left_margin, "");
} else if (option_width < description_left_margin) {
printf("%*s", (int) (description_left_margin - option_width), "");
}
/* Output the description, word wrapped. */
display_word_wrap(definition->opt_description, right_margin - description_left_margin,
description_left_margin);
printf("\n");
}
printf("\n");
bug_report_note = _("Please report any bugs to %s.");
if (NULL != bug_report_note) {
/*@-formatconst@ */
/*
* splint note: see earlier "formatconst" note.
* flawfinder: same reason.
*/
printf(bug_report_note, BUG_REPORTS_TO); /* flawfinder: ignore */
/*@+formatconst@ */
}
printf("\n");
}
+15 -33
View File
@@ -72,8 +72,7 @@ int main(int argc, char **argv)
*/
state = pv_state_alloc(opts->program_name);
if (NULL == state) {
fprintf(stderr, "%s: %s: %s\n", opts->program_name,
_("state allocation failed"), strerror(errno));
fprintf(stderr, "%s: %s: %s\n", opts->program_name, _("state allocation failed"), strerror(errno));
opts_free(opts);
debug("%s: %d", "exiting with status", 64);
return 64;
@@ -86,16 +85,14 @@ int main(int argc, char **argv)
FILE *pidfptr;
pidfptr = fopen(opts->pidfile, "w");
if (NULL == pidfptr) {
fprintf(stderr, "%s: %s: %s\n", opts->program_name,
opts->pidfile, strerror(errno));
fprintf(stderr, "%s: %s: %s\n", opts->program_name, opts->pidfile, strerror(errno));
pv_state_free(state);
opts_free(opts);
return 1;
}
fprintf(pidfptr, "%d\n", getpid());
if (0 != fclose(pidfptr)) {
fprintf(stderr, "%s: %s: %s\n", opts->program_name,
opts->pidfile, strerror(errno));
fprintf(stderr, "%s: %s: %s\n", opts->program_name, opts->pidfile, strerror(errno));
}
}
@@ -110,8 +107,7 @@ int main(int argc, char **argv)
/*
* Put our list of files into the PV internal state.
*/
pv_state_inputfiles(state, opts->argc,
(const char **) (opts->argv));
pv_state_inputfiles(state, opts->argc, (const char **) (opts->argv));
if (0 == opts->watch_pid) {
/*
@@ -120,8 +116,7 @@ int main(int argc, char **argv)
*/
if ((0 == opts->size) && (false == opts->linemode)) {
opts->size = pv_calc_total_size(state);
debug("%s: %llu", "no size given - calculated",
opts->size);
debug("%s: %llu", "no size given - calculated", opts->size);
}
/*
@@ -154,13 +149,11 @@ int main(int argc, char **argv)
pv_screensize(&width, &height);
if (0 == opts->width) {
opts->width = width;
debug("%s: %u", "auto-detected terminal width",
width);
debug("%s: %u", "auto-detected terminal width", width);
}
if (0 == opts->height) {
opts->height = height;
debug("%s: %u", "auto-detected terminal height",
height);
debug("%s: %u", "auto-detected terminal height", height);
}
}
@@ -215,8 +208,7 @@ int main(int argc, char **argv)
pv_state_set_format(state, opts->progress, opts->timer, opts->eta,
opts->fineta, opts->rate, opts->average_rate,
opts->bytes, opts->bufpercent,
opts->lastwritten, opts->name);
opts->bytes, opts->bufpercent, opts->lastwritten, opts->name);
#ifdef MAKE_STDOUT_NONBLOCKING
/*
@@ -225,8 +217,7 @@ int main(int argc, char **argv)
* Note that this can cause problems with (broken) applications
* such as dd.
*/
fcntl(STDOUT_FILENO, F_SETFL,
O_NONBLOCK | fcntl(STDOUT_FILENO, F_GETFL));
fcntl(STDOUT_FILENO, F_SETFL, O_NONBLOCK | fcntl(STDOUT_FILENO, F_GETFL));
#endif /* MAKE_STDOUT_NONBLOCKING */
/*
@@ -249,8 +240,7 @@ int main(int argc, char **argv)
t_saved = true;
} else {
fprintf(stderr, "%s: %s: %s\n", opts->program_name,
_("failed to read terminal attributes"),
strerror(errno));
_("failed to read terminal attributes"), strerror(errno));
}
}
t_save = t;
@@ -266,15 +256,12 @@ int main(int argc, char **argv)
pv_sig_init(state);
retcode = pv_watchfd_loop(state);
if (t_needs_reset && pv_in_foreground()) {
(void) tcsetattr(STDERR_FILENO, TCSANOW,
&t_save);
(void) tcsetattr(STDERR_FILENO, TCSANOW, &t_save);
}
if (opts->pidfile != NULL) {
if (0 != remove(opts->pidfile)) {
fprintf(stderr, "%s: %s: %s\n",
opts->program_name,
opts->pidfile,
strerror(errno));
opts->program_name, opts->pidfile, strerror(errno));
}
}
pv_sig_fini(state);
@@ -282,15 +269,12 @@ int main(int argc, char **argv)
pv_sig_init(state);
retcode = pv_watchpid_loop(state);
if (t_needs_reset && pv_in_foreground()) {
(void) tcsetattr(STDERR_FILENO, TCSANOW,
&t_save);
(void) tcsetattr(STDERR_FILENO, TCSANOW, &t_save);
}
if (opts->pidfile != NULL) {
if (0 != remove(opts->pidfile)) {
fprintf(stderr, "%s: %s: %s\n",
opts->program_name,
opts->pidfile,
strerror(errno));
opts->program_name, opts->pidfile, strerror(errno));
}
}
pv_sig_fini(state);
@@ -305,9 +289,7 @@ int main(int argc, char **argv)
}
if (opts->pidfile != NULL) {
if (0 != remove(opts->pidfile)) {
fprintf(stderr, "%s: %s: %s\n",
opts->program_name, opts->pidfile,
strerror(errno));
fprintf(stderr, "%s: %s: %s\n", opts->program_name, opts->pidfile, strerror(errno));
}
}
pv_sig_fini(state);
+69 -85
View File
@@ -51,49 +51,55 @@ opts_t opts_parse(int argc, char **argv)
{
#ifdef HAVE_GETOPT_LONG
struct option long_options[] = {
{"help", 0, NULL, (int) 'h'},
{"version", 0, NULL, (int) 'V'},
{"progress", 0, NULL, (int) 'p'},
{"timer", 0, NULL, (int) 't'},
{"eta", 0, NULL, (int) 'e'},
{"fineta", 0, NULL, (int) 'I'},
{"rate", 0, NULL, (int) 'r'},
{"average-rate", 0, NULL, (int) 'a'},
{"bytes", 0, NULL, (int) 'b'},
{"bits", 0, NULL, (int) '8'},
{"buffer-percent", 0, NULL, (int) 'T'},
{"last-written", 1, NULL, (int) 'A'},
{"force", 0, NULL, (int) 'f'},
{"numeric", 0, NULL, (int) 'n'},
{"quiet", 0, NULL, (int) 'q'},
{"cursor", 0, NULL, (int) 'c'},
{"wait", 0, NULL, (int) 'W'},
{"delay-start", 1, NULL, (int) 'D'},
{"size", 1, NULL, (int) 's'},
{"line-mode", 0, NULL, (int) 'l'},
{"null", 0, NULL, (int) '0'},
{"interval", 1, NULL, (int) 'i'},
{"width", 1, NULL, (int) 'w'},
{"height", 1, NULL, (int) 'H'},
{"name", 1, NULL, (int) 'N'},
{"format", 1, NULL, (int) 'F'},
{"rate-limit", 1, NULL, (int) 'L'},
{"buffer-size", 1, NULL, (int) 'B'},
{"no-splice", 0, NULL, (int) 'C'},
{"skip-errors", 0, NULL, (int) 'E'},
{"stop-at-size", 0, NULL, (int) 'S'},
{"sync", 0, NULL, (int) 'Y'},
{"direct-io", 0, NULL, (int) 'K'},
{"remote", 1, NULL, (int) 'R'},
{"pidfile", 1, NULL, (int) 'P'},
{"watchfd", 1, NULL, (int) 'd'},
{"average-rate-window", 1, NULL, (int) 'm'},
{NULL, 0, NULL, 0}
{ "help", 0, NULL, (int) 'h' },
{ "version", 0, NULL, (int) 'V' },
{ "progress", 0, NULL, (int) 'p' },
{ "timer", 0, NULL, (int) 't' },
{ "eta", 0, NULL, (int) 'e' },
{ "fineta", 0, NULL, (int) 'I' },
{ "rate", 0, NULL, (int) 'r' },
{ "average-rate", 0, NULL, (int) 'a' },
{ "bytes", 0, NULL, (int) 'b' },
{ "bits", 0, NULL, (int) '8' },
{ "buffer-percent", 0, NULL, (int) 'T' },
{ "last-written", 1, NULL, (int) 'A' },
{ "force", 0, NULL, (int) 'f' },
{ "numeric", 0, NULL, (int) 'n' },
{ "quiet", 0, NULL, (int) 'q' },
{ "cursor", 0, NULL, (int) 'c' },
{ "wait", 0, NULL, (int) 'W' },
{ "delay-start", 1, NULL, (int) 'D' },
{ "size", 1, NULL, (int) 's' },
{ "line-mode", 0, NULL, (int) 'l' },
{ "null", 0, NULL, (int) '0' },
{ "interval", 1, NULL, (int) 'i' },
{ "width", 1, NULL, (int) 'w' },
{ "height", 1, NULL, (int) 'H' },
{ "name", 1, NULL, (int) 'N' },
{ "format", 1, NULL, (int) 'F' },
{ "rate-limit", 1, NULL, (int) 'L' },
{ "buffer-size", 1, NULL, (int) 'B' },
{ "no-splice", 0, NULL, (int) 'C' },
{ "skip-errors", 0, NULL, (int) 'E' },
{ "stop-at-size", 0, NULL, (int) 'S' },
{ "sync", 0, NULL, (int) 'Y' },
{ "direct-io", 0, NULL, (int) 'K' },
{ "remote", 1, NULL, (int) 'R' },
{ "pidfile", 1, NULL, (int) 'P' },
{ "watchfd", 1, NULL, (int) 'd' },
{ "average-rate-window", 1, NULL, (int) 'm' },
#ifdef ENABLE_DEBUGGING
{ "debug", 1, NULL, (int) '!' },
#endif /* ENABLE_DEBUGGING */
{ NULL, 0, NULL, 0 }
};
int option_index = 0;
#endif /* HAVE_GETOPT_LONG */
char *short_options = "hVpteIrab8TA:fnqcWD:s:l0i:w:H:N:F:L:B:CESYKR:P:d:m:"
#ifdef ENABLE_DEBUGGING
"!:"
#endif
char *short_options =
"hVpteIrab8TA:fnqcWD:s:l0i:w:H:N:F:L:B:CESYKR:P:d:m:";
;
int c, numopts;
unsigned int check_pid;
int check_fd;
@@ -102,9 +108,7 @@ opts_t opts_parse(int argc, char **argv)
opts = calloc(1, sizeof(*opts));
if (!opts) {
fprintf(stderr, "%s: %s: %s\n", argv[0],
_("option structure allocation failed"),
strerror(errno));
fprintf(stderr, "%s: %s: %s\n", argv[0], _("option structure allocation failed"), strerror(errno));
return NULL;
}
@@ -117,8 +121,7 @@ opts_t opts_parse(int argc, char **argv)
opts->argv = calloc((size_t) (argc + 1), sizeof(char *));
if (NULL == opts->argv) {
fprintf(stderr, "%s: %s: %s\n", opts->program_name,
_("option structure argv allocation failed"),
strerror(errno));
_("option structure argv allocation failed"), strerror(errno));
opts_free(opts);
return NULL;
}
@@ -133,9 +136,7 @@ opts_t opts_parse(int argc, char **argv)
do {
#ifdef HAVE_GETOPT_LONG
c = getopt_long(argc, argv,
short_options, long_options,
&option_index);
c = getopt_long(argc, argv, short_options, long_options, &option_index);
#else
c = getopt(argc, argv, short_options);
#endif
@@ -158,22 +159,16 @@ opts_t opts_parse(int argc, char **argv)
case 'B':
case 'R':
case 'm':
if (pv_getnum_check(optarg, PV_NUMTYPE_INTEGER) !=
0) {
fprintf(stderr, "%s: -%c: %s\n",
opts->program_name, c,
_("integer argument expected"));
if (pv_getnum_check(optarg, PV_NUMTYPE_INTEGER) != 0) {
fprintf(stderr, "%s: -%c: %s\n", opts->program_name, c, _("integer argument expected"));
opts_free(opts);
return NULL;
}
break;
case 'i':
case 'D':
if (pv_getnum_check(optarg, PV_NUMTYPE_DOUBLE) !=
0) {
fprintf(stderr, "%s: -%c: %s\n",
opts->program_name, c,
_("numeric argument expected"));
if (pv_getnum_check(optarg, PV_NUMTYPE_DOUBLE) != 0) {
fprintf(stderr, "%s: -%c: %s\n", opts->program_name, c, _("numeric argument expected"));
opts_free(opts);
return NULL;
}
@@ -182,16 +177,12 @@ opts_t opts_parse(int argc, char **argv)
if (sscanf(optarg, "%u:%d", &check_pid, &check_fd)
< 1) {
fprintf(stderr, "%s: -%c: %s\n",
opts->program_name, c,
_
("process ID or pid:fd pair expected"));
opts->program_name, c, _("process ID or pid:fd pair expected"));
opts_free(opts);
return NULL;
}
if (check_pid < 1) {
fprintf(stderr, "%s: -%c: %s\n",
opts->program_name, c,
_("invalid process ID"));
fprintf(stderr, "%s: -%c: %s\n", opts->program_name, c, _("invalid process ID"));
opts_free(opts);
return NULL;
}
@@ -290,9 +281,7 @@ opts_t opts_parse(int argc, char **argv)
} else {
fprintf(stderr, "%s: %s %s: %s\n",
opts->program_name,
_("failed to stat file"),
size_file,
strerror(errno));
_("failed to stat file"), size_file, strerror(errno));
opts_free(opts);
return NULL;
}
@@ -354,21 +343,21 @@ opts_t opts_parse(int argc, char **argv)
opts->watch_pid = 0;
opts->watch_fd = -1;
/* No syntax check here, already done earlier */
(void) sscanf(optarg, "%u:%d", &(opts->watch_pid),
&(opts->watch_fd));
(void) sscanf(optarg, "%u:%d", &(opts->watch_pid), &(opts->watch_fd));
break;
case 'm':
opts->average_rate_window = pv_getnum_ui(optarg);
break;
#ifdef ENABLE_DEBUGGING
case '!':
debugging_output_destination(optarg);
break;
#endif /* ENABLE_DEBUGGING */
default:
#ifdef HAVE_GETOPT_LONG
fprintf(stderr,
_("Try `%s --help' for more information."),
opts->program_name);
fprintf(stderr, _("Try `%s --help' for more information."), opts->program_name);
#else
fprintf(stderr,
_("Try `%s -h' for more information."),
opts->program_name);
fprintf(stderr, _("Try `%s -h' for more information."), opts->program_name);
#endif
fprintf(stderr, "\n");
opts_free(opts);
@@ -382,40 +371,35 @@ opts_t opts_parse(int argc, char **argv)
|| (opts->skip_errors > 0) || (opts->buffer_size > 0)
|| (opts->rate_limit > 0)) {
fprintf(stderr, "%s: %s\n", opts->program_name,
_
("cannot use line mode or transfer modifier options when watching file descriptors"));
_("cannot use line mode or transfer modifier options when watching file descriptors"));
opts_free(opts);
return NULL;
}
if (opts->cursor) {
fprintf(stderr, "%s: %s\n", opts->program_name,
_
("cannot use cursor positioning when watching file descriptors"));
_("cannot use cursor positioning when watching file descriptors"));
opts_free(opts);
return NULL;
}
if (0 != opts->remote) {
fprintf(stderr, "%s: %s\n", opts->program_name,
_
("cannot use remote control when watching file descriptors"));
_("cannot use remote control when watching file descriptors"));
opts_free(opts);
return NULL;
}
if (optind < argc) {
fprintf(stderr, "%s: %s\n", opts->program_name,
_
("cannot transfer files when watching file descriptors"));
_("cannot transfer files when watching file descriptors"));
opts_free(opts);
return NULL;
}
#ifndef __APPLE__
if (0 != access("/proc/self/fdinfo", X_OK)) {
fprintf(stderr, "%s: -d: %s\n", opts->program_name,
_
("not available on systems without /proc/self/fdinfo"));
_("not available on systems without /proc/self/fdinfo"));
opts_free(opts);
return NULL;
}
+9 -21
View File
@@ -103,8 +103,7 @@ int pv_remote_set(opts_t opts)
* Check that the remote process exists.
*/
if (kill((pid_t) (opts->remote), 0) != 0) {
fprintf(stderr, "%s: %u: %s\n", opts->program_name,
opts->remote, strerror(errno));
fprintf(stderr, "%s: %u: %s\n", opts->program_name, opts->remote, strerror(errno));
return 1;
}
@@ -148,29 +147,25 @@ int pv_remote_set(opts_t opts)
strncpy(msgbuf.name, opts->name, sizeof(msgbuf.name) - 1);
}
if (opts->format != NULL) {
strncpy(msgbuf.format, opts->format,
sizeof(msgbuf.format) - 1);
strncpy(msgbuf.format, opts->format, sizeof(msgbuf.format) - 1);
}
msgid = remote__msgget();
if (msgid < 0) {
fprintf(stderr, "%s: %s\n", opts->program_name,
strerror(errno));
fprintf(stderr, "%s: %s\n", opts->program_name, strerror(errno));
return 1;
}
memset(&qbuf, 0, sizeof(qbuf));
if (msgctl(msgid, IPC_STAT, &qbuf) < 0) {
fprintf(stderr, "%s: %s\n", opts->program_name,
strerror(errno));
fprintf(stderr, "%s: %s\n", opts->program_name, strerror(errno));
return 1;
}
initial_qnum = qbuf.msg_qnum;
if (msgsnd(msgid, &msgbuf, sizeof(msgbuf) - sizeof(long), 0) != 0) {
fprintf(stderr, "%s: %s\n", opts->program_name,
strerror(errno));
fprintf(stderr, "%s: %s\n", opts->program_name, strerror(errno));
return 1;
}
@@ -206,9 +201,7 @@ int pv_remote_set(opts_t opts)
*/
memset(&qbuf, 0, sizeof(qbuf));
if (msgctl(msgid, IPC_STAT, &qbuf) >= 0) {
(void) msgrcv(msgid, &msgbuf,
sizeof(msgbuf) - sizeof(long),
(long) (opts->remote), IPC_NOWAIT);
(void) msgrcv(msgid, &msgbuf, sizeof(msgbuf) - sizeof(long), (long) (opts->remote), IPC_NOWAIT);
/*
* If this leaves nothing on the queue, remove the
* queue, in case we created one for no reason.
@@ -219,8 +212,7 @@ int pv_remote_set(opts_t opts)
}
}
fprintf(stderr, "%s: %u: %s\n", opts->program_name, opts->remote,
_("message not received"));
fprintf(stderr, "%s: %u: %s\n", opts->program_name, opts->remote, _("message not received"));
return 1;
}
@@ -242,9 +234,7 @@ void pv_remote_check(pvstate_t state)
memset(&msgbuf, 0, sizeof(msgbuf));
got =
msgrcv(remote__msgid, &msgbuf, sizeof(msgbuf) - sizeof(long),
getpid(), IPC_NOWAIT);
got = msgrcv(remote__msgid, &msgbuf, sizeof(msgbuf) - sizeof(long), getpid(), IPC_NOWAIT);
if (got < 0) {
/*
* If our queue had been deleted, re-create it.
@@ -265,9 +255,7 @@ void pv_remote_check(pvstate_t state)
msgbuf.eta, msgbuf.fineta, msgbuf.rate,
msgbuf.average_rate,
msgbuf.bytes, msgbuf.bufpercent,
msgbuf.lastwritten,
'\0' ==
msgbuf.name[0] ? NULL : strdup(msgbuf.name));
msgbuf.lastwritten, '\0' == msgbuf.name[0] ? NULL : strdup(msgbuf.name));
if (msgbuf.rate_limit > 0)
pv_state_rate_limit_set(state, msgbuf.rate_limit);
+9 -8
View File
@@ -14,19 +14,20 @@
*/
void display_version(void)
{
/*@-mustfreefresh@ */
/*
* splint note: the gettext calls made by _() cause memory leak
* warnings, but in this case it's unavoidable, and mitigated by the
* fact we only translate each string once.
*/
/* GNU standard first line format: program and version only */
printf("%s %s\n", PROGRAM_NAME, VERSION);
/* GNU standard second line format - "Copyright" always in English */
printf("Copyright %s %s\n", COPYRIGHT_YEAR, COPYRIGHT_HOLDER);
/* GNU standard license line and free software notice */
printf("%s\n",
_
("License: Artistic v2.0 <https://opensource.org/license/artistic-2-0/>"));
printf("%s\n",
_
("This is free software: you are free to change and redistribute it."));
printf("%s\n",
_("There is NO WARRANTY, to the extent permitted by law."));
printf("%s\n", _("License: Artistic v2.0 <https://opensource.org/license/artistic-2-0/>"));
printf("%s\n", _("This is free software: you are free to change and redistribute it."));
printf("%s\n", _("There is NO WARRANTY, to the extent permitted by law."));
/* Project web site link */
printf("\n%s: <%s>\n", _("Project web site"), PROJECT_HOMEPAGE);
}
+210 -172
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-17 21:52+0100\n"
"POT-Creation-Date: 2023-07-30 19:07+0100\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Date: 1999-06-01 15:18:29+0100\n"
"From: Andrew Wood <ivarch@ubik>\n"
@@ -19,19 +19,19 @@ msgstr ""
"nls/intl/textdomain.c src/nls/intl-cat/cat-compat.c src/nls/intl-gett/intl-"
"compat.c\n"
#: src/pv/cursor.c:80
#: src/pv/cursor.c:85
msgid "failed to get terminal name"
msgstr "Terminalname konnte nicht gelesen werden"
#: src/pv/cursor.c:125
#: src/pv/cursor.c:117
msgid "failed to open lock file"
msgstr "Sperrdatei konnte nicht geöffnet werden"
#: src/pv/cursor.c:159
#: src/pv/cursor.c:150
msgid "lock attempt failed"
msgstr "Sperrversuch fehlgeschlagen"
#: src/pv/cursor.c:409
#: src/pv/cursor.c:391
msgid "failed to open terminal"
msgstr "Terminal konnte nicht geöffnet werden"
@@ -39,384 +39,391 @@ msgstr "Terminal konnte nicht geöffnet werden"
msgid "failed to seek to start of output"
msgstr "Konnte nicht versuchen, die Ausgabe zu starten"
#: src/pv/file.c:215
#: src/pv/file.c:210
msgid "failed to close file"
msgstr "Datei konnte nicht geschlossen werden"
#: src/pv/file.c:238
#: src/pv/file.c:232
msgid "failed to read file"
msgstr "Datei konnte nicht gelesen werden"
#: src/pv/file.c:248 src/main/options.c:288
#: src/pv/file.c:239 src/main/options.c:284
msgid "failed to stat file"
msgstr "Dateiinformationen konnten nicht gelesen werden"
#: src/pv/file.c:257
#: src/pv/file.c:246
msgid "failed to stat output file"
msgstr "Dateiinformationen für Ausgabe-Datei konnten nicht gelesen werden"
#: src/pv/file.c:280
#: src/pv/file.c:268
msgid "input file is output file"
msgstr "Eingabe-Datei ist Ausgabe-Datei"
#: src/pv/loop.c:527 src/pv/loop.c:597 src/pv/loop.c:649 src/pv/watchpid.c:68
#: src/pv/watchpid.c:79 src/pv/watchpid.c:93 src/pv/watchpid.c:104
#: src/pv/watchpid.c:145 src/pv/watchpid.c:168 src/pv/watchpid.c:178
#: src/pv/watchpid.c:192 src/pv/watchpid.c:285 src/pv/watchpid.c:294
#: src/pv/watchpid.c:332 src/pv/watchpid.c:349
msgid "pid"
msgstr ""
#: src/pv/transfer.c:341
#: src/pv/transfer.c:359
msgid "read failed"
msgstr "read-Aufruf fehlgeschlagen"
#: src/pv/transfer.c:359
#: src/pv/transfer.c:374
msgid "warning: read errors detected"
msgstr "warnung: lesefehler erkannt"
#: src/pv/transfer.c:374
#: src/pv/transfer.c:386
msgid "file is not seekable"
msgstr "datei ist nicht durchsuchbar"
#: src/pv/transfer.c:437
#: src/pv/transfer.c:445
msgid "failed to seek past error"
msgstr "konnte den Fehler nicht überwinden"
#: src/pv/transfer.c:456
#: src/pv/transfer.c:461
msgid "skipped past read error"
msgstr "über den Lesefehler hinaus verschoben"
#: src/pv/transfer.c:458 src/pv/display.c:687
#: src/pv/transfer.c:461 src/pv/display.c:660
msgid "B"
msgstr "B"
#: src/pv/transfer.c:631
#: src/pv/transfer.c:617
msgid "write failed"
msgstr "write-Aufruf fehlgeschlagen"
#: src/pv/transfer.c:679 src/pv/display.c:618
#: src/pv/transfer.c:736 src/pv/display.c:594
msgid "buffer allocation failed"
msgstr "Puffer konnte nicht allokiert werden"
#: src/pv/transfer.c:770
#.
#. * Any other error is a problem and we must report back.
#.
#: src/pv/transfer.c:833
msgid "select call failed"
msgstr "select-Aufruf fehlgeschlagen"
#: src/pv/state.c:25
msgid "history structure allocation failed"
#: src/pv/watchpid.c:73 src/pv/watchpid.c:83 src/pv/watchpid.c:94
#: src/pv/watchpid.c:102 src/pv/watchpid.c:139 src/pv/watchpid.c:150
#: src/pv/watchpid.c:158 src/pv/watchpid.c:169 src/pv/watchpid.c:253
#: src/pv/watchpid.c:261 src/pv/watchpid.c:292 src/pv/watchpid.c:312
#: src/pv/loop.c:506 src/pv/loop.c:558 src/pv/loop.c:602
msgid "pid"
msgstr ""
#: src/pv/state.c:55
msgid "none"
msgstr ""
#: src/pv/display.c:151
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:156
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:683
msgid "b"
msgstr ""
#: src/pv/display.c:738 src/pv/display.c:752
msgid "b/s"
msgstr ""
#: src/pv/display.c:742 src/pv/display.c:757
msgid "/s"
msgstr ""
#: src/pv/display.c:742 src/pv/display.c:758
msgid "B/s"
msgstr ""
#: src/pv/display.c:793 src/pv/display.c:798 src/pv/display.c:860
msgid "ETA"
msgstr "ETA"
#: src/pv/watchpid.c:81 src/pv/watchpid.c:95 src/pv/watchpid.c:106
#: src/pv/watchpid.c:170 src/pv/watchpid.c:180 src/pv/watchpid.c:194
#: src/pv/watchpid.c:83 src/pv/watchpid.c:95 src/pv/watchpid.c:104
#: src/pv/watchpid.c:150 src/pv/watchpid.c:159 src/pv/watchpid.c:171
msgid "fd"
msgstr ""
#: src/pv/watchpid.c:109 src/pv/watchpid.c:197
#: src/pv/watchpid.c:104 src/pv/watchpid.c:171
msgid "not a regular file or block device"
msgstr "keine normale Datei oder Blockgerät"
#: src/main/version.c:17
#, c-format
msgid "%s %s - Copyright %s %s"
msgstr "%s %s - Copyright(C) %s %s"
#: src/main/version.c:20
#, c-format
msgid "Web site: %s"
msgstr "Web-Site: %s"
#: src/main/version.c:23
msgid ""
"This program is free software, and is being distributed under the\n"
"terms of the Artistic License 2.0."
#: src/pv/state.c:30
msgid "history structure allocation failed"
msgstr ""
"Dieses Programm ist freie Software und wird unter den Bedingungen\n"
"der Artistic License verbreitet."
#: src/pv/state.c:59
msgid "none"
msgstr ""
#: src/pv/display.c:159
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:164
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:656
msgid "b"
msgstr ""
#: src/pv/display.c:711 src/pv/display.c:722
msgid "b/s"
msgstr ""
#: src/pv/display.c:714 src/pv/display.c:726
msgid "/s"
msgstr ""
#: src/pv/display.c:714 src/pv/display.c:726
msgid "B/s"
msgstr ""
#: src/pv/display.c:762 src/pv/display.c:766 src/pv/display.c:825
msgid "ETA"
msgstr "ETA"
#. GNU standard license line and free software notice
#: src/main/version.c:28
msgid ""
"This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
msgid "License: Artistic v2.0 <https://opensource.org/license/artistic-2-0/>"
msgstr ""
"Dieses Programm wird in der Hoffnung verbreitet, dass es nützlich sein "
"wird,\n"
"aber OHNE JEGLICHE GARANTIE; ohne die implizite Garantie von\n"
"MARKTGÄNGIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK."
#: src/main/help.c:31
#: src/main/version.c:29
msgid "This is free software: you are free to change and redistribute it."
msgstr ""
#: src/main/version.c:30
msgid "There is NO WARRANTY, to the extent permitted by law."
msgstr ""
#. Project web site link
#: src/main/version.c:32
msgid "Project web site"
msgstr ""
#: src/main/remote.c:215
msgid "message not received"
msgstr "Nachricht nicht empfangen"
#: src/main/remote.c:318
msgid "IPC not supported on this system"
msgstr "IPC wird auf diesem System nicht unterstützt"
#: src/main/help.c:283
msgid "show progress bar"
msgstr "Fortschritts-Anzeige"
#: src/main/help.c:33
#: src/main/help.c:286
msgid "show elapsed time"
msgstr "zeige die verstrichene Zeit an"
#: src/main/help.c:35
#: src/main/help.c:289
msgid "show estimated time of arrival (completion)"
msgstr "zeige die erwartete Zeit bis zum Ende an"
#: src/main/help.c:38
#: src/main/help.c:292
msgid "show absolute estimated time of arrival (completion)"
msgstr "zeige die absolute geschätzte Zeit bis zur Fertigstellung"
#: src/main/help.c:40
#: src/main/help.c:295
msgid "show data transfer rate counter"
msgstr "zeige die Datentransferrate an"
#: src/main/help.c:42
#: src/main/help.c:298
msgid "show data transfer average rate counter"
msgstr ""
#: src/main/help.c:43 src/main/help.c:63 src/main/help.c:71
#: src/main/help.c:300 src/main/help.c:328 src/main/help.c:340
msgid "SEC"
msgstr ""
#: src/main/help.c:45
#: src/main/help.c:301
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
#: src/main/help.c:47
#: src/main/help.c:304
msgid "show number of bytes transferred"
msgstr "zeige die Anzahl von Bytes, die transferiert worden sind"
#: src/main/help.c:49
#: src/main/help.c:307
msgid "show number of bits transferred"
msgstr ""
#: src/main/help.c:51
#: src/main/help.c:310
msgid "show percentage of transfer buffer in use"
msgstr "zeige, wie viel Prozent des Übertragungsbuffers in Benutzung sind"
#: src/main/help.c:52
#: src/main/help.c:312
msgid "NUM"
msgstr ""
#: src/main/help.c:53
#: src/main/help.c:313
msgid "show NUM bytes last written"
msgstr "NUM zeige die zuletzt geschriebenen NUM Bytes"
#: src/main/help.c:54
#: src/main/help.c:315
msgid "FORMAT"
msgstr ""
#: src/main/help.c:55
#: src/main/help.c:316
msgid "set output format to FORMAT"
msgstr "setze das Ausgabeformat auf FORMAT"
#: src/main/help.c:57
#: src/main/help.c:319
msgid "output percentages, not visual information"
msgstr "Ausgabe von Prozent-Angaben statt visueller Darstellung"
#: src/main/help.c:59
#: src/main/help.c:322
msgid "do not output any transfer information at all"
msgstr "sämtliche Transferinformationen unterdrücken"
#: src/main/help.c:62
#: src/main/help.c:326
msgid "display nothing until first byte transferred"
msgstr "keine Ausgabe bevor das erste Byte übertragen wurde"
#: src/main/help.c:64
#: src/main/help.c:329
msgid "display nothing until SEC seconds have passed"
msgstr "SEC nichts anzeigen, bis SEC Sekunden vergangen sind"
#: src/main/help.c:65
#: src/main/help.c:331
msgid "SIZE"
msgstr ""
#: src/main/help.c:66
#: src/main/help.c:332
msgid "set estimated data size to SIZE bytes"
msgstr "setze erwartete Datenlänge auf SIZE Byte"
#: src/main/help.c:68
#: src/main/help.c:335
msgid "count lines instead of bytes"
msgstr "zähle Zeilen anstelle von Bytes"
#: src/main/help.c:70
#: src/main/help.c:338
msgid "lines are null-terminated"
msgstr "Zeilen sind nullterminiert"
#: src/main/help.c:72
#: src/main/help.c:341
msgid "update every SEC seconds"
msgstr "aktualisiere Ausgabe nach SEC Sekunden Intervall"
#: src/main/help.c:73
#: src/main/help.c:343
msgid "WIDTH"
msgstr ""
#: src/main/help.c:74
#: src/main/help.c:344
msgid "assume terminal is WIDTH characters wide"
msgstr "setze Terminal-Breite auf WIDTH Zeichen"
#: src/main/help.c:75
#: src/main/help.c:346
msgid "HEIGHT"
msgstr ""
#: src/main/help.c:76
#: src/main/help.c:347
msgid "assume terminal is HEIGHT rows high"
msgstr "setze Terminal-Höhe auf HEIGHT Zeichen"
#: src/main/help.c:77
#: src/main/help.c:349
msgid "NAME"
msgstr ""
#: src/main/help.c:78
#: src/main/help.c:350
msgid "prefix visual information with NAME"
msgstr "setze den NAMEn für visuelle Darstellung"
#: src/main/help.c:80
#: src/main/help.c:353
msgid "output even if standard error is not a terminal"
msgstr ""
"Ausgabe auch dann erzwingen, wenn der Fehlerausgabe-Kanal kein Terminal ist"
#: src/main/help.c:82
#: src/main/help.c:356
msgid "use cursor positioning escape sequences"
msgstr "benutze Escape-Sequenzen zur Cursor-Positionierung"
#: src/main/help.c:84
#: src/main/help.c:359
msgid "RATE"
msgstr ""
#: src/main/help.c:85
#: src/main/help.c:360
msgid "limit transfer to RATE bytes per second"
msgstr "beschränke die Transferrate auf RATE Byte pro Sekunde"
#: src/main/help.c:86
#: src/main/help.c:362
msgid "BYTES"
msgstr ""
#: src/main/help.c:87
#: src/main/help.c:363
msgid "use a buffer size of BYTES"
msgstr "BYTES benutze einen Puffer in der Größe von BYTES"
#: src/main/help.c:89
#: src/main/help.c:366
msgid "never use splice(), always use read/write"
msgstr "anstelle von splice() immer read/write benutzen"
#: src/main/help.c:91
#: src/main/help.c:369
msgid "skip read errors in input"
msgstr "Lesefehler in der Eingabe nicht beachten"
#: src/main/help.c:93
#: src/main/help.c:372
msgid "stop after --size bytes have been transferred"
msgstr "anhalten, nachdem --size Bytes übertragen wurden"
#: src/main/help.c:95
#: src/main/help.c:375
msgid "flush cache to disk after every write"
msgstr ""
#: src/main/help.c:378
msgid "use direct I/O to bypass cache"
msgstr ""
#: src/main/help.c:381
msgid "PID"
msgstr ""
#: src/main/help.c:96
#: src/main/help.c:382
msgid "update settings of process PID"
msgstr "Einstellungen der Prozess-PID updaten"
#: src/main/help.c:99
#: src/main/help.c:386 src/main/help.c:401
msgid "FILE"
msgstr ""
#: src/main/help.c:100
#: src/main/help.c:387
msgid "save process ID in FILE"
msgstr "Prozess-ID in FILE speichern"
#: src/main/help.c:102
#: src/main/help.c:390
msgid "PID[:FD]"
msgstr ""
#: src/main/help.c:103
#: src/main/help.c:391
msgid "watch file FD opened by process PID"
msgstr "die vom Prozess PID geöffnete Datei FD beobachten"
#: src/main/help.c:106
#: src/main/help.c:395
msgid "show this help and exit"
msgstr "zeige diese Hilfe und beende"
#: src/main/help.c:108
#: src/main/help.c:398
msgid "show version information and exit"
msgstr "zeige Versionsinformationen und beende"
#: src/main/help.c:114
#: src/main/help.c:402
msgid "write debug logs to FILE"
msgstr ""
#. @-formatconst@
#.
#. * splint note: unavoidable use of %s in translated string. Should
#. * be hard to exploit - the message catalogue would have to be
#. * replaced or forced to load from another location.
#.
#: src/main/help.c:427
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Syntax: %s [OPTION] [DATEI]..."
#: src/main/help.c:117
#. @-mustfreefresh@
#.
#. * splint note: the gettext calls made by _() cause memory leak
#. * warnings, but in this case it's unavoidable, and mitigated by the
#. * fact we only translate each string once.
#.
#: src/main/help.c:438
msgid ""
"Concatenate FILE(s), or standard input, to standard output,\n"
"with monitoring."
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Verbindet DATEI(en) oder den Standard-Eingabe-Kanal mit dem\n"
"Standard-Ausgabe-Kanal und misst den Datenstrom."
"Verbindet DATEI(en) oder den Standard-Eingabe-Kanal mit dem Standard-Ausgabe-"
"Kanal und misst den Datenstrom."
#: src/main/help.c:212
msgid ""
"Debugging is enabled; export the DEBUG environment variable to define the\n"
"output filename.\n"
msgstr ""
"Das Debuggen ist aktiviert. Exportieren Sie die Umgebungsvariable DEBUG,\n"
"um den Ausgabedateinamen zu definieren.\n"
#: src/main/help.c:216
#: src/main/help.c:575
#, c-format
msgid "Please report any bugs to %s."
msgstr "Bitte senden Sie Fehlerberichte an %s."
#: src/main/main.c:74
#: src/main/main.c:75
msgid "state allocation failed"
msgstr "Zustandszuweisung fehlgeschlagen"
#: src/main/main.c:248
#: src/main/main.c:243
msgid "failed to read terminal attributes"
msgstr ""
#: src/main/remote.c:221
msgid "message not received"
msgstr "Nachricht nicht empfangen"
#: src/main/remote.c:328
msgid "IPC not supported on this system"
msgstr "IPC wird auf diesem System nicht unterstützt"
#: src/main/options.c:102
#: src/main/options.c:111
msgid "option structure allocation failed"
msgstr "`option' konnte nicht allokiert werden"
#: src/main/options.c:116
#: src/main/options.c:124
msgid "option structure argv allocation failed"
msgstr "`option' (argv) konnte nicht allokiert werden"
#: src/main/options.c:160
#: src/main/options.c:163
msgid "integer argument expected"
msgstr "Ganzzahliges Argument erwartet"
@@ -424,25 +431,25 @@ msgstr "Ganzzahliges Argument erwartet"
msgid "numeric argument expected"
msgstr "numerisches Argument erwartet"
#: src/main/options.c:182
#: src/main/options.c:180
msgid "process ID or pid:fd pair expected"
msgstr "Prozess-ID oder PID:FD-Paar erwartet"
#: src/main/options.c:189
#: src/main/options.c:185
msgid "invalid process ID"
msgstr "ungültige Prozess-ID"
#: src/main/options.c:355
#: src/main/options.c:358
#, c-format
msgid "Try `%s --help' for more information."
msgstr "`%s --help' zeigt weitere Informationen an."
#: src/main/options.c:359
#: src/main/options.c:360
#, c-format
msgid "Try `%s -h' for more information."
msgstr "`%s -h' zeigt weitere Informationen an."
#: src/main/options.c:375
#: src/main/options.c:374
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
@@ -450,22 +457,53 @@ msgstr ""
"Beim Anzeigen von Dateideskriptoren können keine Optionen für den "
"Zeilenmodus oder den Übertragungsmodifikator verwendet werden"
#: src/main/options.c:383
#: src/main/options.c:381
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
"Beim Anzeigen von Dateideskriptoren können keine Zeilenmodus- oder "
"Übertragungsmodifikatoroptionen verwendet werden."
#: src/main/options.c:391
#: src/main/options.c:388
msgid "cannot use remote control when watching file descriptors"
msgstr ""
"kann keine Fernbedienung verwenden, wenn Dateideskriptoren angezeigt werden"
#: src/main/options.c:399
#: src/main/options.c:395
msgid "cannot transfer files when watching file descriptors"
msgstr ""
"Dateien können beim Betrachten von Dateideskriptoren nicht übertragen werden"
#: src/main/options.c:407
#: src/main/options.c:402
msgid "not available on systems without /proc/self/fdinfo"
msgstr "Nicht verfügbar auf Systemen ohne /proc/self/fdinfo"
#~ msgid ""
#~ "Debugging is enabled; export the DEBUG environment variable to define "
#~ "the\n"
#~ "output filename.\n"
#~ msgstr ""
#~ "Das Debuggen ist aktiviert. Exportieren Sie die Umgebungsvariable DEBUG,\n"
#~ "um den Ausgabedateinamen zu definieren.\n"
#~ msgid "%s %s - Copyright %s %s"
#~ msgstr "%s %s - Copyright(C) %s %s"
#~ msgid "Web site: %s"
#~ msgstr "Web-Site: %s"
#~ msgid ""
#~ "This program is free software, and is being distributed under the\n"
#~ "terms of the Artistic License 2.0."
#~ msgstr ""
#~ "Dieses Programm ist freie Software und wird unter den Bedingungen\n"
#~ "der Artistic License verbreitet."
#~ msgid ""
#~ "This program is distributed in the hope that it will be useful,\n"
#~ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
#~ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
#~ msgstr ""
#~ "Dieses Programm wird in der Hoffnung verbreitet, dass es nützlich sein "
#~ "wird,\n"
#~ "aber OHNE JEGLICHE GARANTIE; ohne die implizite Garantie von\n"
#~ "MARKTGÄNGIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK."
+210 -172
View File
@@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-17 21:52+0100\n"
"POT-Creation-Date: 2023-07-30 19:07+0100\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Date: 1999-06-01 15:18:29+0100\n"
"From: Andrew Wood <ivarch@ubik>\n"
@@ -19,19 +19,19 @@ msgstr ""
"nls/intl/textdomain.c src/nls/intl-cat/cat-compat.c src/nls/intl-gett/intl-"
"compat.c\n"
#: src/pv/cursor.c:80
#: src/pv/cursor.c:85
msgid "failed to get terminal name"
msgstr "échec de lecture du nom du terminal"
#: src/pv/cursor.c:125
#: src/pv/cursor.c:117
msgid "failed to open lock file"
msgstr "échec de l'ouverture du fichier de verrouillage"
#: src/pv/cursor.c:159
#: src/pv/cursor.c:150
msgid "lock attempt failed"
msgstr "tentative de verrouillage échoué"
#: src/pv/cursor.c:409
#: src/pv/cursor.c:391
msgid "failed to open terminal"
msgstr "l'ouverture du terminal a échoué"
@@ -39,383 +39,390 @@ msgstr "l'ouverture du terminal a échoué"
msgid "failed to seek to start of output"
msgstr "ne peut pas passer au début de la sortie"
#: src/pv/file.c:215
#: src/pv/file.c:210
msgid "failed to close file"
msgstr "la fermeture du fichier a échoué"
#: src/pv/file.c:238
#: src/pv/file.c:232
msgid "failed to read file"
msgstr "la lecture du fichier a échoué"
#: src/pv/file.c:248 src/main/options.c:288
#: src/pv/file.c:239 src/main/options.c:284
msgid "failed to stat file"
msgstr "échec à statuer sur le fichier"
#: src/pv/file.c:257
#: src/pv/file.c:246
msgid "failed to stat output file"
msgstr "échec à statuer sur le fichier de sortie"
#: src/pv/file.c:280
#: src/pv/file.c:268
msgid "input file is output file"
msgstr "fichiers d'entré et de sortie sont les mêmes"
#: src/pv/loop.c:527 src/pv/loop.c:597 src/pv/loop.c:649 src/pv/watchpid.c:68
#: src/pv/watchpid.c:79 src/pv/watchpid.c:93 src/pv/watchpid.c:104
#: src/pv/watchpid.c:145 src/pv/watchpid.c:168 src/pv/watchpid.c:178
#: src/pv/watchpid.c:192 src/pv/watchpid.c:285 src/pv/watchpid.c:294
#: src/pv/watchpid.c:332 src/pv/watchpid.c:349
msgid "pid"
msgstr ""
#: src/pv/transfer.c:341
#: src/pv/transfer.c:359
msgid "read failed"
msgstr "la lecture a échoué"
#: src/pv/transfer.c:359
#: src/pv/transfer.c:374
msgid "warning: read errors detected"
msgstr "avertissement: erreurs de lecture détectées"
#: src/pv/transfer.c:374
#: src/pv/transfer.c:386
msgid "file is not seekable"
msgstr "ne peut pas se déplacer dans le fichier"
#: src/pv/transfer.c:437
#: src/pv/transfer.c:445
msgid "failed to seek past error"
msgstr "n'a pas réussi à dépasser l'erreur"
#: src/pv/transfer.c:456
#: src/pv/transfer.c:461
msgid "skipped past read error"
msgstr "erreur de lecture dépassée"
#: src/pv/transfer.c:458 src/pv/display.c:687
#: src/pv/transfer.c:461 src/pv/display.c:660
msgid "B"
msgstr "O"
#: src/pv/transfer.c:631
#: src/pv/transfer.c:617
msgid "write failed"
msgstr "l'écriture a échoué"
#: src/pv/transfer.c:679 src/pv/display.c:618
#: src/pv/transfer.c:736 src/pv/display.c:594
msgid "buffer allocation failed"
msgstr "l'allocation de mémoire tampon a échoué"
#: src/pv/transfer.c:770
#.
#. * Any other error is a problem and we must report back.
#.
#: src/pv/transfer.c:833
msgid "select call failed"
msgstr "appel de sélection a échoué"
#: src/pv/state.c:25
msgid "history structure allocation failed"
#: src/pv/watchpid.c:73 src/pv/watchpid.c:83 src/pv/watchpid.c:94
#: src/pv/watchpid.c:102 src/pv/watchpid.c:139 src/pv/watchpid.c:150
#: src/pv/watchpid.c:158 src/pv/watchpid.c:169 src/pv/watchpid.c:253
#: src/pv/watchpid.c:261 src/pv/watchpid.c:292 src/pv/watchpid.c:312
#: src/pv/loop.c:506 src/pv/loop.c:558 src/pv/loop.c:602
msgid "pid"
msgstr ""
#: src/pv/state.c:55
msgid "none"
msgstr ""
#: src/pv/display.c:151
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:156
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:683
msgid "b"
msgstr ""
#: src/pv/display.c:738 src/pv/display.c:752
msgid "b/s"
msgstr ""
#: src/pv/display.c:742 src/pv/display.c:757
msgid "/s"
msgstr "/s"
#: src/pv/display.c:742 src/pv/display.c:758
msgid "B/s"
msgstr "O/s"
#: src/pv/display.c:793 src/pv/display.c:798 src/pv/display.c:860
msgid "ETA"
msgstr "ETA"
#: src/pv/watchpid.c:81 src/pv/watchpid.c:95 src/pv/watchpid.c:106
#: src/pv/watchpid.c:170 src/pv/watchpid.c:180 src/pv/watchpid.c:194
#: src/pv/watchpid.c:83 src/pv/watchpid.c:95 src/pv/watchpid.c:104
#: src/pv/watchpid.c:150 src/pv/watchpid.c:159 src/pv/watchpid.c:171
msgid "fd"
msgstr ""
#: src/pv/watchpid.c:109 src/pv/watchpid.c:197
#: src/pv/watchpid.c:104 src/pv/watchpid.c:171
msgid "not a regular file or block device"
msgstr "pas un fichier ordinaire ou un périphérique de bloc"
#: src/main/version.c:17
#, c-format
msgid "%s %s - Copyright %s %s"
msgstr "%s %s - Copyright(C) %s %s"
#: src/main/version.c:20
#, c-format
msgid "Web site: %s"
msgstr "Site Web: %s"
#: src/main/version.c:23
msgid ""
"This program is free software, and is being distributed under the\n"
"terms of the Artistic License 2.0."
#: src/pv/state.c:30
msgid "history structure allocation failed"
msgstr ""
"Ce programme est un logiciel libre et est distribué sous les termes\n"
"anglophone de la Licence Artistique 2.0 (Artistic License 2.0)."
#: src/pv/state.c:59
msgid "none"
msgstr ""
#: src/pv/display.c:159
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:164
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:656
msgid "b"
msgstr ""
#: src/pv/display.c:711 src/pv/display.c:722
msgid "b/s"
msgstr ""
#: src/pv/display.c:714 src/pv/display.c:726
msgid "/s"
msgstr "/s"
#: src/pv/display.c:714 src/pv/display.c:726
msgid "B/s"
msgstr "O/s"
#: src/pv/display.c:762 src/pv/display.c:766 src/pv/display.c:825
msgid "ETA"
msgstr "ETA"
#. GNU standard license line and free software notice
#: src/main/version.c:28
msgid ""
"This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
msgid "License: Artistic v2.0 <https://opensource.org/license/artistic-2-0/>"
msgstr ""
"Ce programme est distribué dans l'espoir qu'il sera utile, mais\n"
"SANS GARANTIE AUCUNE; ni même de garantie sous-entendu que le\n"
"programme soit COMMERCIALISABLE ou APPLICABLE À UNE TÂCHE\n"
"PARTICULIÈRE."
#: src/main/help.c:31
#: src/main/version.c:29
msgid "This is free software: you are free to change and redistribute it."
msgstr ""
#: src/main/version.c:30
msgid "There is NO WARRANTY, to the extent permitted by law."
msgstr ""
#. Project web site link
#: src/main/version.c:32
msgid "Project web site"
msgstr ""
#: src/main/remote.c:215
msgid "message not received"
msgstr "message non reçu"
#: src/main/remote.c:318
msgid "IPC not supported on this system"
msgstr "IPC non pris en charge sur ce système"
#: src/main/help.c:283
msgid "show progress bar"
msgstr "affiche la barre de progression"
#: src/main/help.c:33
#: src/main/help.c:286
msgid "show elapsed time"
msgstr "affiche le temps écoulé"
#: src/main/help.c:35
#: src/main/help.c:289
msgid "show estimated time of arrival (completion)"
msgstr "affiche l'heure approximative de l'achèvement de la tâche"
#: src/main/help.c:38
#: src/main/help.c:292
msgid "show absolute estimated time of arrival (completion)"
msgstr "affiche l'heure absolute de l'achèvement de la tâche"
#: src/main/help.c:40
#: src/main/help.c:295
msgid "show data transfer rate counter"
msgstr "affiche le taux de tranfert des données"
#: src/main/help.c:42
#: src/main/help.c:298
msgid "show data transfer average rate counter"
msgstr "afficher le compteur de taux moyen de transfert de données"
#: src/main/help.c:43 src/main/help.c:63 src/main/help.c:71
#: src/main/help.c:300 src/main/help.c:328 src/main/help.c:340
msgid "SEC"
msgstr "SEC"
#: src/main/help.c:45
#: src/main/help.c:301
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
#: src/main/help.c:47
#: src/main/help.c:304
msgid "show number of bytes transferred"
msgstr "affiche le nombre d'octets transférés"
#: src/main/help.c:49
#: src/main/help.c:307
msgid "show number of bits transferred"
msgstr ""
#: src/main/help.c:51
#: src/main/help.c:310
msgid "show percentage of transfer buffer in use"
msgstr "afficher le pourcentage de tampon de transfert utilisé"
#: src/main/help.c:52
#: src/main/help.c:312
msgid "NUM"
msgstr ""
#: src/main/help.c:53
#: src/main/help.c:313
msgid "show NUM bytes last written"
msgstr "affiche NUM octets pour la dernière fois écrits"
#: src/main/help.c:54
#: src/main/help.c:315
msgid "FORMAT"
msgstr ""
#: src/main/help.c:55
#: src/main/help.c:316
msgid "set output format to FORMAT"
msgstr "définir le format de sortie sur FORMAT"
#: src/main/help.c:57
#: src/main/help.c:319
msgid "output percentages, not visual information"
msgstr "imprime en pourcentage, pas les informations visuelles"
#: src/main/help.c:59
#: src/main/help.c:322
msgid "do not output any transfer information at all"
msgstr "n'afficher aucune information de transfert"
#: src/main/help.c:62
#: src/main/help.c:326
msgid "display nothing until first byte transferred"
msgstr "ne rien afficher avant qu'au moins un octet soit tranféré"
#: src/main/help.c:64
#: src/main/help.c:329
msgid "display nothing until SEC seconds have passed"
msgstr "n'afficher rien jusqu'à ce que SEC secondes se soient écoulées"
#: src/main/help.c:65
#: src/main/help.c:331
msgid "SIZE"
msgstr "TAILLE"
#: src/main/help.c:66
#: src/main/help.c:332
msgid "set estimated data size to SIZE bytes"
msgstr "ajuste la taille estimée des données à TAILLE octets"
#: src/main/help.c:68
#: src/main/help.c:335
msgid "count lines instead of bytes"
msgstr "compte les lignes au lieu des octets"
#: src/main/help.c:70
#: src/main/help.c:338
msgid "lines are null-terminated"
msgstr "les lignes sont terminées par un nul"
#: src/main/help.c:72
#: src/main/help.c:341
msgid "update every SEC seconds"
msgstr "mise-à-jour toute les SEC secondes"
#: src/main/help.c:73
#: src/main/help.c:343
msgid "WIDTH"
msgstr "LARGEUR"
#: src/main/help.c:74
#: src/main/help.c:344
msgid "assume terminal is WIDTH characters wide"
msgstr "présumer la largeur du terminal à LARGEUR caractères"
#: src/main/help.c:75
#: src/main/help.c:346
msgid "HEIGHT"
msgstr "HAUTEUR"
#: src/main/help.c:76
#: src/main/help.c:347
msgid "assume terminal is HEIGHT rows high"
msgstr "présumer la hauteur du terminal à HAUTEUR lignes"
#: src/main/help.c:77
#: src/main/help.c:349
msgid "NAME"
msgstr "NOM"
#: src/main/help.c:78
#: src/main/help.c:350
msgid "prefix visual information with NAME"
msgstr "préfixer les informations visuelles avec NOM"
#: src/main/help.c:80
#: src/main/help.c:353
msgid "output even if standard error is not a terminal"
msgstr "imprime vers la sortie d'erreur même si ce n'est pas un terminal"
#: src/main/help.c:82
#: src/main/help.c:356
msgid "use cursor positioning escape sequences"
msgstr "utiliser les séquences d'échappements de positionnement de curseur"
#: src/main/help.c:84
#: src/main/help.c:359
msgid "RATE"
msgstr "TAUX"
#: src/main/help.c:85
#: src/main/help.c:360
msgid "limit transfer to RATE bytes per second"
msgstr "limite le taux de transfer à TAUX octets par seconde"
#: src/main/help.c:86
#: src/main/help.c:362
msgid "BYTES"
msgstr "OCTETS"
#: src/main/help.c:87
#: src/main/help.c:363
msgid "use a buffer size of BYTES"
msgstr "Utiliser une mémoire tampon de OCTETS octets"
#: src/main/help.c:89
#: src/main/help.c:366
msgid "never use splice(), always use read/write"
msgstr "n'utilisez jamais splice(), utilisez toujours read/write"
#: src/main/help.c:91
#: src/main/help.c:369
msgid "skip read errors in input"
msgstr "ignorer les erreurs de lecture dans l'entrée"
#: src/main/help.c:93
#: src/main/help.c:372
msgid "stop after --size bytes have been transferred"
msgstr "arrêter après le transfert de --size octets"
#: src/main/help.c:95
#: src/main/help.c:375
msgid "flush cache to disk after every write"
msgstr ""
#: src/main/help.c:378
msgid "use direct I/O to bypass cache"
msgstr ""
#: src/main/help.c:381
msgid "PID"
msgstr "PID"
#: src/main/help.c:96
#: src/main/help.c:382
msgid "update settings of process PID"
msgstr "mettre-à-jour la configuration du processus PID"
#: src/main/help.c:99
#: src/main/help.c:386 src/main/help.c:401
msgid "FILE"
msgstr ""
#: src/main/help.c:100
#: src/main/help.c:387
msgid "save process ID in FILE"
msgstr "enregistrer l'ID de processus dans FILE"
#: src/main/help.c:102
#: src/main/help.c:390
msgid "PID[:FD]"
msgstr ""
#: src/main/help.c:103
#: src/main/help.c:391
msgid "watch file FD opened by process PID"
msgstr "regarder le fichier FD ouvert par le processus PID"
#: src/main/help.c:106
#: src/main/help.c:395
msgid "show this help and exit"
msgstr "afficher cette aide puis quitter"
#: src/main/help.c:108
#: src/main/help.c:398
msgid "show version information and exit"
msgstr "afficher la version puis quitter"
#: src/main/help.c:114
#: src/main/help.c:402
msgid "write debug logs to FILE"
msgstr ""
#. @-formatconst@
#.
#. * splint note: unavoidable use of %s in translated string. Should
#. * be hard to exploit - the message catalogue would have to be
#. * replaced or forced to load from another location.
#.
#: src/main/help.c:427
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Utilisation : %s [OPTIONS] [FICHIER]..."
#: src/main/help.c:117
#. @-mustfreefresh@
#.
#. * splint note: the gettext calls made by _() cause memory leak
#. * warnings, but in this case it's unavoidable, and mitigated by the
#. * fact we only translate each string once.
#.
#: src/main/help.c:438
msgid ""
"Concatenate FILE(s), or standard input, to standard output,\n"
"with monitoring."
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Concatène FICHIER(s), ou l'entrée standard, sur la sortie standard\n"
"avec monitorage."
"Concatène FICHIER(s), ou l'entrée standard, sur la sortie standard avec "
"monitorage."
#: src/main/help.c:212
msgid ""
"Debugging is enabled; export the DEBUG environment variable to define the\n"
"output filename.\n"
msgstr ""
"Le débogage est activé; exportez la variable d'environnement DEBUG pour\n"
"définir le nom du fichier de sortie.\n"
#: src/main/help.c:216
#: src/main/help.c:575
#, c-format
msgid "Please report any bugs to %s."
msgstr "SVP rapporter touts bogues à %s."
#: src/main/main.c:74
#: src/main/main.c:75
msgid "state allocation failed"
msgstr "échec de l'allocation de mémoire de condition"
#: src/main/main.c:248
#: src/main/main.c:243
msgid "failed to read terminal attributes"
msgstr ""
#: src/main/remote.c:221
msgid "message not received"
msgstr "message non reçu"
#: src/main/remote.c:328
msgid "IPC not supported on this system"
msgstr "IPC non pris en charge sur ce système"
#: src/main/options.c:102
#: src/main/options.c:111
msgid "option structure allocation failed"
msgstr "l'allocation pour la structure d'une option a echoué"
#: src/main/options.c:116
#: src/main/options.c:124
msgid "option structure argv allocation failed"
msgstr "l'allocation pour la structure de l'option argv a echoué"
#: src/main/options.c:160
#: src/main/options.c:163
msgid "integer argument expected"
msgstr "Valeur entière attendue"
@@ -423,25 +430,25 @@ msgstr "Valeur entière attendue"
msgid "numeric argument expected"
msgstr "Valeur numérique attendue"
#: src/main/options.c:182
#: src/main/options.c:180
msgid "process ID or pid:fd pair expected"
msgstr "ID de processus ou paire pid:fd attendue"
#: src/main/options.c:189
#: src/main/options.c:185
msgid "invalid process ID"
msgstr "ID de processus non valide"
#: src/main/options.c:355
#: src/main/options.c:358
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Essayez `%s --help' pour plus d'information."
#: src/main/options.c:359
#: src/main/options.c:360
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Essayez `%s -h' pour plus d'information."
#: src/main/options.c:375
#: src/main/options.c:374
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
@@ -449,24 +456,55 @@ msgstr ""
"impossible d'utiliser le mode ligne ou les options de modificateur de "
"transfert lors de la visualisation des descripteurs de fichiers"
#: src/main/options.c:383
#: src/main/options.c:381
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
"impossible d'utiliser le positionnement du curseur lors de la visualisation "
"des descripteurs de fichier"
#: src/main/options.c:391
#: src/main/options.c:388
msgid "cannot use remote control when watching file descriptors"
msgstr ""
"impossible d'utiliser la télécommande lors de la visualisation des "
"descripteurs de fichiers"
#: src/main/options.c:399
#: src/main/options.c:395
msgid "cannot transfer files when watching file descriptors"
msgstr ""
"impossible de transférer des fichiers lorsque vous regardez des descripteurs "
"de fichiers"
#: src/main/options.c:407
#: src/main/options.c:402
msgid "not available on systems without /proc/self/fdinfo"
msgstr "non disponible sur les systèmes sans /proc/self/fdinfo"
#~ msgid ""
#~ "Debugging is enabled; export the DEBUG environment variable to define "
#~ "the\n"
#~ "output filename.\n"
#~ msgstr ""
#~ "Le débogage est activé; exportez la variable d'environnement DEBUG pour\n"
#~ "définir le nom du fichier de sortie.\n"
#~ msgid "%s %s - Copyright %s %s"
#~ msgstr "%s %s - Copyright(C) %s %s"
#~ msgid "Web site: %s"
#~ msgstr "Site Web: %s"
#~ msgid ""
#~ "This program is free software, and is being distributed under the\n"
#~ "terms of the Artistic License 2.0."
#~ msgstr ""
#~ "Ce programme est un logiciel libre et est distribué sous les termes\n"
#~ "anglophone de la Licence Artistique 2.0 (Artistic License 2.0)."
#~ msgid ""
#~ "This program is distributed in the hope that it will be useful,\n"
#~ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
#~ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
#~ msgstr ""
#~ "Ce programme est distribué dans l'espoir qu'il sera utile, mais\n"
#~ "SANS GARANTIE AUCUNE; ni même de garantie sous-entendu que le\n"
#~ "programme soit COMMERCIALISABLE ou APPLICABLE À UNE TÂCHE\n"
#~ "PARTICULIÈRE."
+181 -162
View File
@@ -6,28 +6,29 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-17 21:52+0100\n"
"POT-Creation-Date: 2023-07-30 19:07+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/pv/cursor.c:80
#: src/pv/cursor.c:85
msgid "failed to get terminal name"
msgstr ""
# "Przewidywany czas ukończenia" for ETA is too long
#: src/pv/cursor.c:125
#: src/pv/cursor.c:117
msgid "failed to open lock file"
msgstr ""
#: src/pv/cursor.c:159
#: src/pv/cursor.c:150
msgid "lock attempt failed"
msgstr ""
#: src/pv/cursor.c:409
#: src/pv/cursor.c:391
msgid "failed to open terminal"
msgstr "nie udało się otworzyć terminala"
@@ -36,375 +37,390 @@ msgid "failed to seek to start of output"
msgstr ""
# "Przewidywany czas ukończenia" for ETA is too long
#: src/pv/file.c:215
#: src/pv/file.c:210
msgid "failed to close file"
msgstr "nie udało się zamknąć pliku"
#: src/pv/file.c:238
#: src/pv/file.c:232
msgid "failed to read file"
msgstr "nie udało się odczytać pliku"
#: src/pv/file.c:248 src/main/options.c:288
#: src/pv/file.c:239 src/main/options.c:284
msgid "failed to stat file"
msgstr "nie udało się wykonać operacji stat na pliku"
#: src/pv/file.c:257
#: src/pv/file.c:246
msgid "failed to stat output file"
msgstr "nie udało się wykonać operacji stat na pliku wyjściowym"
#: src/pv/file.c:280
#: src/pv/file.c:268
msgid "input file is output file"
msgstr "plik wejściowy jest zarazem plikiem wyjściowym"
#: src/pv/loop.c:527 src/pv/loop.c:597 src/pv/loop.c:649 src/pv/watchpid.c:68
#: src/pv/watchpid.c:79 src/pv/watchpid.c:93 src/pv/watchpid.c:104
#: src/pv/watchpid.c:145 src/pv/watchpid.c:168 src/pv/watchpid.c:178
#: src/pv/watchpid.c:192 src/pv/watchpid.c:285 src/pv/watchpid.c:294
#: src/pv/watchpid.c:332 src/pv/watchpid.c:349
msgid "pid"
msgstr ""
#: src/pv/transfer.c:341
#: src/pv/transfer.c:359
msgid "read failed"
msgstr "błąd odczytu"
#: src/pv/transfer.c:359
#: src/pv/transfer.c:374
msgid "warning: read errors detected"
msgstr ""
#: src/pv/transfer.c:374
#: src/pv/transfer.c:386
msgid "file is not seekable"
msgstr ""
#: src/pv/transfer.c:437
#: src/pv/transfer.c:445
msgid "failed to seek past error"
msgstr ""
#: src/pv/transfer.c:456
#: src/pv/transfer.c:461
msgid "skipped past read error"
msgstr ""
#: src/pv/transfer.c:458 src/pv/display.c:687
#: src/pv/transfer.c:461 src/pv/display.c:660
msgid "B"
msgstr "B"
#: src/pv/transfer.c:631
#: src/pv/transfer.c:617
msgid "write failed"
msgstr "błąd zapisu"
#: src/pv/transfer.c:679 src/pv/display.c:618
#: src/pv/transfer.c:736 src/pv/display.c:594
msgid "buffer allocation failed"
msgstr "nie udało się zaalokować bufora"
#: src/pv/transfer.c:770
#.
#. * Any other error is a problem and we must report back.
#.
#: src/pv/transfer.c:833
msgid "select call failed"
msgstr "nie udało się wywołać funkcji select"
#: src/pv/state.c:25
msgid "history structure allocation failed"
#: src/pv/watchpid.c:73 src/pv/watchpid.c:83 src/pv/watchpid.c:94
#: src/pv/watchpid.c:102 src/pv/watchpid.c:139 src/pv/watchpid.c:150
#: src/pv/watchpid.c:158 src/pv/watchpid.c:169 src/pv/watchpid.c:253
#: src/pv/watchpid.c:261 src/pv/watchpid.c:292 src/pv/watchpid.c:312
#: src/pv/loop.c:506 src/pv/loop.c:558 src/pv/loop.c:602
msgid "pid"
msgstr ""
#: src/pv/state.c:55
msgid "none"
msgstr ""
#: src/pv/display.c:151
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:156
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:683
msgid "b"
msgstr ""
#: src/pv/display.c:738 src/pv/display.c:752
msgid "b/s"
msgstr ""
#: src/pv/display.c:742 src/pv/display.c:757
msgid "/s"
msgstr "/s"
#: src/pv/display.c:742 src/pv/display.c:758
msgid "B/s"
msgstr "B/s"
#: src/pv/display.c:793 src/pv/display.c:798 src/pv/display.c:860
msgid "ETA"
msgstr "ETA"
#: src/pv/watchpid.c:81 src/pv/watchpid.c:95 src/pv/watchpid.c:106
#: src/pv/watchpid.c:170 src/pv/watchpid.c:180 src/pv/watchpid.c:194
#: src/pv/watchpid.c:83 src/pv/watchpid.c:95 src/pv/watchpid.c:104
#: src/pv/watchpid.c:150 src/pv/watchpid.c:159 src/pv/watchpid.c:171
msgid "fd"
msgstr ""
#: src/pv/watchpid.c:109 src/pv/watchpid.c:197
#: src/pv/watchpid.c:104 src/pv/watchpid.c:171
msgid "not a regular file or block device"
msgstr ""
#: src/main/version.c:17
#, c-format
msgid "%s %s - Copyright %s %s"
#: src/pv/state.c:30
msgid "history structure allocation failed"
msgstr ""
#: src/main/version.c:20
#, c-format
msgid "Web site: %s"
msgstr "Strona WWW: %s"
#: src/main/version.c:23
msgid ""
"This program is free software, and is being distributed under the\n"
"terms of the Artistic License 2.0."
#: src/pv/state.c:59
msgid "none"
msgstr ""
#: src/pv/display.c:159
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:164
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:656
msgid "b"
msgstr ""
#: src/pv/display.c:711 src/pv/display.c:722
msgid "b/s"
msgstr ""
#: src/pv/display.c:714 src/pv/display.c:726
msgid "/s"
msgstr "/s"
#: src/pv/display.c:714 src/pv/display.c:726
msgid "B/s"
msgstr "B/s"
#: src/pv/display.c:762 src/pv/display.c:766 src/pv/display.c:825
msgid "ETA"
msgstr "ETA"
#. GNU standard license line and free software notice
#: src/main/version.c:28
msgid ""
"This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
msgid "License: Artistic v2.0 <https://opensource.org/license/artistic-2-0/>"
msgstr ""
#: src/main/help.c:31
#: src/main/version.c:29
msgid "This is free software: you are free to change and redistribute it."
msgstr ""
#: src/main/version.c:30
msgid "There is NO WARRANTY, to the extent permitted by law."
msgstr ""
#. Project web site link
#: src/main/version.c:32
msgid "Project web site"
msgstr ""
#: src/main/remote.c:215
msgid "message not received"
msgstr ""
#: src/main/remote.c:318
msgid "IPC not supported on this system"
msgstr ""
#: src/main/help.c:283
msgid "show progress bar"
msgstr "pokaż pasek postępu"
#: src/main/help.c:33
#: src/main/help.c:286
msgid "show elapsed time"
msgstr "pokaż upływający czas"
#: src/main/help.c:35
#: src/main/help.c:289
msgid "show estimated time of arrival (completion)"
msgstr "pokaż szacowany czas ukończenia"
#: src/main/help.c:38
#: src/main/help.c:292
msgid "show absolute estimated time of arrival (completion)"
msgstr ""
#: src/main/help.c:40
#: src/main/help.c:295
msgid "show data transfer rate counter"
msgstr "pokaż licznik prędkości przesyłania"
#: src/main/help.c:42
#: src/main/help.c:298
msgid "show data transfer average rate counter"
msgstr ""
#: src/main/help.c:43 src/main/help.c:63 src/main/help.c:71
#: src/main/help.c:300 src/main/help.c:328 src/main/help.c:340
msgid "SEC"
msgstr "WARTOŚĆ"
#: src/main/help.c:45
#: src/main/help.c:301
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
#: src/main/help.c:47
#: src/main/help.c:304
msgid "show number of bytes transferred"
msgstr "pokaż ilość przesłanych bajtów"
#: src/main/help.c:49
#: src/main/help.c:307
msgid "show number of bits transferred"
msgstr ""
#: src/main/help.c:51
#: src/main/help.c:310
msgid "show percentage of transfer buffer in use"
msgstr ""
#: src/main/help.c:52
#: src/main/help.c:312
msgid "NUM"
msgstr ""
#: src/main/help.c:53
#: src/main/help.c:313
msgid "show NUM bytes last written"
msgstr ""
#: src/main/help.c:54
#: src/main/help.c:315
msgid "FORMAT"
msgstr ""
#: src/main/help.c:55
#: src/main/help.c:316
msgid "set output format to FORMAT"
msgstr ""
#: src/main/help.c:57
#: src/main/help.c:319
msgid "output percentages, not visual information"
msgstr "wświetl wyjście procentowo, bez graficznej prezentacji"
#: src/main/help.c:59
#: src/main/help.c:322
msgid "do not output any transfer information at all"
msgstr "nie wyświetlaj żadnych informacji o przesyłaniu"
#: src/main/help.c:62
#: src/main/help.c:326
msgid "display nothing until first byte transferred"
msgstr "nie wyświetlaj nic aż do pierwszego przesłanego bajtu"
#: src/main/help.c:64
#: src/main/help.c:329
msgid "display nothing until SEC seconds have passed"
msgstr ""
#: src/main/help.c:65
#: src/main/help.c:331
msgid "SIZE"
msgstr "WARTOŚĆ"
#: src/main/help.c:66
#: src/main/help.c:332
msgid "set estimated data size to SIZE bytes"
msgstr "ustaw oczekiwany rozmiar danych na WARTOŚĆ bajtów"
#: src/main/help.c:68
#: src/main/help.c:335
msgid "count lines instead of bytes"
msgstr ""
#: src/main/help.c:70
#: src/main/help.c:338
msgid "lines are null-terminated"
msgstr ""
#: src/main/help.c:72
#: src/main/help.c:341
msgid "update every SEC seconds"
msgstr "aktualizuj co każde WARTOŚĆ sekund"
#: src/main/help.c:73
#: src/main/help.c:343
msgid "WIDTH"
msgstr "WARTOŚĆ"
#: src/main/help.c:74
#: src/main/help.c:344
msgid "assume terminal is WIDTH characters wide"
msgstr "przyjmij, że terminal ma szerokość WARTOŚĆ znaków"
#: src/main/help.c:75
#: src/main/help.c:346
msgid "HEIGHT"
msgstr ""
#: src/main/help.c:76
#: src/main/help.c:347
msgid "assume terminal is HEIGHT rows high"
msgstr "przyjmij, że terminal ma szerokość WARTOŚĆ znaków"
#: src/main/help.c:77
#: src/main/help.c:349
msgid "NAME"
msgstr "NAZWA"
#: src/main/help.c:78
#: src/main/help.c:350
msgid "prefix visual information with NAME"
msgstr "poprzedź informacje prefiksem NAZWA"
#: src/main/help.c:80
#: src/main/help.c:353
msgid "output even if standard error is not a terminal"
msgstr "pokaż wyjście nawet gdy błędy nie są typu terminal"
#: src/main/help.c:82
#: src/main/help.c:356
msgid "use cursor positioning escape sequences"
msgstr "używaj sekwencji escape do pozycjonowania"
#: src/main/help.c:84
#: src/main/help.c:359
msgid "RATE"
msgstr ""
#: src/main/help.c:85
#: src/main/help.c:360
msgid "limit transfer to RATE bytes per second"
msgstr "ogranicz przesyłane dane do RATE bajtów na sekundę"
#: src/main/help.c:86
#: src/main/help.c:362
msgid "BYTES"
msgstr ""
#: src/main/help.c:87
#: src/main/help.c:363
msgid "use a buffer size of BYTES"
msgstr ""
#: src/main/help.c:89
#: src/main/help.c:366
msgid "never use splice(), always use read/write"
msgstr ""
#: src/main/help.c:91
#: src/main/help.c:369
msgid "skip read errors in input"
msgstr ""
#: src/main/help.c:93
#: src/main/help.c:372
msgid "stop after --size bytes have been transferred"
msgstr ""
#: src/main/help.c:95
#: src/main/help.c:375
msgid "flush cache to disk after every write"
msgstr ""
#: src/main/help.c:378
msgid "use direct I/O to bypass cache"
msgstr ""
#: src/main/help.c:381
msgid "PID"
msgstr ""
#: src/main/help.c:96
#: src/main/help.c:382
msgid "update settings of process PID"
msgstr ""
#: src/main/help.c:99
#: src/main/help.c:386 src/main/help.c:401
msgid "FILE"
msgstr ""
#: src/main/help.c:100
#: src/main/help.c:387
msgid "save process ID in FILE"
msgstr ""
#: src/main/help.c:102
#: src/main/help.c:390
msgid "PID[:FD]"
msgstr ""
#: src/main/help.c:103
#: src/main/help.c:391
msgid "watch file FD opened by process PID"
msgstr ""
#: src/main/help.c:106
#: src/main/help.c:395
msgid "show this help and exit"
msgstr "wyświetl te informacje z pomocą i wyjdź"
#: src/main/help.c:108
#: src/main/help.c:398
msgid "show version information and exit"
msgstr "wyświetl informacje o wersji i wyjdź"
#: src/main/help.c:114
#: src/main/help.c:402
msgid "write debug logs to FILE"
msgstr ""
#. @-formatconst@
#.
#. * splint note: unavoidable use of %s in translated string. Should
#. * be hard to exploit - the message catalogue would have to be
#. * replaced or forced to load from another location.
#.
#: src/main/help.c:427
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Sposób użycia: %s [OPCJA] [PLIK]..."
#: src/main/help.c:117
#. @-mustfreefresh@
#.
#. * splint note: the gettext calls made by _() cause memory leak
#. * warnings, but in this case it's unavoidable, and mitigated by the
#. * fact we only translate each string once.
#.
#: src/main/help.c:438
msgid ""
"Concatenate FILE(s), or standard input, to standard output,\n"
"with monitoring."
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Łączenie PLIK(ów) lub wejścia standardowego, do wyjścia standardowego\n"
"z monitoringiem."
"Łączenie PLIK(ów) lub wejścia standardowego, do wyjścia standardowego z "
"monitoringiem."
#: src/main/help.c:212
msgid ""
"Debugging is enabled; export the DEBUG environment variable to define the\n"
"output filename.\n"
msgstr ""
#: src/main/help.c:216
#: src/main/help.c:575
#, c-format
msgid "Please report any bugs to %s."
msgstr "Proszę przesyłać zgłoszenia błędów do %s."
#: src/main/main.c:74
#: src/main/main.c:75
msgid "state allocation failed"
msgstr ""
#: src/main/main.c:248
#: src/main/main.c:243
msgid "failed to read terminal attributes"
msgstr ""
#: src/main/remote.c:221
msgid "message not received"
msgstr ""
#: src/main/remote.c:328
msgid "IPC not supported on this system"
msgstr ""
#: src/main/options.c:102
#: src/main/options.c:111
msgid "option structure allocation failed"
msgstr "nie udało się zaalokować struktur opcji"
#: src/main/options.c:116
#: src/main/options.c:124
msgid "option structure argv allocation failed"
msgstr "nie udało się zaalokować struktur opcji argv"
#: src/main/options.c:160
#: src/main/options.c:163
msgid "integer argument expected"
msgstr ""
@@ -412,42 +428,45 @@ msgstr ""
msgid "numeric argument expected"
msgstr ""
#: src/main/options.c:182
#: src/main/options.c:180
msgid "process ID or pid:fd pair expected"
msgstr ""
#: src/main/options.c:189
#: src/main/options.c:185
msgid "invalid process ID"
msgstr ""
#: src/main/options.c:355
#: src/main/options.c:358
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Spróbuj `%s --help' by uzyskać więcej informacji"
#: src/main/options.c:359
#: src/main/options.c:360
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Spróbuj `%s -h' by uzyskać więcej informacji"
#: src/main/options.c:375
#: src/main/options.c:374
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
#: src/main/options.c:383
#: src/main/options.c:381
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
#: src/main/options.c:391
#: src/main/options.c:388
msgid "cannot use remote control when watching file descriptors"
msgstr ""
#: src/main/options.c:399
#: src/main/options.c:395
msgid "cannot transfer files when watching file descriptors"
msgstr ""
#: src/main/options.c:407
#: src/main/options.c:402
msgid "not available on systems without /proc/self/fdinfo"
msgstr ""
#~ msgid "Web site: %s"
#~ msgstr "Strona WWW: %s"
+210 -171
View File
@@ -6,27 +6,28 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-17 21:52+0100\n"
"POT-Creation-Date: 2023-07-30 19:07+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/pv/cursor.c:80
#: src/pv/cursor.c:85
msgid "failed to get terminal name"
msgstr "erro ao ler o nome do terminal"
#: src/pv/cursor.c:125
#: src/pv/cursor.c:117
msgid "failed to open lock file"
msgstr "erro ao abrir arquivo de bloqueio"
#: src/pv/cursor.c:159
#: src/pv/cursor.c:150
msgid "lock attempt failed"
msgstr "tentativa de bloqueio falhou"
#: src/pv/cursor.c:409
#: src/pv/cursor.c:391
msgid "failed to open terminal"
msgstr "erro abrindo o terminal"
@@ -34,382 +35,390 @@ msgstr "erro abrindo o terminal"
msgid "failed to seek to start of output"
msgstr "não pode mover para o início da produção"
#: src/pv/file.c:215
#: src/pv/file.c:210
msgid "failed to close file"
msgstr "erro fechando o arquivo"
#: src/pv/file.c:238
#: src/pv/file.c:232
msgid "failed to read file"
msgstr "erro lendo o arquivo"
#: src/pv/file.c:248 src/main/options.c:288
#: src/pv/file.c:239 src/main/options.c:284
msgid "failed to stat file"
msgstr "erro obtendo informações do arquivo"
#: src/pv/file.c:257
#: src/pv/file.c:246
msgid "failed to stat output file"
msgstr "erro obtendo informações do arquivo de saída"
#: src/pv/file.c:280
#: src/pv/file.c:268
msgid "input file is output file"
msgstr "os arquivos de entrada e saída são o mesmo"
#: src/pv/loop.c:527 src/pv/loop.c:597 src/pv/loop.c:649 src/pv/watchpid.c:68
#: src/pv/watchpid.c:79 src/pv/watchpid.c:93 src/pv/watchpid.c:104
#: src/pv/watchpid.c:145 src/pv/watchpid.c:168 src/pv/watchpid.c:178
#: src/pv/watchpid.c:192 src/pv/watchpid.c:285 src/pv/watchpid.c:294
#: src/pv/watchpid.c:332 src/pv/watchpid.c:349
msgid "pid"
msgstr ""
#: src/pv/transfer.c:341
#: src/pv/transfer.c:359
msgid "read failed"
msgstr "erro de leitura"
#: src/pv/transfer.c:359
#: src/pv/transfer.c:374
msgid "warning: read errors detected"
msgstr "aviso: erros de leitura detectados"
#: src/pv/transfer.c:374
#: src/pv/transfer.c:386
msgid "file is not seekable"
msgstr "não pode mover dentro do arquivo"
#: src/pv/transfer.c:437
#: src/pv/transfer.c:445
msgid "failed to seek past error"
msgstr "não pode ir além do erro"
#: src/pv/transfer.c:456
#: src/pv/transfer.c:461
msgid "skipped past read error"
msgstr "ignorado erro de leitura"
#: src/pv/transfer.c:458 src/pv/display.c:687
#: src/pv/transfer.c:461 src/pv/display.c:660
msgid "B"
msgstr ""
#: src/pv/transfer.c:631
#: src/pv/transfer.c:617
msgid "write failed"
msgstr "erro de gravação"
#: src/pv/transfer.c:679 src/pv/display.c:618
#: src/pv/transfer.c:736 src/pv/display.c:594
msgid "buffer allocation failed"
msgstr "erro alocando o buffer"
#: src/pv/transfer.c:770
#.
#. * Any other error is a problem and we must report back.
#.
#: src/pv/transfer.c:833
msgid "select call failed"
msgstr "erro na chamada da função select"
#: src/pv/state.c:25
msgid "history structure allocation failed"
#: src/pv/watchpid.c:73 src/pv/watchpid.c:83 src/pv/watchpid.c:94
#: src/pv/watchpid.c:102 src/pv/watchpid.c:139 src/pv/watchpid.c:150
#: src/pv/watchpid.c:158 src/pv/watchpid.c:169 src/pv/watchpid.c:253
#: src/pv/watchpid.c:261 src/pv/watchpid.c:292 src/pv/watchpid.c:312
#: src/pv/loop.c:506 src/pv/loop.c:558 src/pv/loop.c:602
msgid "pid"
msgstr ""
#: src/pv/state.c:55
msgid "none"
msgstr ""
#: src/pv/display.c:151
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:156
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:683
msgid "b"
msgstr ""
#: src/pv/display.c:738 src/pv/display.c:752
msgid "b/s"
msgstr ""
#: src/pv/display.c:742 src/pv/display.c:757
msgid "/s"
msgstr ""
#: src/pv/display.c:742 src/pv/display.c:758
msgid "B/s"
msgstr "B/s"
#: src/pv/display.c:793 src/pv/display.c:798 src/pv/display.c:860
msgid "ETA"
msgstr "ETA"
#: src/pv/watchpid.c:81 src/pv/watchpid.c:95 src/pv/watchpid.c:106
#: src/pv/watchpid.c:170 src/pv/watchpid.c:180 src/pv/watchpid.c:194
#: src/pv/watchpid.c:83 src/pv/watchpid.c:95 src/pv/watchpid.c:104
#: src/pv/watchpid.c:150 src/pv/watchpid.c:159 src/pv/watchpid.c:171
msgid "fd"
msgstr ""
#: src/pv/watchpid.c:109 src/pv/watchpid.c:197
#: src/pv/watchpid.c:104 src/pv/watchpid.c:171
msgid "not a regular file or block device"
msgstr "não é um arquivo regular ou dispositivo de bloqueio"
#: src/main/version.c:17
#, c-format
msgid "%s %s - Copyright %s %s"
msgstr "%s %s - Copyright(C) %s %s"
#: src/main/version.c:20
#, c-format
msgid "Web site: %s"
msgstr "Site: %s"
#: src/main/version.c:23
msgid ""
"This program is free software, and is being distributed under the\n"
"terms of the Artistic License 2.0."
#: src/pv/state.c:30
msgid "history structure allocation failed"
msgstr ""
"Este programa é um software livre, distribuído sob os termos da\n"
"Licença Artística."
#: src/pv/state.c:59
msgid "none"
msgstr ""
#: src/pv/display.c:159
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:164
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:656
msgid "b"
msgstr ""
#: src/pv/display.c:711 src/pv/display.c:722
msgid "b/s"
msgstr ""
#: src/pv/display.c:714 src/pv/display.c:726
msgid "/s"
msgstr ""
#: src/pv/display.c:714 src/pv/display.c:726
msgid "B/s"
msgstr "B/s"
#: src/pv/display.c:762 src/pv/display.c:766 src/pv/display.c:825
msgid "ETA"
msgstr "ETA"
#. GNU standard license line and free software notice
#: src/main/version.c:28
msgid ""
"This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
msgid "License: Artistic v2.0 <https://opensource.org/license/artistic-2-0/>"
msgstr ""
"Este programa é distribuído com o intuito de que seja útil,\n"
"porém SEM QUAISQUER GARANTIAS; sem inclusive as garantias implícitas de\n"
"COMERCIALIZAÇÃO e ADEQUAÇÃO A OBJETIVOS PARTICULARES."
#: src/main/help.c:31
#: src/main/version.c:29
msgid "This is free software: you are free to change and redistribute it."
msgstr ""
#: src/main/version.c:30
msgid "There is NO WARRANTY, to the extent permitted by law."
msgstr ""
#. Project web site link
#: src/main/version.c:32
msgid "Project web site"
msgstr ""
#: src/main/remote.c:215
msgid "message not received"
msgstr "mensagem não recebida"
#: src/main/remote.c:318
msgid "IPC not supported on this system"
msgstr "IPC não suportado neste sistema"
#: src/main/help.c:283
msgid "show progress bar"
msgstr "exibe barra de progressão"
#: src/main/help.c:33
#: src/main/help.c:286
msgid "show elapsed time"
msgstr "exibe tempo passado"
#: src/main/help.c:35
#: src/main/help.c:289
msgid "show estimated time of arrival (completion)"
msgstr "exibe o tempo estimado de término"
#: src/main/help.c:38
#: src/main/help.c:292
msgid "show absolute estimated time of arrival (completion)"
msgstr "exibe o tempo absoluto estimado de término"
#: src/main/help.c:40
#: src/main/help.c:295
msgid "show data transfer rate counter"
msgstr "exibe a taxa de transferência"
#: src/main/help.c:42
#: src/main/help.c:298
msgid "show data transfer average rate counter"
msgstr "exibe o contador da taxa média de transferência de dados"
#: src/main/help.c:43 src/main/help.c:63 src/main/help.c:71
#: src/main/help.c:300 src/main/help.c:328 src/main/help.c:340
msgid "SEC"
msgstr ""
#: src/main/help.c:45
#: src/main/help.c:301
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
#: src/main/help.c:47
#: src/main/help.c:304
msgid "show number of bytes transferred"
msgstr "exibe a quantidade de bytes transferidos"
#: src/main/help.c:49
#: src/main/help.c:307
msgid "show number of bits transferred"
msgstr ""
#: src/main/help.c:51
#: src/main/help.c:310
msgid "show percentage of transfer buffer in use"
msgstr "exibe a porcentagem de buffer de transferência em uso"
#: src/main/help.c:52
#: src/main/help.c:312
msgid "NUM"
msgstr ""
#: src/main/help.c:53
#: src/main/help.c:313
msgid "show NUM bytes last written"
msgstr "exibe NUM bytes gravados pela última vez"
#: src/main/help.c:54
#: src/main/help.c:315
msgid "FORMAT"
msgstr ""
#: src/main/help.c:55
#: src/main/help.c:316
msgid "set output format to FORMAT"
msgstr "definir o formato de saída para FORMAT"
#: src/main/help.c:57
#: src/main/help.c:319
msgid "output percentages, not visual information"
msgstr "exibe apenas as porcentagens, sem informações visuais"
#: src/main/help.c:59
#: src/main/help.c:322
msgid "do not output any transfer information at all"
msgstr "executa programa sem exibir quaisquer informações"
#: src/main/help.c:62
#: src/main/help.c:326
msgid "display nothing until first byte transferred"
msgstr "não exibe nada até iniciar o processamento"
#: src/main/help.c:64
#: src/main/help.c:329
msgid "display nothing until SEC seconds have passed"
msgstr "não exibir nada até que os segundos SEC tenham passado"
#: src/main/help.c:65
#: src/main/help.c:331
msgid "SIZE"
msgstr ""
#: src/main/help.c:66
#: src/main/help.c:332
msgid "set estimated data size to SIZE bytes"
msgstr "seta a quantidade estimada de dados em SIZE bytes"
#: src/main/help.c:68
#: src/main/help.c:335
msgid "count lines instead of bytes"
msgstr "contar linhas em vez de bytes"
#: src/main/help.c:70
#: src/main/help.c:338
msgid "lines are null-terminated"
msgstr "linhas são terminadas em nulo"
#: src/main/help.c:72
#: src/main/help.c:341
msgid "update every SEC seconds"
msgstr "atualiza informações a cada SEC segundos"
#: src/main/help.c:73
#: src/main/help.c:343
msgid "WIDTH"
msgstr ""
#: src/main/help.c:74
#: src/main/help.c:344
msgid "assume terminal is WIDTH characters wide"
msgstr "presuma que o terminal tem WIDTH caracteres de largura"
#: src/main/help.c:75
#: src/main/help.c:346
msgid "HEIGHT"
msgstr ""
#: src/main/help.c:76
#: src/main/help.c:347
msgid "assume terminal is HEIGHT rows high"
msgstr "presuma que o terminal tem HEIGHT caracteres de altura"
#: src/main/help.c:77
#: src/main/help.c:349
msgid "NAME"
msgstr ""
#: src/main/help.c:78
#: src/main/help.c:350
msgid "prefix visual information with NAME"
msgstr "exibe NAME antes das demais informações"
#: src/main/help.c:80
#: src/main/help.c:353
msgid "output even if standard error is not a terminal"
msgstr "gera dados mesmo que a saída de erro seja redirecionada"
#: src/main/help.c:82
#: src/main/help.c:356
msgid "use cursor positioning escape sequences"
msgstr "utiliza caracteres de escape para posicionar o cursor"
#: src/main/help.c:84
#: src/main/help.c:359
msgid "RATE"
msgstr ""
#: src/main/help.c:85
#: src/main/help.c:360
msgid "limit transfer to RATE bytes per second"
msgstr "limita a transferência a RATE bytes por segundo"
#: src/main/help.c:86
#: src/main/help.c:362
msgid "BYTES"
msgstr ""
#: src/main/help.c:87
#: src/main/help.c:363
msgid "use a buffer size of BYTES"
msgstr "use um tamanho de buffer de BYTES"
#: src/main/help.c:89
#: src/main/help.c:366
msgid "never use splice(), always use read/write"
msgstr "nunca use splice(), sempre use read/write"
#: src/main/help.c:91
#: src/main/help.c:369
msgid "skip read errors in input"
msgstr "ignorar erros de leitura em entrada"
#: src/main/help.c:93
#: src/main/help.c:372
msgid "stop after --size bytes have been transferred"
msgstr "parar após --size bytes terem sido transferidos"
#: src/main/help.c:95
#: src/main/help.c:375
msgid "flush cache to disk after every write"
msgstr ""
#: src/main/help.c:378
msgid "use direct I/O to bypass cache"
msgstr ""
#: src/main/help.c:381
msgid "PID"
msgstr ""
#: src/main/help.c:96
#: src/main/help.c:382
msgid "update settings of process PID"
msgstr "atualizar as configurações do processo PID"
#: src/main/help.c:99
#: src/main/help.c:386 src/main/help.c:401
msgid "FILE"
msgstr ""
#: src/main/help.c:100
#: src/main/help.c:387
msgid "save process ID in FILE"
msgstr "salvar ID do processo em FILE"
#: src/main/help.c:102
#: src/main/help.c:390
msgid "PID[:FD]"
msgstr ""
#: src/main/help.c:103
#: src/main/help.c:391
msgid "watch file FD opened by process PID"
msgstr "assistir arquivo FD aberto pelo processo PID"
#: src/main/help.c:106
#: src/main/help.c:395
msgid "show this help and exit"
msgstr "exibe esta tela de ajuda e termina"
#: src/main/help.c:108
#: src/main/help.c:398
msgid "show version information and exit"
msgstr "exibe a versão e termina"
#: src/main/help.c:114
#: src/main/help.c:402
msgid "write debug logs to FILE"
msgstr ""
#. @-formatconst@
#.
#. * splint note: unavoidable use of %s in translated string. Should
#. * be hard to exploit - the message catalogue would have to be
#. * replaced or forced to load from another location.
#.
#: src/main/help.c:427
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Uso: %s [OPÇÕES] [ARQUIVOS]..."
#: src/main/help.c:117
#. @-mustfreefresh@
#.
#. * splint note: the gettext calls made by _() cause memory leak
#. * warnings, but in this case it's unavoidable, and mitigated by the
#. * fact we only translate each string once.
#.
#: src/main/help.c:438
msgid ""
"Concatenate FILE(s), or standard input, to standard output,\n"
"with monitoring."
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Concatena ARQUIVO(s) ou a entrada padrão e grava na saída padrão,\n"
"com monitoramento."
"Concatena ARQUIVO(s) ou a entrada padrão e grava na saída padrão, com "
"monitoramento."
#: src/main/help.c:212
msgid ""
"Debugging is enabled; export the DEBUG environment variable to define the\n"
"output filename.\n"
msgstr ""
"A depuração está habilitada; exporte a variável de ambiente DEBUG para\n"
"definir o nome do arquivo de saída.\n"
#: src/main/help.c:216
#: src/main/help.c:575
#, c-format
msgid "Please report any bugs to %s."
msgstr "Por favor, reporte quaisquer defeitos para %s."
#: src/main/main.c:74
#: src/main/main.c:75
msgid "state allocation failed"
msgstr "alocação de memória de status falhou"
#: src/main/main.c:248
#: src/main/main.c:243
msgid "failed to read terminal attributes"
msgstr ""
#: src/main/remote.c:221
msgid "message not received"
msgstr "mensagem não recebida"
#: src/main/remote.c:328
msgid "IPC not supported on this system"
msgstr "IPC não suportado neste sistema"
#: src/main/options.c:102
#: src/main/options.c:111
msgid "option structure allocation failed"
msgstr "erro na alocação da estrutura de opções"
#: src/main/options.c:116
#: src/main/options.c:124
msgid "option structure argv allocation failed"
msgstr "erro na alocação da estrutura de opções argv"
#: src/main/options.c:160
#: src/main/options.c:163
msgid "integer argument expected"
msgstr "argumento inteiro esperado"
@@ -417,25 +426,25 @@ msgstr "argumento inteiro esperado"
msgid "numeric argument expected"
msgstr "argumento numérico esperado"
#: src/main/options.c:182
#: src/main/options.c:180
msgid "process ID or pid:fd pair expected"
msgstr "ID do processo ou par pid:fd esperado"
#: src/main/options.c:189
#: src/main/options.c:185
msgid "invalid process ID"
msgstr "ID de processo inválido"
#: src/main/options.c:355
#: src/main/options.c:358
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Tente `%s --help' para maiores informações."
#: src/main/options.c:359
#: src/main/options.c:360
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Tente `%s -h' para maiores informações."
#: src/main/options.c:375
#: src/main/options.c:374
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
@@ -443,20 +452,50 @@ msgstr ""
"não pode usar o modo de linha ou opções de modificador de transferência ao "
"assistir os descritores de arquivo"
#: src/main/options.c:383
#: src/main/options.c:381
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
"não pode usar o posicionamento do cursor ao observar os descritores de "
"arquivo"
#: src/main/options.c:391
#: src/main/options.c:388
msgid "cannot use remote control when watching file descriptors"
msgstr "não pode usar o controle remoto ao assistir os descritores de arquivo"
#: src/main/options.c:399
#: src/main/options.c:395
msgid "cannot transfer files when watching file descriptors"
msgstr "não pode transferir arquivos ao assistir descritores de arquivo"
#: src/main/options.c:407
#: src/main/options.c:402
msgid "not available on systems without /proc/self/fdinfo"
msgstr "não disponível em sistemas sem /proc/self/fdinfo"
#~ msgid ""
#~ "Debugging is enabled; export the DEBUG environment variable to define "
#~ "the\n"
#~ "output filename.\n"
#~ msgstr ""
#~ "A depuração está habilitada; exporte a variável de ambiente DEBUG para\n"
#~ "definir o nome do arquivo de saída.\n"
#~ msgid "%s %s - Copyright %s %s"
#~ msgstr "%s %s - Copyright(C) %s %s"
#~ msgid "Web site: %s"
#~ msgstr "Site: %s"
#~ msgid ""
#~ "This program is free software, and is being distributed under the\n"
#~ "terms of the Artistic License 2.0."
#~ msgstr ""
#~ "Este programa é um software livre, distribuído sob os termos da\n"
#~ "Licença Artística."
#~ msgid ""
#~ "This program is distributed in the hope that it will be useful,\n"
#~ "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
#~ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
#~ msgstr ""
#~ "Este programa é distribuído com o intuito de que seja útil,\n"
#~ "porém SEM QUAISQUER GARANTIAS; sem inclusive as garantias implícitas de\n"
#~ "COMERCIALIZAÇÃO e ADEQUAÇÃO A OBJETIVOS PARTICULARES."
+132 -118
View File
@@ -8,446 +8,460 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-07-27 20:49+0100\n"
"POT-Creation-Date: 2023-07-30 19:07+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/pv/cursor.c:86
#: src/pv/cursor.c:85
msgid "failed to get terminal name"
msgstr ""
#: src/pv/cursor.c:124
#: src/pv/cursor.c:117
msgid "failed to open lock file"
msgstr ""
#: src/pv/cursor.c:158
#: src/pv/cursor.c:150
msgid "lock attempt failed"
msgstr ""
#: src/pv/cursor.c:408
#: src/pv/cursor.c:391
msgid "failed to open terminal"
msgstr ""
#: src/pv/file.c:124
#: src/pv/file.c:119
msgid "failed to seek to start of output"
msgstr ""
#: src/pv/file.c:220
#: src/pv/file.c:210
msgid "failed to close file"
msgstr ""
#: src/pv/file.c:243
#: src/pv/file.c:232
msgid "failed to read file"
msgstr ""
#: src/pv/file.c:253 src/main/options.c:293
#: src/pv/file.c:239 src/main/options.c:284
msgid "failed to stat file"
msgstr ""
#: src/pv/file.c:262
#: src/pv/file.c:246
msgid "failed to stat output file"
msgstr ""
#: src/pv/file.c:285
#: src/pv/file.c:268
msgid "input file is output file"
msgstr ""
#: src/pv/transfer.c:387
#: src/pv/transfer.c:359
msgid "read failed"
msgstr ""
#: src/pv/transfer.c:405
#: src/pv/transfer.c:374
msgid "warning: read errors detected"
msgstr ""
#: src/pv/transfer.c:420
#: src/pv/transfer.c:386
msgid "file is not seekable"
msgstr ""
#: src/pv/transfer.c:483
#: src/pv/transfer.c:445
msgid "failed to seek past error"
msgstr ""
#: src/pv/transfer.c:502
#: src/pv/transfer.c:461
msgid "skipped past read error"
msgstr ""
#: src/pv/transfer.c:504 src/pv/display.c:723
#: src/pv/transfer.c:461 src/pv/display.c:660
msgid "B"
msgstr ""
#: src/pv/transfer.c:678
#: src/pv/transfer.c:617
msgid "write failed"
msgstr ""
#: src/pv/transfer.c:808 src/pv/display.c:646
#: src/pv/transfer.c:736 src/pv/display.c:594
msgid "buffer allocation failed"
msgstr ""
#: src/pv/transfer.c:913
#.
#. * Any other error is a problem and we must report back.
#.
#: src/pv/transfer.c:833
msgid "select call failed"
msgstr ""
#: src/pv/watchpid.c:74 src/pv/watchpid.c:85 src/pv/watchpid.c:99
#: src/pv/watchpid.c:110 src/pv/watchpid.c:151 src/pv/watchpid.c:168
#: src/pv/watchpid.c:178 src/pv/watchpid.c:192 src/pv/watchpid.c:280
#: src/pv/watchpid.c:289 src/pv/watchpid.c:322 src/pv/watchpid.c:343
#: src/pv/loop.c:542 src/pv/loop.c:604 src/pv/loop.c:656
#: src/pv/watchpid.c:73 src/pv/watchpid.c:83 src/pv/watchpid.c:94
#: src/pv/watchpid.c:102 src/pv/watchpid.c:139 src/pv/watchpid.c:150
#: src/pv/watchpid.c:158 src/pv/watchpid.c:169 src/pv/watchpid.c:253
#: src/pv/watchpid.c:261 src/pv/watchpid.c:292 src/pv/watchpid.c:312
#: src/pv/loop.c:506 src/pv/loop.c:558 src/pv/loop.c:602
msgid "pid"
msgstr ""
#: src/pv/watchpid.c:87 src/pv/watchpid.c:101 src/pv/watchpid.c:112
#: src/pv/watchpid.c:170 src/pv/watchpid.c:180 src/pv/watchpid.c:194
#: src/pv/watchpid.c:83 src/pv/watchpid.c:95 src/pv/watchpid.c:104
#: src/pv/watchpid.c:150 src/pv/watchpid.c:159 src/pv/watchpid.c:171
msgid "fd"
msgstr ""
#: src/pv/watchpid.c:115 src/pv/watchpid.c:197
#: src/pv/watchpid.c:104 src/pv/watchpid.c:171
msgid "not a regular file or block device"
msgstr ""
#: src/pv/state.c:31
#: src/pv/state.c:30
msgid "history structure allocation failed"
msgstr ""
#: src/pv/state.c:61
#: src/pv/state.c:59
msgid "none"
msgstr ""
#: src/pv/display.c:163
#: src/pv/display.c:159
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:168
#: src/pv/display.c:164
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:719
#: src/pv/display.c:656
msgid "b"
msgstr ""
#: src/pv/display.c:784 src/pv/display.c:798
#: src/pv/display.c:711 src/pv/display.c:722
msgid "b/s"
msgstr ""
#: src/pv/display.c:788 src/pv/display.c:803
#: src/pv/display.c:714 src/pv/display.c:726
msgid "/s"
msgstr ""
#: src/pv/display.c:788 src/pv/display.c:804
#: src/pv/display.c:714 src/pv/display.c:726
msgid "B/s"
msgstr ""
#: src/pv/display.c:841 src/pv/display.c:848 src/pv/display.c:912
#: src/pv/display.c:762 src/pv/display.c:766 src/pv/display.c:825
msgid "ETA"
msgstr ""
#: src/main/version.c:24
#. GNU standard license line and free software notice
#: src/main/version.c:28
msgid "License: Artistic v2.0 <https://opensource.org/license/artistic-2-0/>"
msgstr ""
#: src/main/version.c:27
#: src/main/version.c:29
msgid "This is free software: you are free to change and redistribute it."
msgstr ""
#: src/main/version.c:29
#: src/main/version.c:30
msgid "There is NO WARRANTY, to the extent permitted by law."
msgstr ""
#. Project web site link
#: src/main/version.c:31
#: src/main/version.c:32
msgid "Project web site"
msgstr ""
#: src/main/remote.c:223
#: src/main/remote.c:215
msgid "message not received"
msgstr ""
#: src/main/remote.c:330
#: src/main/remote.c:318
msgid "IPC not supported on this system"
msgstr ""
#: src/main/help.c:31
#: src/main/help.c:283
msgid "show progress bar"
msgstr ""
#: src/main/help.c:33
#: src/main/help.c:286
msgid "show elapsed time"
msgstr ""
#: src/main/help.c:35
#: src/main/help.c:289
msgid "show estimated time of arrival (completion)"
msgstr ""
#: src/main/help.c:38
#: src/main/help.c:292
msgid "show absolute estimated time of arrival (completion)"
msgstr ""
#: src/main/help.c:40
#: src/main/help.c:295
msgid "show data transfer rate counter"
msgstr ""
#: src/main/help.c:42
#: src/main/help.c:298
msgid "show data transfer average rate counter"
msgstr ""
#: src/main/help.c:43 src/main/help.c:63 src/main/help.c:71
#: src/main/help.c:300 src/main/help.c:328 src/main/help.c:340
msgid "SEC"
msgstr ""
#: src/main/help.c:45
#: src/main/help.c:301
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
#: src/main/help.c:47
#: src/main/help.c:304
msgid "show number of bytes transferred"
msgstr ""
#: src/main/help.c:49
#: src/main/help.c:307
msgid "show number of bits transferred"
msgstr ""
#: src/main/help.c:51
#: src/main/help.c:310
msgid "show percentage of transfer buffer in use"
msgstr ""
#: src/main/help.c:52
#: src/main/help.c:312
msgid "NUM"
msgstr ""
#: src/main/help.c:53
#: src/main/help.c:313
msgid "show NUM bytes last written"
msgstr ""
#: src/main/help.c:54
#: src/main/help.c:315
msgid "FORMAT"
msgstr ""
#: src/main/help.c:55
#: src/main/help.c:316
msgid "set output format to FORMAT"
msgstr ""
#: src/main/help.c:57
#: src/main/help.c:319
msgid "output percentages, not visual information"
msgstr ""
#: src/main/help.c:59
#: src/main/help.c:322
msgid "do not output any transfer information at all"
msgstr ""
#: src/main/help.c:62
#: src/main/help.c:326
msgid "display nothing until first byte transferred"
msgstr ""
#: src/main/help.c:64
#: src/main/help.c:329
msgid "display nothing until SEC seconds have passed"
msgstr ""
#: src/main/help.c:65
#: src/main/help.c:331
msgid "SIZE"
msgstr ""
#: src/main/help.c:66
#: src/main/help.c:332
msgid "set estimated data size to SIZE bytes"
msgstr ""
#: src/main/help.c:68
#: src/main/help.c:335
msgid "count lines instead of bytes"
msgstr ""
#: src/main/help.c:70
#: src/main/help.c:338
msgid "lines are null-terminated"
msgstr ""
#: src/main/help.c:72
#: src/main/help.c:341
msgid "update every SEC seconds"
msgstr ""
#: src/main/help.c:73
#: src/main/help.c:343
msgid "WIDTH"
msgstr ""
#: src/main/help.c:74
#: src/main/help.c:344
msgid "assume terminal is WIDTH characters wide"
msgstr ""
#: src/main/help.c:75
#: src/main/help.c:346
msgid "HEIGHT"
msgstr ""
#: src/main/help.c:76
#: src/main/help.c:347
msgid "assume terminal is HEIGHT rows high"
msgstr ""
#: src/main/help.c:77
#: src/main/help.c:349
msgid "NAME"
msgstr ""
#: src/main/help.c:78
#: src/main/help.c:350
msgid "prefix visual information with NAME"
msgstr ""
#: src/main/help.c:80
#: src/main/help.c:353
msgid "output even if standard error is not a terminal"
msgstr ""
#: src/main/help.c:82
#: src/main/help.c:356
msgid "use cursor positioning escape sequences"
msgstr ""
#: src/main/help.c:84
#: src/main/help.c:359
msgid "RATE"
msgstr ""
#: src/main/help.c:85
#: src/main/help.c:360
msgid "limit transfer to RATE bytes per second"
msgstr ""
#: src/main/help.c:86
#: src/main/help.c:362
msgid "BYTES"
msgstr ""
#: src/main/help.c:87
#: src/main/help.c:363
msgid "use a buffer size of BYTES"
msgstr ""
#: src/main/help.c:89
#: src/main/help.c:366
msgid "never use splice(), always use read/write"
msgstr ""
#: src/main/help.c:91
#: src/main/help.c:369
msgid "skip read errors in input"
msgstr ""
#: src/main/help.c:93
#: src/main/help.c:372
msgid "stop after --size bytes have been transferred"
msgstr ""
#: src/main/help.c:95
#: src/main/help.c:375
msgid "flush cache to disk after every write"
msgstr ""
#: src/main/help.c:97
#: src/main/help.c:378
msgid "use direct I/O to bypass cache"
msgstr ""
#: src/main/help.c:99
#: src/main/help.c:381
msgid "PID"
msgstr ""
#: src/main/help.c:100
#: src/main/help.c:382
msgid "update settings of process PID"
msgstr ""
#: src/main/help.c:103
#: src/main/help.c:386 src/main/help.c:401
msgid "FILE"
msgstr ""
#: src/main/help.c:104
#: src/main/help.c:387
msgid "save process ID in FILE"
msgstr ""
#: src/main/help.c:106
#: src/main/help.c:390
msgid "PID[:FD]"
msgstr ""
#: src/main/help.c:107
#: src/main/help.c:391
msgid "watch file FD opened by process PID"
msgstr ""
#: src/main/help.c:110
#: src/main/help.c:395
msgid "show this help and exit"
msgstr ""
#: src/main/help.c:112
#: src/main/help.c:398
msgid "show version information and exit"
msgstr ""
#: src/main/help.c:119
#: src/main/help.c:402
msgid "write debug logs to FILE"
msgstr ""
#. @-formatconst@
#.
#. * splint note: unavoidable use of %s in translated string. Should
#. * be hard to exploit - the message catalogue would have to be
#. * replaced or forced to load from another location.
#.
#: src/main/help.c:427
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr ""
#: src/main/help.c:122
#. @-mustfreefresh@
#.
#. * splint note: the gettext calls made by _() cause memory leak
#. * warnings, but in this case it's unavoidable, and mitigated by the
#. * fact we only translate each string once.
#.
#: src/main/help.c:438
msgid ""
"Concatenate FILE(s), or standard input, to standard output,\n"
"with monitoring."
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
#: src/main/help.c:215
msgid ""
"Debugging is enabled; export the DEBUG environment variable to define the\n"
"output filename.\n"
msgstr ""
#: src/main/help.c:219
#: src/main/help.c:575
#, c-format
msgid "Please report any bugs to %s."
msgstr ""
#: src/main/main.c:76
#: src/main/main.c:75
msgid "state allocation failed"
msgstr ""
#: src/main/main.c:252
#: src/main/main.c:243
msgid "failed to read terminal attributes"
msgstr ""
#: src/main/options.c:106
#: src/main/options.c:111
msgid "option structure allocation failed"
msgstr ""
#: src/main/options.c:120
#: src/main/options.c:124
msgid "option structure argv allocation failed"
msgstr ""
#: src/main/options.c:165
#: src/main/options.c:163
msgid "integer argument expected"
msgstr ""
#: src/main/options.c:176
#: src/main/options.c:171
msgid "numeric argument expected"
msgstr ""
#: src/main/options.c:187
#: src/main/options.c:180
msgid "process ID or pid:fd pair expected"
msgstr ""
#: src/main/options.c:194
#: src/main/options.c:185
msgid "invalid process ID"
msgstr ""
#: src/main/options.c:366
#: src/main/options.c:358
#, c-format
msgid "Try `%s --help' for more information."
msgstr ""
#: src/main/options.c:370
#: src/main/options.c:360
#, c-format
msgid "Try `%s -h' for more information."
msgstr ""
#: src/main/options.c:386
#: src/main/options.c:374
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
#: src/main/options.c:394
#: src/main/options.c:381
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
#: src/main/options.c:402
#: src/main/options.c:388
msgid "cannot use remote control when watching file descriptors"
msgstr ""
#: src/main/options.c:410
#: src/main/options.c:395
msgid "cannot transfer files when watching file descriptors"
msgstr ""
#: src/main/options.c:418
#: src/main/options.c:402
msgid "not available on systems without /proc/self/fdinfo"
msgstr ""
+15 -37
View File
@@ -82,17 +82,14 @@ static void pv_crs_open_lockfile(pvstate_t state, int fd)
ttydev = ttyname(fd);
if (!ttydev) {
if (!state->force) {
pv_error(state, "%s: %s",
_("failed to get terminal name"),
strerror(errno));
pv_error(state, "%s: %s", _("failed to get terminal name"), strerror(errno));
}
/*
* If we don't know our terminal name, we can neither do IPC
* nor make a lock file, so turn off cursor positioning.
*/
state->cursor = 0;
debug("%s",
"ttyname failed - cursor positioning disabled");
debug("%s", "ttyname failed - cursor positioning disabled");
return;
}
@@ -104,9 +101,7 @@ static void pv_crs_open_lockfile(pvstate_t state, int fd)
memset(state->crs_lock_file, 0, PV_SIZEOF_CRS_LOCK_FILE);
(void) pv_snprintf(state->crs_lock_file,
PV_SIZEOF_CRS_LOCK_FILE,
"%s/pv-%s-%i.lock", tmpdir, basename(ttydev),
(int) geteuid());
PV_SIZEOF_CRS_LOCK_FILE, "%s/pv-%s-%i.lock", tmpdir, basename(ttydev), (int) geteuid());
/*
* Pawel Piatek - not everyone has O_NOFOLLOW, e.g. AIX doesn't
@@ -119,9 +114,7 @@ static void pv_crs_open_lockfile(pvstate_t state, int fd)
state->crs_lock_fd = open(state->crs_lock_file, openflags, 0600);
if (state->crs_lock_fd < 0) {
pv_error(state, "%s: %s: %s",
state->crs_lock_file,
_("failed to open lock file"), strerror(errno));
pv_error(state, "%s: %s: %s", state->crs_lock_file, _("failed to open lock file"), strerror(errno));
state->cursor = 0;
return;
}
@@ -154,17 +147,14 @@ static void pv_crs_lock(pvstate_t state, int fd)
lock_fd = state->crs_lock_fd;
}
} else {
pv_error(state, "%s: %s",
_("lock attempt failed"),
strerror(errno));
pv_error(state, "%s: %s", _("lock attempt failed"), strerror(errno));
return;
}
}
}
if (state->crs_lock_fd >= 0) {
debug("%s: %s", state->crs_lock_file,
"terminal lockfile acquired");
debug("%s: %s", state->crs_lock_file, "terminal lockfile acquired");
} else {
debug("%s", "terminal lock acquired");
}
@@ -192,8 +182,7 @@ static void pv_crs_unlock(pvstate_t state, int fd)
(void) fcntl(lock_fd, F_SETLK, &lock);
if (state->crs_lock_fd >= 0) {
debug("%s: %s", state->crs_lock_file,
"terminal lockfile released");
debug("%s: %s", state->crs_lock_file, "terminal lockfile released");
} else {
debug("%s", "terminal lock released");
}
@@ -269,8 +258,7 @@ static int pv_crs_get_ypos(int terminalfd)
debug
("read answerback message from fd %d, length %d - buf = %02X %02X %02X %02X %02X %02X",
terminalfd, got, cpr[0], cpr[1], cpr[2], cpr[3], cpr[4],
cpr[5]);
terminalfd, got, cpr[0], cpr[1], cpr[2], cpr[3], cpr[4], cpr[5]);
#else /* !CURSOR_ANSWERBACK_BYTE_BY_BYTE */
/* Read answerback in one big lump - may fail on Solaris */
@@ -280,8 +268,7 @@ static int pv_crs_get_ypos(int terminalfd)
} else {
debug
("read answerback message from fd %d, length %d - buf = %02X %02X %02X %02X %02X %02X",
terminalfd, r, cpr[0], cpr[1], cpr[2], cpr[3], cpr[4],
cpr[5]);
terminalfd, r, cpr[0], cpr[1], cpr[2], cpr[3], cpr[4], cpr[5]);
}
#endif /* CURSOR_ANSWERBACK_BYTE_BY_BYTE */
@@ -366,8 +353,7 @@ static int pv_crs_ipcinit(pvstate_t state, char *ttyfile, int terminalfd)
if (state->crs_pvcount > 1) {
state->crs_y_start = *(state->crs_y_top);
state->crs_y_lastread = state->crs_y_start;
debug("%s: %d", "not the first to attach - got top y",
state->crs_y_start);
debug("%s: %d", "not the first to attach - got top y", state->crs_y_start);
}
pv_crs_unlock(state, terminalfd);
@@ -395,18 +381,14 @@ void pv_crs_init(pvstate_t state)
ttyfile = ttyname(STDERR_FILENO);
if (!ttyfile) {
debug("%s: %s",
"disabling cursor positioning because ttyname failed",
strerror(errno));
debug("%s: %s", "disabling cursor positioning because ttyname failed", strerror(errno));
state->cursor = 0;
return;
}
fd = open(ttyfile, O_RDWR);
if (fd < 0) {
pv_error(state, "%s: %s: %s",
_("failed to open terminal"), ttyfile,
strerror(errno));
pv_error(state, "%s: %s: %s", _("failed to open terminal"), ttyfile, strerror(errno));
state->cursor = false;
return;
}
@@ -527,15 +509,12 @@ void pv_crs_update(pvstate_t state, const char *str)
* scroll the screen (only if we're the first `pv'), and then move
* our initial Y co-ordinate up.
*/
if (((state->crs_y_start + state->crs_pvmax) >
(int) (state->height))
if (((state->crs_y_start + state->crs_pvmax) > (int) (state->height))
&& (!state->crs_noipc)
) {
int offs;
offs =
((state->crs_y_start + state->crs_pvmax) -
state->height);
offs = ((state->crs_y_start + state->crs_pvmax) - state->height);
state->crs_y_start -= offs;
if (state->crs_y_start < 1)
@@ -550,8 +529,7 @@ void pv_crs_update(pvstate_t state, const char *str)
pv_crs_lock(state, STDERR_FILENO);
memset(pos, 0, sizeof(pos));
(void) pv_snprintf(pos, sizeof(pos), "\033[%u;1H",
state->height);
(void) pv_snprintf(pos, sizeof(pos), "\033[%u;1H", state->height);
pv_write_retry(STDERR_FILENO, pos, strlen(pos));
for (; offs > 0; offs--) {
pv_write_retry(STDERR_FILENO, "\n", 1);
+97 -221
View File
@@ -20,11 +20,11 @@
#include <unistd.h>
#ifdef HAVE_TERMIOS_H
# include <termios.h>
#include <termios.h>
#endif
#ifdef GWINSZ_IN_SYS_IOCTL
# include <sys/ioctl.h>
#include <sys/ioctl.h>
#endif
@@ -64,14 +64,12 @@ bool pv_in_foreground(void)
tty_process_group = tcgetpgrp(STDERR_FILENO);
if (tty_process_group == -1 && errno == ENOTTY) {
debug("%s: true: %s", "pv_in_foreground",
"tty_process_group is -1, errno is ENOTTY");
debug("%s: true: %s", "pv_in_foreground", "tty_process_group is -1, errno is ENOTTY");
return true;
}
if (our_process_group == tty_process_group) {
debug("%s: true: %s", "pv_in_foreground",
"our_process_group == tty_process_group");
debug("%s: true: %s", "pv_in_foreground", "our_process_group == tty_process_group");
return true;
}
@@ -121,8 +119,7 @@ static long pv__calc_percentage(long long so_far, const long long total)
* transfer, and how long it's taken so far in seconds, return the estimated
* number of seconds until completion.
*/
static long pv__calc_eta(const long long so_far, const long long total,
const long rate)
static long pv__calc_eta(const long long so_far, const long long total, const long rate)
{
long long amount_left;
@@ -147,8 +144,7 @@ static long pv__calc_eta(const long long so_far, const long long total,
* modified. Further changed after input from Thomas Rachel; changed still
* further after Debian bug #706175.
*/
static void pv__si_prefix(long double *value, char *prefix,
const long double ratio, int is_bytes)
static void pv__si_prefix(long double *value, char *prefix, const long double ratio, int is_bytes)
{
static char *pfx_000 = NULL; /* kilo, mega, etc */
static char *pfx_024 = NULL; /* kibi, mibi, etc */
@@ -231,8 +227,7 @@ static void pv__si_prefix(long double *value, char *prefix,
* parameter (a %s) which will expand to the string described above.
*/
static void pv__sizestr(char *buffer, int bufsize, char *format,
long double amount, char *suffix_basic,
char *suffix_bytes, int is_bytes)
long double amount, char *suffix_basic, char *suffix_bytes, int is_bytes)
{
char sizestr_buffer[256];
char si_prefix[8];
@@ -261,8 +256,7 @@ static void pv__sizestr(char *buffer, int bufsize, char *format,
/* Fix for display of "1.01e+03" instead of "1010" */
if (display_amount > 99.9) {
(void) pv_snprintf(sizestr_buffer, sizeof(sizestr_buffer),
"%4ld%.2s%.16s", (long) display_amount,
si_prefix, suffix);
"%4ld%.2s%.16s", (long) display_amount, si_prefix, suffix);
} else {
/*
* AIX blows up with %4.3Lg%.2s%.16s for some reason, so we
@@ -270,11 +264,8 @@ static void pv__sizestr(char *buffer, int bufsize, char *format,
*/
char str_disp[64];
/* # to get 13.0GB instead of 13GB (#1477) */
(void) pv_snprintf(str_disp, sizeof(str_disp), "%#4.3Lg",
display_amount);
(void) pv_snprintf(sizestr_buffer, sizeof(sizestr_buffer),
"%s%.2s%.16s", str_disp, si_prefix,
suffix);
(void) pv_snprintf(str_disp, sizeof(str_disp), "%#4.3Lg", display_amount);
(void) pv_snprintf(sizestr_buffer, sizeof(sizestr_buffer), "%s%.2s%.16s", str_disp, si_prefix, suffix);
}
(void) pv_snprintf(buffer, bufsize, format, sizestr_buffer);
@@ -301,18 +292,13 @@ static void pv__format_init(pvstate_t state)
state->str_average_rate[0] = 0;
state->str_progress[0] = 0;
state->str_eta[0] = 0;
memset(state->format, 0,
PV_FORMAT_ARRAY_MAX * sizeof(state->format[0]));
memset(state->format, 0, PV_FORMAT_ARRAY_MAX * sizeof(state->format[0]));
if (state->name) {
(void) pv_snprintf(state->str_name,
PV_SIZEOF_STR_NAME, "%9.500s:",
state->name);
(void) pv_snprintf(state->str_name, PV_SIZEOF_STR_NAME, "%9.500s:", state->name);
}
formatstr =
state->format_string ? state->
format_string : state->default_format;
formatstr = state->format_string ? state->format_string : state->default_format;
state->components_used = 0;
@@ -338,105 +324,85 @@ static void pv__format_init(pvstate_t state)
* these segments together.
*/
segment = 0;
for (strpos = 0; formatstr[strpos] != 0 && segment < 99;
strpos++, segment++) {
for (strpos = 0; formatstr[strpos] != 0 && segment < 99; strpos++, segment++) {
if ('%' == formatstr[strpos]) {
unsigned int num;
strpos++;
num = 0;
while (isdigit(formatstr[strpos])) {
while (isdigit((int)(formatstr[strpos]))) {
num = num * 10;
num += formatstr[strpos] - '0';
strpos++;
}
switch (formatstr[strpos]) {
case 'p':
state->format[segment].string =
state->str_progress;
state->format[segment].string = state->str_progress;
state->format[segment].length = -1;
state->components_used |=
PV_DISPLAY_PROGRESS;
state->components_used |= PV_DISPLAY_PROGRESS;
break;
case 't':
state->format[segment].string =
state->str_timer;
state->format[segment].string = state->str_timer;
state->format[segment].length = 0;
state->components_used |= PV_DISPLAY_TIMER;
break;
case 'e':
state->format[segment].string =
state->str_eta;
state->format[segment].string = state->str_eta;
state->format[segment].length = 0;
state->components_used |= PV_DISPLAY_ETA;
break;
case 'I':
state->format[segment].string =
state->str_fineta;
state->format[segment].string = state->str_fineta;
state->format[segment].length = 0;
state->components_used |=
PV_DISPLAY_FINETA;
state->components_used |= PV_DISPLAY_FINETA;
break;
case 'A':
state->format[segment].string =
state->str_lastoutput;
state->format[segment].string = state->str_lastoutput;
state->format[segment].length = 0;
if (num > PV_SIZEOF_LASTOUTPUT_BUFFER)
num = PV_SIZEOF_LASTOUTPUT_BUFFER;
if (num < 1)
num = 1;
state->lastoutput_length = num;
state->components_used |=
PV_DISPLAY_OUTPUTBUF;
state->components_used |= PV_DISPLAY_OUTPUTBUF;
break;
case 'r':
state->format[segment].string =
state->str_rate;
state->format[segment].string = state->str_rate;
state->format[segment].length = 0;
state->components_used |= PV_DISPLAY_RATE;
break;
case 'a':
state->format[segment].string =
state->str_average_rate;
state->format[segment].string = state->str_average_rate;
state->format[segment].length = 0;
state->components_used |=
PV_DISPLAY_AVERAGERATE;
state->components_used |= PV_DISPLAY_AVERAGERATE;
break;
case 'b':
state->format[segment].string =
state->str_transferred;
state->format[segment].string = state->str_transferred;
state->format[segment].length = 0;
state->components_used |= PV_DISPLAY_BYTES;
break;
case 'T':
state->format[segment].string =
state->str_bufpercent;
state->format[segment].string = state->str_bufpercent;
state->format[segment].length = 0;
state->components_used |=
PV_DISPLAY_BUFPERCENT;
state->components_used |= PV_DISPLAY_BUFPERCENT;
break;
case 'N':
state->format[segment].string =
state->str_name;
state->format[segment].length =
strlen(state->str_name);
state->format[segment].string = state->str_name;
state->format[segment].length = strlen(state->str_name);
state->components_used |= PV_DISPLAY_NAME;
break;
case '%':
/* %% => % */
state->format[segment].string =
&(formatstr[strpos]);
state->format[segment].string = &(formatstr[strpos]);
state->format[segment].length = 1;
break;
case 0:
/* % at end => just % */
state->format[segment].string =
&(formatstr[--strpos]);
state->format[segment].string = &(formatstr[--strpos]);
state->format[segment].length = 1;
break;
default:
/* %z (unknown) => %z */
state->format[segment].string =
&(formatstr[--strpos]);
state->format[segment].string = &(formatstr[--strpos]);
state->format[segment].length = 2;
strpos++;
break;
@@ -447,11 +413,9 @@ static void pv__format_init(pvstate_t state)
if (NULL == searchptr) {
foundlength = strlen(&(formatstr[strpos]));
} else {
foundlength =
searchptr - &(formatstr[strpos]);
foundlength = searchptr - &(formatstr[strpos]);
}
state->format[segment].string =
&(formatstr[strpos]);
state->format[segment].string = &(formatstr[strpos]);
state->format[segment].length = foundlength;
strpos += foundlength - 1;
}
@@ -471,9 +435,7 @@ static long bound_long(long x, long min, long max)
}
/* Update history and current average rate */
static void update_history_avg_rate(pvstate_t state, long long total_bytes,
long double elapsed_sec,
long double rate)
static void update_history_avg_rate(pvstate_t state, long long total_bytes, long double elapsed_sec, long double rate)
{
int first = state->history_first;
int last = state->history_last;
@@ -509,10 +471,8 @@ static void update_history_avg_rate(pvstate_t state, long long total_bytes,
if (first == last) {
state->current_avg_rate = rate;
} else {
long long bytes = (state->history[last].total_bytes -
state->history[first].total_bytes);
long double sec = (state->history[last].elapsed_sec -
state->history[first].elapsed_sec);
long long bytes = (state->history[last].total_bytes - state->history[first].total_bytes);
long double sec = (state->history[last].elapsed_sec - state->history[first].elapsed_sec);
state->current_avg_rate = bytes / sec;
}
}
@@ -535,9 +495,7 @@ static void update_history_avg_rate(pvstate_t state, long long total_bytes,
* NULL.
*/
static const char *pv__format(pvstate_t state,
long double elapsed_sec,
long long bytes_since_last,
long long total_bytes)
long double elapsed_sec, long long bytes_since_last, long long total_bytes)
{
long double time_since_last, rate, average_rate;
long eta;
@@ -569,9 +527,7 @@ static const char *pv__format(pvstate_t state,
rate = state->prev_rate;
state->prev_trans += bytes_since_last;
} else {
rate =
((long double) bytes_since_last +
state->prev_trans) / time_since_last;
rate = ((long double) bytes_since_last + state->prev_trans) / time_since_last;
state->prev_elapsed_sec = elapsed_sec;
state->prev_trans = 0;
}
@@ -591,9 +547,7 @@ static const char *pv__format(pvstate_t state,
if (elapsed_sec < 0.000001)
elapsed_sec = 0.000001;
average_rate =
(((long double) total_bytes) -
((long double) state->initial_offset)) /
(long double) elapsed_sec;
(((long double) total_bytes) - ((long double) state->initial_offset)) / (long double) elapsed_sec;
rate = average_rate;
}
@@ -610,23 +564,19 @@ static const char *pv__format(pvstate_t state,
state->percentage += 2;
if (state->percentage > 199)
state->percentage = 0;
} else if (state->numeric
|| ((state->components_used & PV_DISPLAY_PROGRESS) !=
0)) {
} else if (state->numeric || ((state->components_used & PV_DISPLAY_PROGRESS) != 0)) {
/*
* If we do know the total size, and we're going to show
* the percentage (numeric mode or a progress bar),
* calculate the percentage completion.
*/
state->percentage =
pv__calc_percentage(total_bytes, state->size);
state->percentage = pv__calc_percentage(total_bytes, state->size);
}
/*
* Reallocate output buffer if width changes.
*/
if (state->display_buffer != NULL
&& state->display_buffer_size < (state->width * 2)) {
if (state->display_buffer != NULL && state->display_buffer_size < (state->width * 2)) {
free(state->display_buffer);
state->display_buffer = NULL;
state->display_buffer_size = 0;
@@ -639,12 +589,9 @@ static const char *pv__format(pvstate_t state,
state->display_buffer_size = (2 * state->width) + 80;
if (state->name)
state->display_buffer_size += strlen(state->name);
state->display_buffer =
malloc(state->display_buffer_size + 16);
state->display_buffer = malloc(state->display_buffer_size + 16);
if (NULL == state->display_buffer) {
pv_error(state, "%s: %s",
_("buffer allocation failed"),
strerror(errno));
pv_error(state, "%s: %s", _("buffer allocation failed"), strerror(errno));
state->exit_status |= 64;
return NULL;
}
@@ -665,29 +612,21 @@ static const char *pv__format(pvstate_t state,
numericprefix[0] = 0;
if ((state->components_used & PV_DISPLAY_TIMER) != 0)
(void) pv_snprintf(numericprefix,
sizeof(numericprefix), "%.4Lf ",
elapsed_sec);
(void) pv_snprintf(numericprefix, sizeof(numericprefix), "%.4Lf ", elapsed_sec);
if ((state->components_used & PV_DISPLAY_BYTES) != 0) {
if (state->bits) {
(void) pv_snprintf(state->display_buffer,
state->display_buffer_size,
"%.99s%lld\n",
numericprefix,
8 * total_bytes);
"%.99s%lld\n", numericprefix, 8 * total_bytes);
} else {
(void) pv_snprintf(state->display_buffer,
state->display_buffer_size,
"%.99s%lld\n",
numericprefix,
total_bytes);
"%.99s%lld\n", numericprefix, total_bytes);
}
} else {
(void) pv_snprintf(state->display_buffer,
state->display_buffer_size,
"%.99s%ld\n", numericprefix,
state->percentage);
state->display_buffer_size, "%.99s%ld\n", numericprefix, state->percentage);
}
return state->display_buffer;
@@ -714,14 +653,11 @@ static const char *pv__format(pvstate_t state,
if ((state->components_used & PV_DISPLAY_BYTES) != 0) {
if (state->bits && !state->linemode) {
pv__sizestr(state->str_transferred,
PV_SIZEOF_STR_TRANSFERRED, "%s",
(long double) total_bytes * 8, "",
_("b"), 1);
PV_SIZEOF_STR_TRANSFERRED, "%s", (long double) total_bytes * 8, "", _("b"), 1);
} else {
pv__sizestr(state->str_transferred,
PV_SIZEOF_STR_TRANSFERRED, "%s",
(long double) total_bytes, "", _("B"),
state->linemode ? 0 : 1);
(long double) total_bytes, "", _("B"), state->linemode ? 0 : 1);
}
}
@@ -732,14 +668,10 @@ static const char *pv__format(pvstate_t state,
PV_SIZEOF_STR_BUFPERCENT,
"{%3ld%%}",
pv__calc_percentage
(state->read_position -
state->write_position,
state->buffer_size));
(state->read_position - state->write_position, state->buffer_size));
#ifdef HAVE_SPLICE
if (state->splice_used)
(void) pv_snprintf(state->str_bufpercent,
PV_SIZEOF_STR_BUFPERCENT,
"{%s}", "----");
(void) pv_snprintf(state->str_bufpercent, PV_SIZEOF_STR_BUFPERCENT, "{%s}", "----");
#endif
}
@@ -763,30 +695,23 @@ static const char *pv__format(pvstate_t state,
"%ld:%02ld:%02ld:%02ld",
((long) elapsed_sec) / 86400,
(((long) elapsed_sec) / 3600) %
24,
(((long) elapsed_sec) / 60) %
60, ((long) elapsed_sec) % 60);
24, (((long) elapsed_sec) / 60) % 60, ((long) elapsed_sec) % 60);
} else {
(void) pv_snprintf(state->str_timer,
PV_SIZEOF_STR_TIMER,
"%ld:%02ld:%02ld",
((long) elapsed_sec) / 3600,
(((long) elapsed_sec) / 60) %
60, ((long) elapsed_sec) % 60);
(((long) elapsed_sec) / 60) % 60, ((long) elapsed_sec) % 60);
}
}
/* Rate - set up the display string. */
if ((state->components_used & PV_DISPLAY_RATE) != 0) {
if (state->bits && !state->linemode) {
pv__sizestr(state->str_rate,
PV_SIZEOF_STR_RATE, "[%s]",
8 * rate, "", _("b/s"), 1);
pv__sizestr(state->str_rate, PV_SIZEOF_STR_RATE, "[%s]", 8 * rate, "", _("b/s"), 1);
} else {
pv__sizestr(state->str_rate,
PV_SIZEOF_STR_RATE, "[%s]", rate,
_("/s"), _("B/s"),
state->linemode ? 0 : 1);
PV_SIZEOF_STR_RATE, "[%s]", rate, _("/s"), _("B/s"), state->linemode ? 0 : 1);
}
}
@@ -794,14 +719,11 @@ static const char *pv__format(pvstate_t state,
if ((state->components_used & PV_DISPLAY_AVERAGERATE) != 0) {
if (state->bits && !state->linemode) {
pv__sizestr(state->str_average_rate,
PV_SIZEOF_STR_AVERAGE_RATE,
"[%s]", 8 * average_rate, "", _("b/s"),
1);
PV_SIZEOF_STR_AVERAGE_RATE, "[%s]", 8 * average_rate, "", _("b/s"), 1);
} else {
pv__sizestr(state->str_average_rate,
PV_SIZEOF_STR_AVERAGE_RATE,
"[%s]", average_rate, _("/s"),
_("B/s"), state->linemode ? 0 : 1);
"[%s]", average_rate, _("/s"), _("B/s"), state->linemode ? 0 : 1);
}
}
@@ -821,8 +743,7 @@ static const char *pv__format(pvstate_t state,
&& (state->size > 0)) {
eta =
pv__calc_eta(total_bytes - state->initial_offset,
state->size - state->initial_offset,
state->current_avg_rate);
state->size - state->initial_offset, state->current_avg_rate);
/*
* Bounds check, so we don't overrun the suffix buffer. This
@@ -838,15 +759,11 @@ static const char *pv__format(pvstate_t state,
(void) pv_snprintf(state->str_eta,
PV_SIZEOF_STR_ETA,
"%.16s %ld:%02ld:%02ld:%02ld",
_("ETA"), eta / 86400,
(eta / 3600) % 24,
(eta / 60) % 60, eta % 60);
_("ETA"), eta / 86400, (eta / 3600) % 24, (eta / 60) % 60, eta % 60);
} else {
(void) pv_snprintf(state->str_eta,
PV_SIZEOF_STR_ETA,
"%.16s %ld:%02ld:%02ld",
_("ETA"), eta / 3600,
(eta / 60) % 60, eta % 60);
"%.16s %ld:%02ld:%02ld", _("ETA"), eta / 3600, (eta / 60) % 60, eta % 60);
}
/*
@@ -855,8 +772,7 @@ static const char *pv__format(pvstate_t state,
*/
if (bytes_since_last < 0) {
unsigned int i;
for (i = 0; i < PV_SIZEOF_STR_ETA
&& state->str_eta[i] != '\0'; i++) {
for (i = 0; i < PV_SIZEOF_STR_ETA && state->str_eta[i] != '\0'; i++) {
state->str_eta[i] = ' ';
}
}
@@ -877,8 +793,7 @@ static const char *pv__format(pvstate_t state,
eta =
pv__calc_eta(total_bytes - state->initial_offset,
state->size - state->initial_offset,
state->current_avg_rate);
state->size - state->initial_offset, state->current_avg_rate);
/*
* Bounds check, so we don't overrun the suffix buffer. This
@@ -907,20 +822,15 @@ static const char *pv__format(pvstate_t state,
* by time functions. */
struct tm time = *time_ptr;
(void) pv_snprintf(state->str_fineta,
PV_SIZEOF_STR_FINETA,
"%.16s ", _("ETA"));
(void) pv_snprintf(state->str_fineta, PV_SIZEOF_STR_FINETA, "%.16s ", _("ETA"));
strftime(state->str_fineta +
strlen(state->str_fineta),
PV_SIZEOF_STR_FINETA - 1 -
strlen(state->str_fineta), time_format,
&time);
PV_SIZEOF_STR_FINETA - 1 - strlen(state->str_fineta), time_format, &time);
}
if (!show_eta) {
unsigned int i;
for (i = 0; i < PV_SIZEOF_STR_FINETA
&& state->str_fineta[i] != '\0'; i++) {
for (i = 0; i < PV_SIZEOF_STR_FINETA && state->str_fineta[i] != '\0'; i++) {
state->str_fineta[i] = ' ';
}
}
@@ -936,11 +846,9 @@ static const char *pv__format(pvstate_t state,
if (state->format[segment].length < 0) {
continue;
} else if (state->format[segment].length > 0) {
static_portion_size +=
state->format[segment].length;
static_portion_size += state->format[segment].length;
} else {
static_portion_size +=
strlen(state->format[segment].string);
static_portion_size += strlen(state->format[segment].string);
}
}
@@ -960,56 +868,39 @@ static const char *pv__format(pvstate_t state,
state->percentage = 0;
if (state->percentage > 100000)
state->percentage = 100000;
(void) pv_snprintf(pct, sizeof(pct), "%2ld%%",
state->percentage);
(void) pv_snprintf(pct, sizeof(pct), "%2ld%%", state->percentage);
available_width =
state->width - static_portion_size -
strlen(pct) - 3;
available_width = state->width - static_portion_size - strlen(pct) - 3;
if (available_width < 0)
available_width = 0;
if (available_width >
(int) (PV_SIZEOF_STR_PROGRESS) - 16)
available_width =
PV_SIZEOF_STR_PROGRESS - 16;
if (available_width > (int) (PV_SIZEOF_STR_PROGRESS) - 16)
available_width = PV_SIZEOF_STR_PROGRESS - 16;
for (i = 0;
i <
(available_width * state->percentage) / 100 -
1; i++) {
for (i = 0; i < (available_width * state->percentage) / 100 - 1; i++) {
if (i < available_width)
pv_strlcat(state->str_progress,
"=",
PV_SIZEOF_STR_PROGRESS);
pv_strlcat(state->str_progress, "=", PV_SIZEOF_STR_PROGRESS);
}
if (i < available_width) {
pv_strlcat(state->str_progress, ">",
PV_SIZEOF_STR_PROGRESS);
pv_strlcat(state->str_progress, ">", PV_SIZEOF_STR_PROGRESS);
i++;
}
for (; i < available_width; i++) {
pv_strlcat(state->str_progress, " ",
PV_SIZEOF_STR_PROGRESS);
pv_strlcat(state->str_progress, " ", PV_SIZEOF_STR_PROGRESS);
}
pv_strlcat(state->str_progress, "] ",
PV_SIZEOF_STR_PROGRESS);
pv_strlcat(state->str_progress, pct,
PV_SIZEOF_STR_PROGRESS);
pv_strlcat(state->str_progress, "] ", PV_SIZEOF_STR_PROGRESS);
pv_strlcat(state->str_progress, pct, PV_SIZEOF_STR_PROGRESS);
} else {
int p = state->percentage;
available_width =
state->width - static_portion_size - 5;
available_width = state->width - static_portion_size - 5;
if (available_width < 0)
available_width = 0;
if (available_width >
(int) (PV_SIZEOF_STR_PROGRESS) - 16)
available_width =
PV_SIZEOF_STR_PROGRESS - 16;
if (available_width > (int) (PV_SIZEOF_STR_PROGRESS) - 16)
available_width = PV_SIZEOF_STR_PROGRESS - 16;
debug("available_width: %d", available_width);
@@ -1017,25 +908,19 @@ static const char *pv__format(pvstate_t state,
p = 200 - p;
for (i = 0; i < (available_width * p) / 100; i++) {
if (i < available_width)
pv_strlcat(state->str_progress,
" ",
PV_SIZEOF_STR_PROGRESS);
pv_strlcat(state->str_progress, " ", PV_SIZEOF_STR_PROGRESS);
}
pv_strlcat(state->str_progress, "<=>",
PV_SIZEOF_STR_PROGRESS);
pv_strlcat(state->str_progress, "<=>", PV_SIZEOF_STR_PROGRESS);
for (; i < available_width; i++) {
pv_strlcat(state->str_progress, " ",
PV_SIZEOF_STR_PROGRESS);
pv_strlcat(state->str_progress, " ", PV_SIZEOF_STR_PROGRESS);
}
pv_strlcat(state->str_progress, "]",
PV_SIZEOF_STR_PROGRESS);
pv_strlcat(state->str_progress, "]", PV_SIZEOF_STR_PROGRESS);
}
/*
* If the progress bar won't fit, drop it.
*/
if (strlen(state->str_progress) + static_portion_size >
state->width)
if (strlen(state->str_progress) + static_portion_size > state->width)
state->str_progress[0] = 0;
}
@@ -1050,8 +935,7 @@ static const char *pv__format(pvstate_t state,
if (state->format[segment].length > 0) {
segment_length = state->format[segment].length;
} else {
segment_length =
strlen(state->format[segment].string);
segment_length = strlen(state->format[segment].string);
}
/* Skip empty segments */
if (segment_length == 0)
@@ -1060,19 +944,14 @@ static const char *pv__format(pvstate_t state,
* Truncate segment if it would make the display string
* overflow the buffer
*/
if (segment_length + display_string_length >
state->display_buffer_size - 2)
segment_length =
state->display_buffer_size -
display_string_length - 2;
if (segment_length + display_string_length > state->display_buffer_size - 2)
segment_length = state->display_buffer_size - display_string_length - 2;
if (segment_length < 1)
break;
/* Skip segment if it would make the display too wide */
if (segment_length + display_string_length >
(int) (state->width))
if (segment_length + display_string_length > (int) (state->width))
break;
strncat(state->display_buffer,
state->format[segment].string, segment_length);
strncat(state->display_buffer, state->format[segment].string, segment_length);
display_string_length += segment_length;
}
@@ -1095,8 +974,7 @@ static const char *pv__format(pvstate_t state,
while (--spaces_to_add >= 0) {
spaces[spaces_to_add] = ' ';
}
pv_strlcat(state->display_buffer, spaces,
state->display_buffer_size);
pv_strlcat(state->display_buffer, spaces, state->display_buffer_size);
}
state->prev_width = state->width;
state->prev_length = output_length;
@@ -1116,8 +994,7 @@ static const char *pv__format(pvstate_t state,
*
* In line mode, "sl" and "tot" are in lines, not bytes.
*/
void pv_display(pvstate_t state, long double esec, long long sl,
long long tot)
void pv_display(pvstate_t state, long double esec, long long sl, long long tot)
{
const char *display;
@@ -1148,8 +1025,7 @@ void pv_display(pvstate_t state, long double esec, long long sl,
}
} else {
if (state->force || pv_in_foreground()) {
pv_write_retry(STDERR_FILENO, display,
strlen(display));
pv_write_retry(STDERR_FILENO, display, strlen(display));
pv_write_retry(STDERR_FILENO, "\r", 1);
state->display_visible = true;
}
+12 -31
View File
@@ -67,11 +67,9 @@ unsigned long long pv_calc_total_size(pvstate_t state)
}
if (rc != 0) {
pv_error(state, "%s: %s",
state->input_files[i], strerror(errno));
pv_error(state, "%s: %s", state->input_files[i], strerror(errno));
for (j = i; j < state->input_file_count - 1; j++) {
state->input_files[j] =
state->input_files[j + 1];
state->input_files[j] = state->input_files[j + 1];
}
state->input_file_count--;
i--;
@@ -93,9 +91,7 @@ unsigned long long pv_calc_total_size(pvstate_t state)
total += lseek(fd, 0, SEEK_END);
close(fd);
} else {
pv_error(state, "%s: %s",
state->input_files[i],
strerror(errno));
pv_error(state, "%s: %s", state->input_files[i], strerror(errno));
state->exit_status |= 2;
}
} else if (S_ISREG(sb.st_mode)) {
@@ -120,9 +116,7 @@ unsigned long long pv_calc_total_size(pvstate_t state)
total = lseek(STDOUT_FILENO, 0, SEEK_END);
if (lseek(STDOUT_FILENO, 0, SEEK_SET) != 0) {
pv_error(state, "%s: %s: %s", "(stdout)",
_
("failed to seek to start of output"),
strerror(errno));
_("failed to seek to start of output"), strerror(errno));
state->exit_status |= 2;
}
/*
@@ -165,8 +159,7 @@ unsigned long long pv_calc_total_size(pvstate_t state)
}
if (fd < 0) {
pv_error(state, "%s: %s", state->input_files[i],
strerror(errno));
pv_error(state, "%s: %s", state->input_files[i], strerror(errno));
total = 0;
state->exit_status |= 2;
return total;
@@ -178,9 +171,7 @@ unsigned long long pv_calc_total_size(pvstate_t state)
numread = read(fd, scanbuf, sizeof(scanbuf));
if (numread < 0) {
pv_error(state, "%s: %s",
state->input_files[i],
strerror(errno));
pv_error(state, "%s: %s", state->input_files[i], strerror(errno));
state->exit_status |= 2;
break;
} else if (0 == numread) {
@@ -216,9 +207,7 @@ int pv_next_file(pvstate_t state, int filenum, int oldfd)
if (oldfd > 0) {
if (close(oldfd)) {
pv_error(state, "%s: %s",
_("failed to close file"),
strerror(errno));
pv_error(state, "%s: %s", _("failed to close file"), strerror(errno));
state->exit_status |= 8;
return -1;
}
@@ -240,26 +229,21 @@ int pv_next_file(pvstate_t state, int filenum, int oldfd)
fd = open(state->input_files[filenum], O_RDONLY);
if (fd < 0) {
pv_error(state, "%s: %s: %s",
_("failed to read file"),
state->input_files[filenum],
strerror(errno));
_("failed to read file"), state->input_files[filenum], strerror(errno));
state->exit_status |= 2;
return -1;
}
}
if (fstat(fd, &isb)) {
pv_error(state, "%s: %s: %s",
_("failed to stat file"),
state->input_files[filenum], strerror(errno));
pv_error(state, "%s: %s: %s", _("failed to stat file"), state->input_files[filenum], strerror(errno));
close(fd);
state->exit_status |= 2;
return -1;
}
if (fstat(STDOUT_FILENO, &osb)) {
pv_error(state, "%s: %s",
_("failed to stat output file"), strerror(errno));
pv_error(state, "%s: %s", _("failed to stat output file"), strerror(errno));
close(fd);
state->exit_status |= 2;
return -1;
@@ -281,9 +265,7 @@ int pv_next_file(pvstate_t state, int filenum, int oldfd)
input_file_is_stdout = 0;
if (input_file_is_stdout) {
pv_error(state, "%s: %s",
_("input file is output file"),
state->input_files[filenum]);
pv_error(state, "%s: %s", _("input file is output file"), state->input_files[filenum]);
close(fd);
state->exit_status |= 4;
return -1;
@@ -297,8 +279,7 @@ int pv_next_file(pvstate_t state, int filenum, int oldfd)
/*
* Set or clear O_DIRECT on the file descriptor.
*/
fcntl(fd, F_SETFL,
(state->direct_io ? O_DIRECT : 0) | fcntl(fd, F_GETFL));
fcntl(fd, F_SETFL, (state->direct_io ? O_DIRECT : 0) | fcntl(fd, F_GETFL));
/*
* We don't clear direct_io_changed here, to avoid race conditions
* that could cause the input and output settings to differ.
+48 -114
View File
@@ -94,12 +94,9 @@ int pv_main_loop(pvstate_t state)
next_update.tv_usec = start_time.tv_usec;
if ((state->delay_start > 0)
&& (state->delay_start > state->interval)) {
pv_timeval_add_usec(&next_update,
(long) (1000000.0 *
state->delay_start));
pv_timeval_add_usec(&next_update, (long) (1000000.0 * state->delay_start));
} else {
pv_timeval_add_usec(&next_update,
(long) (1000000.0 * state->interval));
pv_timeval_add_usec(&next_update, (long) (1000000.0 * state->interval));
}
next_ratecheck.tv_sec = start_time.tv_sec;
@@ -121,9 +118,7 @@ int pv_main_loop(pvstate_t state)
/*
* Set or clear O_DIRECT on the output.
*/
fcntl(STDOUT_FILENO, F_SETFL,
(state->direct_io ? O_DIRECT : 0) | fcntl(STDOUT_FILENO,
F_GETFL));
fcntl(STDOUT_FILENO, F_SETFL, (state->direct_io ? O_DIRECT : 0) | fcntl(STDOUT_FILENO, F_GETFL));
state->direct_io_changed = false;
#endif /* O_DIRECT */
@@ -150,11 +145,9 @@ int pv_main_loop(pvstate_t state)
* Check for remote messages from -R every short while
*/
if ((cur_time.tv_sec > next_remotecheck.tv_sec)
|| (cur_time.tv_sec == next_remotecheck.tv_sec
&& cur_time.tv_usec >= next_remotecheck.tv_usec)) {
|| (cur_time.tv_sec == next_remotecheck.tv_sec && cur_time.tv_usec >= next_remotecheck.tv_usec)) {
pv_remote_check(state);
pv_timeval_add_usec(&next_remotecheck,
REMOTE_INTERVAL);
pv_timeval_add_usec(&next_remotecheck, REMOTE_INTERVAL);
}
if (state->pv_sig_abort)
@@ -163,22 +156,15 @@ int pv_main_loop(pvstate_t state)
if (state->rate_limit > 0) {
gettimeofday(&cur_time, NULL);
if ((cur_time.tv_sec > next_ratecheck.tv_sec)
|| (cur_time.tv_sec == next_ratecheck.tv_sec
&& cur_time.tv_usec >=
next_ratecheck.tv_usec)) {
|| (cur_time.tv_sec == next_ratecheck.tv_sec && cur_time.tv_usec >= next_ratecheck.tv_usec)) {
target +=
((long double) (state->rate_limit)) /
(long double) (1000000 /
RATE_GRANULARITY);
long double burstMax =
((long double) (state->rate_limit *
RATE_BURST_WINDOW));
((long double) (state->rate_limit)) / (long double) (1000000 / RATE_GRANULARITY);
long double burstMax = ((long double) (state->rate_limit * RATE_BURST_WINDOW));
if (target > burstMax) {
target = burstMax;
}
pv_timeval_add_usec(&next_ratecheck,
RATE_GRANULARITY);
pv_timeval_add_usec(&next_ratecheck, RATE_GRANULARITY);
}
cansend = target;
}
@@ -188,8 +174,7 @@ int pv_main_loop(pvstate_t state)
* try to write more than we're allowed to.
*/
if ((0 < state->size) && (state->stop_at_size)) {
if (((long) (state->size) <
(total_written + cansend))
if (((long) (state->size) < (total_written + cansend))
|| ((0 == cansend)
&& (0 == state->rate_limit))) {
cansend = state->size - total_written;
@@ -204,9 +189,7 @@ int pv_main_loop(pvstate_t state)
&& (0 >= cansend) && eof_in && eof_out) {
written = 0;
} else {
written =
pv_transfer(state, fd, &eof_in, &eof_out,
cansend, &lineswritten);
written = pv_transfer(state, fd, &eof_in, &eof_out, cansend, &lineswritten);
}
if (written < 0) {
@@ -286,32 +269,25 @@ int pv_main_loop(pvstate_t state)
next_update.tv_sec = start_time.tv_sec;
next_update.tv_usec = start_time.tv_usec;
pv_timeval_add_usec(&next_update,
(long) (1000000.0 *
state->interval));
pv_timeval_add_usec(&next_update, (long) (1000000.0 * state->interval));
}
if ((cur_time.tv_sec < next_update.tv_sec)
|| (cur_time.tv_sec == next_update.tv_sec
&& cur_time.tv_usec < next_update.tv_usec)) {
|| (cur_time.tv_sec == next_update.tv_sec && cur_time.tv_usec < next_update.tv_usec)) {
continue;
}
pv_timeval_add_usec(&next_update,
(long) (1000000.0 * state->interval));
pv_timeval_add_usec(&next_update, (long) (1000000.0 * state->interval));
if (next_update.tv_sec < cur_time.tv_sec) {
next_update.tv_sec = cur_time.tv_sec;
next_update.tv_usec = cur_time.tv_usec;
} else if (next_update.tv_sec == cur_time.tv_sec
&& next_update.tv_usec < cur_time.tv_usec) {
} else if (next_update.tv_sec == cur_time.tv_sec && next_update.tv_usec < cur_time.tv_usec) {
next_update.tv_usec = cur_time.tv_usec;
}
init_time.tv_sec =
start_time.tv_sec + state->pv_sig_toffset.tv_sec;
init_time.tv_usec =
start_time.tv_usec + state->pv_sig_toffset.tv_usec;
init_time.tv_sec = start_time.tv_sec + state->pv_sig_toffset.tv_sec;
init_time.tv_usec = start_time.tv_usec + state->pv_sig_toffset.tv_usec;
if (init_time.tv_usec >= 1000000) {
init_time.tv_sec++;
init_time.tv_usec -= 1000000;
@@ -322,8 +298,7 @@ int pv_main_loop(pvstate_t state)
}
elapsed = cur_time.tv_sec - init_time.tv_sec;
elapsed +=
(cur_time.tv_usec - init_time.tv_usec) / 1000000.0;
elapsed += (cur_time.tv_usec - init_time.tv_usec) / 1000000.0;
if (final_update)
since_last = -1;
@@ -404,8 +379,7 @@ int pv_watchfd_loop(pvstate_t state)
next_update.tv_sec = info.start_time.tv_sec;
next_update.tv_usec = info.start_time.tv_usec;
pv_timeval_add_usec(&next_update,
(long) (1000000.0 * state->interval));
pv_timeval_add_usec(&next_update, (long) (1000000.0 * state->interval));
next_remotecheck.tv_sec = info.start_time.tv_sec;
next_remotecheck.tv_usec = info.start_time.tv_usec;
@@ -420,11 +394,9 @@ int pv_watchfd_loop(pvstate_t state)
* Check for remote messages from -R every short while
*/
if ((cur_time.tv_sec > next_remotecheck.tv_sec)
|| (cur_time.tv_sec == next_remotecheck.tv_sec
&& cur_time.tv_usec >= next_remotecheck.tv_usec)) {
|| (cur_time.tv_sec == next_remotecheck.tv_sec && cur_time.tv_usec >= next_remotecheck.tv_usec)) {
pv_remote_check(state);
pv_timeval_add_usec(&next_remotecheck,
REMOTE_INTERVAL);
pv_timeval_add_usec(&next_remotecheck, REMOTE_INTERVAL);
}
if (state->pv_sig_abort)
@@ -451,8 +423,7 @@ int pv_watchfd_loop(pvstate_t state)
}
if ((cur_time.tv_sec < next_update.tv_sec)
|| (cur_time.tv_sec == next_update.tv_sec
&& cur_time.tv_usec < next_update.tv_usec)) {
|| (cur_time.tv_sec == next_update.tv_sec && cur_time.tv_usec < next_update.tv_usec)) {
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 50000;
@@ -460,22 +431,17 @@ int pv_watchfd_loop(pvstate_t state)
continue;
}
pv_timeval_add_usec(&next_update,
(long) (1000000.0 * state->interval));
pv_timeval_add_usec(&next_update, (long) (1000000.0 * state->interval));
if (next_update.tv_sec < cur_time.tv_sec) {
next_update.tv_sec = cur_time.tv_sec;
next_update.tv_usec = cur_time.tv_usec;
} else if (next_update.tv_sec == cur_time.tv_sec
&& next_update.tv_usec < cur_time.tv_usec) {
} else if (next_update.tv_sec == cur_time.tv_sec && next_update.tv_usec < cur_time.tv_usec) {
next_update.tv_usec = cur_time.tv_usec;
}
init_time.tv_sec =
info.start_time.tv_sec + state->pv_sig_toffset.tv_sec;
init_time.tv_usec =
info.start_time.tv_usec +
state->pv_sig_toffset.tv_usec;
init_time.tv_sec = info.start_time.tv_sec + state->pv_sig_toffset.tv_sec;
init_time.tv_usec = info.start_time.tv_usec + state->pv_sig_toffset.tv_usec;
if (init_time.tv_usec >= 1000000) {
init_time.tv_sec++;
init_time.tv_usec -= 1000000;
@@ -486,8 +452,7 @@ int pv_watchfd_loop(pvstate_t state)
}
elapsed = cur_time.tv_sec - init_time.tv_sec;
elapsed +=
(cur_time.tv_usec - init_time.tv_usec) / 1000000.0;
elapsed += (cur_time.tv_usec - init_time.tv_usec) / 1000000.0;
if (ended)
since_last = -1;
@@ -538,8 +503,7 @@ int pv_watchpid_loop(pvstate_t state)
* it's not there at the start.
*/
if (kill(state->watch_pid, 0) != 0) {
pv_error(state, "%s %u: %s",
_("pid"), state->watch_pid, strerror(errno));
pv_error(state, "%s %u: %s", _("pid"), state->watch_pid, strerror(errno));
state->exit_status |= 2;
return 2;
}
@@ -554,23 +518,15 @@ int pv_watchpid_loop(pvstate_t state)
* Make sure there's a format string, and then insert %N into it if
* it's not present.
*/
original_format_string =
state->format_string ? state->
format_string : state->default_format;
original_format_string = state->format_string ? state->format_string : state->default_format;
if (NULL == strstr(original_format_string, "%N")) {
(void) pv_snprintf(new_format_string,
sizeof(new_format_string), "%%N %s",
original_format_string);
(void) pv_snprintf(new_format_string, sizeof(new_format_string), "%%N %s", original_format_string);
} else {
(void) pv_snprintf(new_format_string,
sizeof(new_format_string), "%s",
original_format_string);
(void) pv_snprintf(new_format_string, sizeof(new_format_string), "%s", original_format_string);
}
new_format_string[sizeof(new_format_string) - 1] = '\0';
state_copy.format_string = NULL;
(void) pv_snprintf(state_copy.default_format,
PV_SIZEOF_DEFAULT_FORMAT,
"%.510s", new_format_string);
(void) pv_snprintf(state_copy.default_format, PV_SIZEOF_DEFAULT_FORMAT, "%.510s", new_format_string);
state_copy.default_format[PV_SIZEOF_DEFAULT_FORMAT - 1] = '\0';
/*
@@ -581,8 +537,7 @@ int pv_watchpid_loop(pvstate_t state)
next_update.tv_sec = cur_time.tv_sec;
next_update.tv_usec = cur_time.tv_usec;
pv_timeval_add_usec(&next_update,
(long) (1000000.0 * state->interval));
pv_timeval_add_usec(&next_update, (long) (1000000.0 * state->interval));
for (idx = 0; idx < FD_SETSIZE; idx++) {
fd_to_idx[idx] = -1;
@@ -600,9 +555,7 @@ int pv_watchpid_loop(pvstate_t state)
if (kill(state->watch_pid, 0) != 0) {
if (first_pass) {
pv_error(state, "%s %u: %s",
_("pid"), state->watch_pid,
strerror(errno));
pv_error(state, "%s %u: %s", _("pid"), state->watch_pid, strerror(errno));
state->exit_status |= 2;
if (NULL != info_array)
free(info_array);
@@ -614,8 +567,7 @@ int pv_watchpid_loop(pvstate_t state)
}
if ((cur_time.tv_sec < next_update.tv_sec)
|| (cur_time.tv_sec == next_update.tv_sec
&& cur_time.tv_usec < next_update.tv_usec)) {
|| (cur_time.tv_sec == next_update.tv_sec && cur_time.tv_usec < next_update.tv_usec)) {
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 50000;
@@ -623,14 +575,12 @@ int pv_watchpid_loop(pvstate_t state)
continue;
}
pv_timeval_add_usec(&next_update,
(long) (1000000.0 * state->interval));
pv_timeval_add_usec(&next_update, (long) (1000000.0 * state->interval));
if (next_update.tv_sec < cur_time.tv_sec) {
next_update.tv_sec = cur_time.tv_sec;
next_update.tv_usec = cur_time.tv_usec;
} else if (next_update.tv_sec == cur_time.tv_sec
&& next_update.tv_usec < cur_time.tv_usec) {
} else if (next_update.tv_sec == cur_time.tv_sec && next_update.tv_usec < cur_time.tv_usec) {
next_update.tv_usec = cur_time.tv_usec;
}
@@ -640,21 +590,16 @@ int pv_watchpid_loop(pvstate_t state)
for (idx = 0; idx < array_length; idx++) {
state_array[idx].width = state->width;
state_array[idx].height = state->height;
pv_watchpid_setname(state,
&(info_array[idx]));
pv_watchpid_setname(state, &(info_array[idx]));
state_array[idx].reparse_display = 1;
}
}
rc = pv_watchpid_scanfds(state, &state_copy,
state->watch_pid, &array_length,
&info_array, &state_array,
fd_to_idx);
state->watch_pid, &array_length, &info_array, &state_array, fd_to_idx);
if (rc != 0) {
if (first_pass) {
pv_error(state, "%s %u: %s",
_("pid"), state->watch_pid,
strerror(errno));
pv_error(state, "%s %u: %s", _("pid"), state->watch_pid, strerror(errno));
state->exit_status |= 2;
if (NULL != info_array)
free(info_array);
@@ -689,8 +634,7 @@ int pv_watchpid_loop(pvstate_t state)
if (pv_watchfd_changed(&(info_array[idx]))) {
fd_to_idx[fd] = -1;
info_array[idx].watch_pid = 0;
debug("%s %d: %s", "fd", fd,
"removing");
debug("%s %d: %s", "fd", fd, "removing");
}
continue;
}
@@ -699,8 +643,7 @@ int pv_watchpid_loop(pvstate_t state)
* Displayable fd - display, or remove if changed
*/
position_now =
pv_watchfd_position(&(info_array[idx]));
position_now = pv_watchfd_position(&(info_array[idx]));
if (position_now < 0) {
fd_to_idx[fd] = -1;
@@ -709,16 +652,11 @@ int pv_watchpid_loop(pvstate_t state)
continue;
}
since_last =
position_now - info_array[idx].position;
since_last = position_now - info_array[idx].position;
info_array[idx].position = position_now;
init_time.tv_sec =
info_array[idx].start_time.tv_sec +
state->pv_sig_toffset.tv_sec;
init_time.tv_usec =
info_array[idx].start_time.tv_usec +
state->pv_sig_toffset.tv_usec;
init_time.tv_sec = info_array[idx].start_time.tv_sec + state->pv_sig_toffset.tv_sec;
init_time.tv_usec = info_array[idx].start_time.tv_usec + state->pv_sig_toffset.tv_usec;
if (init_time.tv_usec >= 1000000) {
init_time.tv_sec++;
init_time.tv_usec -= 1000000;
@@ -729,20 +667,16 @@ int pv_watchpid_loop(pvstate_t state)
}
elapsed = cur_time.tv_sec - init_time.tv_sec;
elapsed +=
(cur_time.tv_usec -
init_time.tv_usec) / 1000000.0;
elapsed += (cur_time.tv_usec - init_time.tv_usec) / 1000000.0;
if (displayed_lines > 0) {
debug("%s", "adding newline");
pv_write_retry(STDERR_FILENO, "\n", 1);
}
debug("%s %d [%d]: %Lf / %Ld / %Ld", "fd", fd, idx,
elapsed, since_last, position_now);
debug("%s %d [%d]: %Lf / %Ld / %Ld", "fd", fd, idx, elapsed, since_last, position_now);
pv_display(&(state_array[idx]), elapsed,
since_last, position_now);
pv_display(&(state_array[idx]), elapsed, since_last, position_now);
displayed_lines++;
}
+1 -2
View File
@@ -52,8 +52,7 @@ unsigned long long pv_getnum_ull(const char *str)
for (; pv__isdigit(str[0]); str++) {
if (decdivisor < 10000) {
decimal = decimal * 10;
decimal +=
(unsigned long long) (str[0] - '0');
decimal += (unsigned long long) (str[0] - '0');
decdivisor = decdivisor * 10;
}
}
+8 -10
View File
@@ -31,7 +31,7 @@ static pvstate_t pv_sig_state = NULL;
* subsequent SIGCONT we can try writing to the terminal again, in case we
* get backgrounded and later get foregrounded again.
*/
static void pv_sig_ttou( __attribute__ ((unused))
static void pv_sig_ttou( __attribute__((unused))
int s)
{
int fd;
@@ -52,7 +52,7 @@ static void pv_sig_ttou( __attribute__ ((unused))
* Handle SIGTSTP (stop typed at tty) by storing the time the signal
* happened for later use by pv_sig_cont(), and then stopping the process.
*/
static void pv_sig_tstp( __attribute__ ((unused))
static void pv_sig_tstp( __attribute__((unused))
int s)
{
gettimeofday(&(pv_sig_state->pv_sig_tstp_time), NULL);
@@ -65,7 +65,7 @@ static void pv_sig_tstp( __attribute__ ((unused))
* last SIGTSTP to the elapsed time offset, and by trying to write to the
* terminal again (by replacing the /dev/null stderr with the old stderr).
*/
static void pv_sig_cont( __attribute__ ((unused))
static void pv_sig_cont( __attribute__((unused))
int s)
{
struct timeval tv;
@@ -85,10 +85,8 @@ static void pv_sig_cont( __attribute__ ((unused))
gettimeofday(&tv, NULL);
pv_sig_state->pv_sig_toffset.tv_sec +=
(tv.tv_sec - pv_sig_state->pv_sig_tstp_time.tv_sec);
pv_sig_state->pv_sig_toffset.tv_usec +=
(tv.tv_usec - pv_sig_state->pv_sig_tstp_time.tv_usec);
pv_sig_state->pv_sig_toffset.tv_sec += (tv.tv_sec - pv_sig_state->pv_sig_tstp_time.tv_sec);
pv_sig_state->pv_sig_toffset.tv_usec += (tv.tv_usec - pv_sig_state->pv_sig_tstp_time.tv_usec);
if (pv_sig_state->pv_sig_toffset.tv_usec >= 1000000) {
pv_sig_state->pv_sig_toffset.tv_sec++;
pv_sig_state->pv_sig_toffset.tv_usec -= 1000000;
@@ -120,7 +118,7 @@ static void pv_sig_cont( __attribute__ ((unused))
/*
* Handle SIGWINCH (window size changed) by setting a flag.
*/
static void pv_sig_winch( __attribute__ ((unused))
static void pv_sig_winch( __attribute__((unused))
int s)
{
pv_sig_state->pv_sig_newsize = 1;
@@ -130,7 +128,7 @@ static void pv_sig_winch( __attribute__ ((unused))
/*
* Handle termination signals by setting the abort flag.
*/
static void pv_sig_term( __attribute__ ((unused))
static void pv_sig_term( __attribute__((unused))
int s)
{
pv_sig_state->pv_sig_abort = 1;
@@ -222,7 +220,7 @@ void pv_sig_init(pvstate_t state)
/*
* Shut down signal handling.
*/
void pv_sig_fini( __attribute__ ((unused)) pvstate_t state)
void pv_sig_fini( __attribute__((unused)) pvstate_t state)
{
sigaction(SIGPIPE, &(pv_sig_state->pv_sig_old_sigpipe), NULL);
sigaction(SIGTTOU, &(pv_sig_state->pv_sig_old_sigttou), NULL);
+5 -11
View File
@@ -24,12 +24,10 @@ static void pv_alloc_history(pvstate_t state)
free(state->history);
state->history = NULL;
state->history =
calloc(state->history_len, sizeof(state->history[0]));
state->history = calloc(state->history_len, sizeof(state->history[0]));
if (NULL == state->history) {
fprintf(stderr, "%s: %s: %s\n", state->program_name,
_("history structure allocation failed"),
strerror(errno));
_("history structure allocation failed"), strerror(errno));
return;
}
@@ -114,9 +112,7 @@ void pv_state_free(pvstate_t state)
void pv_state_set_format(pvstate_t state, bool progress,
bool timer, bool eta,
bool fineta, bool rate,
bool average_rate, bool bytes,
bool bufpercent,
unsigned int lastwritten, const char *name)
bool average_rate, bool bytes, bool bufpercent, unsigned int lastwritten, const char *name)
{
#define PV_ADDFORMAT(x,y) if (x) { \
if (state->default_format[0] != '\0') \
@@ -217,8 +213,7 @@ void pv_state_rate_limit_set(pvstate_t state, unsigned long long val)
state->rate_limit = val;
};
void pv_state_target_buffer_size_set(pvstate_t state,
unsigned long long val)
void pv_state_target_buffer_size_set(pvstate_t state, unsigned long long val)
{
state->target_buffer_size = val;
};
@@ -286,8 +281,7 @@ void pv_state_average_rate_window_set(pvstate_t state, int val)
/*
* Set the array of input files.
*/
void pv_state_inputfiles(pvstate_t state, int input_file_count,
const char **input_files)
void pv_state_inputfiles(pvstate_t state, int input_file_count, const char **input_files)
{
state->input_file_count = input_file_count;
state->input_files = input_files;
+1 -2
View File
@@ -87,8 +87,7 @@ size_t pv_strlcat(char *dst, const char *src, size_t dstsize)
available = dstsize - dstlen;
if (available > 1)
(void) pv_snprintf(dst + dstlen, available, "%.*s",
available - 1, src);
(void) pv_snprintf(dst + dstlen, available, "%.*s", available - 1, src);
return dstlen + srclen;
#endif
+60 -150
View File
@@ -48,10 +48,7 @@ static ssize_t pv__transfer_read_repeated(int fd, void *buf, size_t count)
struct timeval now;
long elapsed_usec;
nread =
read(fd, buf,
count >
MAX_READ_AT_ONCE ? MAX_READ_AT_ONCE : count);
nread = read(fd, buf, count > MAX_READ_AT_ONCE ? MAX_READ_AT_ONCE : count);
if (nread < 0)
return nread;
@@ -63,13 +60,10 @@ static ssize_t pv__transfer_read_repeated(int fd, void *buf, size_t count)
return total_read;
gettimeofday(&now, NULL);
elapsed_usec =
1000000 * (now.tv_sec - start_time.tv_sec) +
(now.tv_usec - start_time.tv_usec);
elapsed_usec = 1000000 * (now.tv_sec - start_time.tv_sec) + (now.tv_usec - start_time.tv_usec);
if (elapsed_usec > TRANSFER_READ_TIMEOUT) {
debug("%s %d: %s (%ld %s)", "fd", fd,
"stopping read - timer expired",
elapsed_usec, "usec elapsed");
"stopping read - timer expired", elapsed_usec, "usec elapsed");
return total_read;
}
@@ -83,8 +77,7 @@ static ssize_t pv__transfer_read_repeated(int fd, void *buf, size_t count)
FD_SET(fd, &readfds);
debug("%s %d: %s (%ld %s, %ld %s)", "fd", fd,
"trying another read after partial buffer fill",
nread, "read", count, "remaining");
"trying another read after partial buffer fill", nread, "read", count, "remaining");
if (select(fd + 1, &readfds, NULL, NULL, &tv) < 1)
break;
@@ -108,8 +101,7 @@ static ssize_t pv__transfer_read_repeated(int fd, void *buf, size_t count)
* We stop retrying if the time elapsed since this function was entered
* reaches TRANSFER_WRITE_TIMEOUT microseconds.
*/
static ssize_t pv__transfer_write_repeated(int fd, void *buf, size_t count,
bool sync_after_write)
static ssize_t pv__transfer_write_repeated(int fd, void *buf, size_t count, bool sync_after_write)
{
struct timeval start_time;
ssize_t total_written;
@@ -124,8 +116,7 @@ static ssize_t pv__transfer_write_repeated(int fd, void *buf, size_t count,
long elapsed_usec;
size_t asked_to_write;
asked_to_write = count >
MAX_WRITE_AT_ONCE ? MAX_WRITE_AT_ONCE : count;
asked_to_write = count > MAX_WRITE_AT_ONCE ? MAX_WRITE_AT_ONCE : count;
nwritten = write(fd, buf, asked_to_write);
@@ -166,13 +157,10 @@ static ssize_t pv__transfer_write_repeated(int fd, void *buf, size_t count,
return total_written;
gettimeofday(&now, NULL);
elapsed_usec =
1000000 * (now.tv_sec - start_time.tv_sec) +
(now.tv_usec - start_time.tv_usec);
elapsed_usec = 1000000 * (now.tv_sec - start_time.tv_sec) + (now.tv_usec - start_time.tv_usec);
if (elapsed_usec > TRANSFER_WRITE_TIMEOUT) {
debug("%s %d: %s (%ld %s)", "fd", fd,
"stopping write - timer expired",
elapsed_usec, "usec elapsed");
"stopping write - timer expired", elapsed_usec, "usec elapsed");
return total_written;
}
@@ -183,23 +171,23 @@ static ssize_t pv__transfer_write_repeated(int fd, void *buf, size_t count,
* out of time - also on our gettimeofday() check.
*/
if (count > 0) {
# if 0 /* disabled after 1.6.0 - see comment above */
#if 0 /* disabled after 1.6.0 - see comment above */
fd_set writefds;
struct timeval tv;
# endif
#endif
debug("%s %d: %s (%ld %s, %ld %s)", "fd", fd,
"trying another write after partial buffer flush",
nwritten, "written", count, "remaining");
# if 0 /* disabled after 1.6.0 - see comment above */
#if 0 /* disabled after 1.6.0 - see comment above */
tv.tv_sec = 0;
tv.tv_usec = 0;
FD_ZERO(&writefds);
FD_SET(fd, &writefds);
if (select(fd + 1, NULL, &writefds, NULL, &tv) < 1)
break;
# endif
#endif
}
}
@@ -233,9 +221,7 @@ static ssize_t pv__transfer_write_repeated(int fd, void *buf, size_t count,
* sets *eof_in to 1. If all data in the buffer has been written at this
* point, then also sets *eof_out.
*/
static int pv__transfer_read(pvstate_t state, int fd,
int *eof_in, int *eof_out,
unsigned long long allowed)
static int pv__transfer_read(pvstate_t state, int fd, int *eof_in, int *eof_out, unsigned long long allowed)
{
bool do_not_skip_errors;
unsigned long bytes_can_read;
@@ -264,13 +250,11 @@ static int pv__transfer_read(pvstate_t state, int fd,
else
bytes_to_splice = bytes_can_read;
nread = splice(fd, NULL, STDOUT_FILENO, NULL,
bytes_to_splice, SPLICE_F_MORE);
nread = splice(fd, NULL, STDOUT_FILENO, NULL, bytes_to_splice, SPLICE_F_MORE);
state->splice_used = 1;
if ((nread < 0) && (EINVAL == errno)) {
debug("%s %d: %s", "fd", fd,
"splice failed with EINVAL - disabling");
debug("%s %d: %s", "fd", fd, "splice failed with EINVAL - disabling");
state->splice_failed_fd = fd;
state->splice_used = 0;
/*
@@ -278,7 +262,7 @@ static int pv__transfer_read(pvstate_t state, int fd,
*/
} else if (nread > 0) {
state->written = nread;
# ifdef HAVE_FDATASYNC
#ifdef HAVE_FDATASYNC
if (state->sync_after_write) {
/*
* Ignore non IO errors, such as EBADFD (bad file
@@ -295,7 +279,7 @@ static int pv__transfer_read(pvstate_t state, int fd,
do_not_skip_errors = true;
}
}
# endif /* HAVE_FDATASYNC */
#endif /* HAVE_FDATASYNC */
} else if ((-1 == nread) && (EAGAIN == errno)) {
/* nothing read yet - do nothing */
} else {
@@ -304,18 +288,10 @@ static int pv__transfer_read(pvstate_t state, int fd,
}
}
if (0 == state->splice_used) {
nread =
pv__transfer_read_repeated(fd,
state->transfer_buffer +
state->read_position,
bytes_can_read);
nread = pv__transfer_read_repeated(fd, state->transfer_buffer + state->read_position, bytes_can_read);
}
#else
nread =
pv__transfer_read_repeated(fd,
state->transfer_buffer +
state->read_position,
bytes_can_read);
nread = pv__transfer_read_repeated(fd, state->transfer_buffer + state->read_position, bytes_can_read);
#endif /* HAVE_SPLICE */
@@ -360,9 +336,7 @@ static int pv__transfer_read(pvstate_t state, int fd,
*/
if ((EINTR == errno) || (EAGAIN == errno)) {
struct timeval tv;
debug("%s %d: %s: %s", "fd", fd,
"transient error - waiting briefly",
strerror(errno));
debug("%s %d: %s: %s", "fd", fd, "transient error - waiting briefly", strerror(errno));
tv.tv_sec = 0;
tv.tv_usec = 10000;
select(0, NULL, NULL, NULL, &tv);
@@ -382,9 +356,7 @@ static int pv__transfer_read(pvstate_t state, int fd,
* reached the end of this file.
*/
if (do_not_skip_errors) {
pv_error(state, "%s: %s: %s",
state->current_file,
_("read failed"), strerror(errno));
pv_error(state, "%s: %s: %s", state->current_file, _("read failed"), strerror(errno));
*eof_in = 1;
if (state->write_position >= state->read_position) {
*eof_out = 1;
@@ -399,11 +371,7 @@ static int pv__transfer_read(pvstate_t state, int fd,
amount_skipped = -1;
if (!state->read_error_warning_shown) {
pv_error(state, "%s: %s: %s",
state->current_file,
_
("warning: read errors detected"),
strerror(errno));
pv_error(state, "%s: %s: %s", state->current_file, _("warning: read errors detected"), strerror(errno));
state->read_error_warning_shown = 1;
}
@@ -415,9 +383,7 @@ static int pv__transfer_read(pvstate_t state, int fd,
* of the file.
*/
if (0 > orig_offset) {
pv_error(state, "%s: %s: %s",
state->current_file,
_("file is not seekable"), strerror(errno));
pv_error(state, "%s: %s: %s", state->current_file, _("file is not seekable"), strerror(errno));
*eof_in = 1;
if (state->write_position >= state->read_position) {
*eof_out = 1;
@@ -460,8 +426,7 @@ static int pv__transfer_read(pvstate_t state, int fd,
*/
if (skip_offset < 0) {
amount_to_skip = 1;
skip_offset =
lseek(fd, orig_offset + amount_to_skip, SEEK_SET);
skip_offset = lseek(fd, orig_offset + amount_to_skip, SEEK_SET);
}
if (skip_offset < 0) {
@@ -477,11 +442,7 @@ static int pv__transfer_read(pvstate_t state, int fd,
*/
if (EINVAL != errno) {
pv_error(state,
"%s: %s: %s",
state->current_file,
_
("failed to seek past error"),
strerror(errno));
"%s: %s: %s", state->current_file, _("failed to seek past error"), strerror(errno));
}
} else {
amount_skipped = skip_offset - orig_offset;
@@ -492,16 +453,12 @@ static int pv__transfer_read(pvstate_t state, int fd,
* of the transfer buffer, and update the buffer position.
*/
if (amount_skipped > 0) {
memset(state->transfer_buffer +
state->read_position, 0, amount_skipped);
memset(state->transfer_buffer + state->read_position, 0, amount_skipped);
state->read_position += amount_skipped;
if (state->skip_errors < 2) {
pv_error(state, "%s: %s: %ld - %ld (%ld %s)",
state->current_file,
_
("skipped past read error"),
orig_offset,
skip_offset, amount_skipped, _("B"));
_("skipped past read error"), orig_offset, skip_offset, amount_skipped, _("B"));
}
} else {
/*
@@ -530,9 +487,7 @@ static int pv__transfer_read(pvstate_t state, int fd,
* On error, sets *eof_out to 1, sets state->written to -1, and updates
* state->exit_status.
*/
static int pv__transfer_write(pvstate_t state,
int *eof_in, int *eof_out,
long *lineswritten)
static int pv__transfer_write(pvstate_t state, int *eof_in, int *eof_out, long *lineswritten)
{
ssize_t nwritten;
@@ -541,9 +496,7 @@ static int pv__transfer_write(pvstate_t state,
nwritten = pv__transfer_write_repeated(STDOUT_FILENO,
state->transfer_buffer +
state->write_position,
state->to_write,
state->sync_after_write);
state->write_position, state->to_write, state->sync_after_write);
alarm(0);
@@ -565,33 +518,25 @@ static int pv__transfer_write(pvstate_t state,
char *ptr;
long lines = 0;
save =
state->transfer_buffer[state->write_position +
nwritten];
state->transfer_buffer[state->write_position +
nwritten] = 0;
ptr =
(char *) (state->transfer_buffer +
state->write_position - 1);
save = state->transfer_buffer[state->write_position + nwritten];
state->transfer_buffer[state->write_position + nwritten] = 0;
ptr = (char *) (state->transfer_buffer + state->write_position - 1);
if (state->null) {
for (ptr++;
ptr -
(char *) state->transfer_buffer -
state->write_position <
(size_t) nwritten; ptr++) {
state->write_position < (size_t) nwritten; ptr++) {
if (*ptr == '\0')
++lines;
}
} else {
while ((ptr =
strchr((char *) (ptr + 1), '\n')))
while ((ptr = strchr((char *) (ptr + 1), '\n')))
++lines;
}
*lineswritten += lines;
state->transfer_buffer[state->write_position +
nwritten] = save;
state->transfer_buffer[state->write_position + nwritten] = save;
}
state->write_position += nwritten;
@@ -607,20 +552,16 @@ static int pv__transfer_write(pvstate_t state,
new_portion_length = nwritten;
if (new_portion_length > state->lastoutput_length)
new_portion_length =
state->lastoutput_length;
new_portion_length = state->lastoutput_length;
old_portion_length =
state->lastoutput_length - new_portion_length;
old_portion_length = state->lastoutput_length - new_portion_length;
/*
* Make room for the new portion.
*/
if (old_portion_length > 0) {
memmove(state->lastoutput_buffer,
state->lastoutput_buffer +
new_portion_length,
old_portion_length);
state->lastoutput_buffer + new_portion_length, old_portion_length);
}
/*
@@ -628,9 +569,7 @@ static int pv__transfer_write(pvstate_t state,
*/
memcpy(state->lastoutput_buffer +
old_portion_length,
state->transfer_buffer +
state->write_position - new_portion_length,
new_portion_length);
state->transfer_buffer + state->write_position - new_portion_length, new_portion_length);
}
/*
@@ -696,8 +635,7 @@ static int pv__transfer_write(pvstate_t state,
*
* Returns NULL on complete allocation failure.
*/
static unsigned char *pv__allocate_aligned_buffer(int fd,
size_t target_size)
static unsigned char *pv__allocate_aligned_buffer(int fd, size_t target_size)
{
unsigned char *newptr;
@@ -707,11 +645,11 @@ static unsigned char *pv__allocate_aligned_buffer(int fd,
input_alignment = fd >= 0 ? fpathconf(fd, _PC_REC_XFER_ALIGN) : -1;
output_alignment = fpathconf(STDOUT_FILENO, _PC_REC_XFER_ALIGN);
# if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
#if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
min_alignment = sysconf(_SC_PAGESIZE);
# else /* ! defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE) */
#else /* ! defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE) */
min_alignment = 8192;
# endif /* defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE) */
#endif /* defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE) */
if (input_alignment > output_alignment) {
required_alignment = input_alignment;
@@ -728,9 +666,7 @@ static unsigned char *pv__allocate_aligned_buffer(int fd,
required_alignment = min_alignment;
}
if (0 !=
posix_memalign((void **) (&newptr), required_alignment,
target_size)) {
if (0 != posix_memalign((void **) (&newptr), required_alignment, target_size)) {
newptr = (unsigned char *) malloc(target_size);
}
#else /* ! defined(HAVE_FPATHCONF) && defined(HAVE_POSIX_MEMALIGN) && defined(_PC_REC_XFER_ALIGN) */
@@ -752,8 +688,7 @@ static unsigned char *pv__allocate_aligned_buffer(int fd,
* state->exit_status is updated). In line mode, the number of lines written
* will be put into *lineswritten.
*/
long pv_transfer(pvstate_t state, int fd, int *eof_in, int *eof_out,
unsigned long long allowed, long *lineswritten)
long pv_transfer(pvstate_t state, int fd, int *eof_in, int *eof_out, unsigned long long allowed, long *lineswritten)
{
struct timeval tv;
fd_set readfds;
@@ -771,14 +706,11 @@ long pv_transfer(pvstate_t state, int fd, int *eof_in, int *eof_out,
*/
if (state->direct_io_changed) {
if (!(*eof_in)) {
fcntl(fd, F_SETFL,
(state->direct_io ? O_DIRECT : 0) | fcntl(fd,
F_GETFL));
fcntl(fd, F_SETFL, (state->direct_io ? O_DIRECT : 0) | fcntl(fd, F_GETFL));
}
if (!(*eof_out)) {
fcntl(STDOUT_FILENO, F_SETFL,
(state->direct_io ? O_DIRECT : 0) |
fcntl(STDOUT_FILENO, F_GETFL));
(state->direct_io ? O_DIRECT : 0) | fcntl(STDOUT_FILENO, F_GETFL));
}
state->direct_io_changed = false;
}
@@ -799,14 +731,9 @@ long pv_transfer(pvstate_t state, int fd, int *eof_in, int *eof_out,
* (important if using O_DIRECT).
*/
if (NULL == state->transfer_buffer) {
state->transfer_buffer =
pv__allocate_aligned_buffer(fd,
state->target_buffer_size +
32);
state->transfer_buffer = pv__allocate_aligned_buffer(fd, state->target_buffer_size + 32);
if (NULL == state->transfer_buffer) {
pv_error(state, "%s: %s",
_("buffer allocation failed"),
strerror(errno));
pv_error(state, "%s: %s", _("buffer allocation failed"), strerror(errno));
state->exit_status |= 64;
return -1;
}
@@ -822,10 +749,7 @@ long pv_transfer(pvstate_t state, int fd, int *eof_in, int *eof_out,
*/
if (state->buffer_size < state->target_buffer_size) {
unsigned char *newptr;
newptr =
pv__allocate_aligned_buffer(fd,
state->target_buffer_size +
32);
newptr = pv__allocate_aligned_buffer(fd, state->target_buffer_size + 32);
if (NULL == newptr) {
/*
* Reset target if realloc failed so we don't keep
@@ -834,15 +758,13 @@ long pv_transfer(pvstate_t state, int fd, int *eof_in, int *eof_out,
debug("realloc: %s", strerror(errno));
state->target_buffer_size = state->buffer_size;
} else {
debug("%s: %ld", "buffer resized",
state->buffer_size);
debug("%s: %ld", "buffer resized", state->buffer_size);
/*
* Copy the old buffer contents into the new buffer,
* and free the old one.
*/
if (state->buffer_size > 0)
memcpy(newptr, state->transfer_buffer,
state->buffer_size);
memcpy(newptr, state->transfer_buffer, state->buffer_size);
free(state->transfer_buffer);
state->transfer_buffer = newptr;
state->buffer_size = state->target_buffer_size;
@@ -908,9 +830,7 @@ long pv_transfer(pvstate_t state, int fd, int *eof_in, int *eof_out,
/*
* Any other error is a problem and we must report back.
*/
pv_error(state, "%s: %s: %d: %s",
state->current_file,
_("select call failed"), n, strerror(errno));
pv_error(state, "%s: %s: %d: %s", state->current_file, _("select call failed"), n, strerror(errno));
state->exit_status |= 16;
@@ -926,8 +846,7 @@ long pv_transfer(pvstate_t state, int fd, int *eof_in, int *eof_out,
* NB this can update state->written because of splice().
*/
if (FD_ISSET(fd, &readfds)) {
if (pv__transfer_read
(state, fd, eof_in, eof_out, allowed) == 0)
if (pv__transfer_read(state, fd, eof_in, eof_out, allowed) == 0)
return 0;
}
@@ -943,18 +862,12 @@ long pv_transfer(pvstate_t state, int fd, int *eof_in, int *eof_out,
char *start;
char *end;
save =
state->transfer_buffer[state->write_position +
state->to_write];
state->transfer_buffer[state->write_position +
state->to_write] = 0;
save = state->transfer_buffer[state->write_position + state->to_write];
state->transfer_buffer[state->write_position + state->to_write] = 0;
start =
(char *) (state->transfer_buffer +
state->write_position);
start = (char *) (state->transfer_buffer + state->write_position);
end = strrchr(start, '\n');
state->transfer_buffer[state->write_position +
state->to_write] = save;
state->transfer_buffer[state->write_position + state->to_write] = save;
if (end != NULL) {
state->to_write = (end - start) + 1;
@@ -972,8 +885,7 @@ long pv_transfer(pvstate_t state, int fd, int *eof_in, int *eof_out,
#endif /* HAVE_SPLICE */
&& (state->read_position > state->write_position)
&& (state->to_write > 0)) {
if (pv__transfer_write
(state, eof_in, eof_out, lineswritten) == 0)
if (pv__transfer_write(state, eof_in, eof_out, lineswritten) == 0)
return 0;
}
#ifdef MAXIMISE_BUFFER_FILL
@@ -985,9 +897,7 @@ long pv_transfer(pvstate_t state, int fd, int *eof_in, int *eof_out,
if (state->write_position < state->read_position) {
memmove(state->transfer_buffer,
state->transfer_buffer +
state->write_position,
state->read_position -
state->write_position);
state->write_position, state->read_position - state->write_position);
state->read_position -= state->write_position;
state->write_position = 0;
} else {
+33 -91
View File
@@ -70,9 +70,7 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, int automatic)
if (kill(info->watch_pid, 0) != 0) {
if (!automatic)
pv_error(state, "%s %u: %s",
_("pid"),
info->watch_pid, strerror(errno));
pv_error(state, "%s %u: %s", _("pid"), info->watch_pid, strerror(errno));
return 1;
}
@@ -82,14 +80,11 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, int automatic)
PROC_PIDFDVNODEPATHINFO_SIZE);
if (size != PROC_PIDFDVNODEPATHINFO_SIZE) {
pv_error(state, "%s %u: %s %d: %s",
_("pid"),
info->watch_pid,
_("fd"), info->watch_fd, strerror(errno));
_("pid"), info->watch_pid, _("fd"), info->watch_fd, strerror(errno));
return 3;
}
strlcpy(info->file_fdpath, vnodeInfo.pvip.vip_path,
PV_SIZEOF_FILE_FDPATH);
strlcpy(info->file_fdpath, vnodeInfo.pvip.vip_path, PV_SIZEOF_FILE_FDPATH);
info->size = 0;
@@ -97,10 +92,7 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, int automatic)
if (!automatic)
pv_error(state, "%s %u: %s %d: %s: %s",
_("pid"),
info->watch_pid,
_("fd"),
info->watch_fd, info->file_fdpath,
strerror(errno));
info->watch_pid, _("fd"), info->watch_fd, info->file_fdpath, strerror(errno));
return 3;
}
@@ -109,10 +101,7 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, int automatic)
pv_error(state, "%s %u: %s %d: %s: %s",
_("pid"),
info->watch_pid,
_("fd"),
info->watch_fd,
info->file_fdpath,
_("not a regular file or block device"));
_("fd"), info->watch_fd, info->file_fdpath, _("not a regular file or block device"));
return 4;
}
@@ -147,27 +136,18 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, int automatic)
if (kill(info->watch_pid, 0) != 0) {
if (!automatic)
pv_error(state, "%s %u: %s",
_("pid"),
info->watch_pid, strerror(errno));
pv_error(state, "%s %u: %s", _("pid"), info->watch_pid, strerror(errno));
return 1;
}
(void) pv_snprintf(info->file_fdinfo, PV_SIZEOF_FILE_FDINFO,
"/proc/%u/fdinfo/%d", info->watch_pid,
info->watch_fd);
(void) pv_snprintf(info->file_fd, PV_SIZEOF_FILE_FD,
"/proc/%u/fd/%d", info->watch_pid,
info->watch_fd);
"/proc/%u/fdinfo/%d", info->watch_pid, info->watch_fd);
(void) pv_snprintf(info->file_fd, PV_SIZEOF_FILE_FD, "/proc/%u/fd/%d", info->watch_pid, info->watch_fd);
memset(info->file_fdpath, 0, PV_SIZEOF_FILE_FDPATH);
if (readlink
(info->file_fd, info->file_fdpath,
PV_SIZEOF_FILE_FDPATH - 1) < 0) {
if (readlink(info->file_fd, info->file_fdpath, PV_SIZEOF_FILE_FDPATH - 1) < 0) {
if (!automatic)
pv_error(state, "%s %u: %s %d: %s",
_("pid"),
info->watch_pid,
_("fd"), info->watch_fd, strerror(errno));
_("pid"), info->watch_pid, _("fd"), info->watch_fd, strerror(errno));
return 2;
}
@@ -176,10 +156,7 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, int automatic)
if (!automatic)
pv_error(state, "%s %u: %s %d: %s: %s",
_("pid"),
info->watch_pid,
_("fd"),
info->watch_fd, info->file_fdpath,
strerror(errno));
info->watch_pid, _("fd"), info->watch_fd, info->file_fdpath, strerror(errno));
return 3;
}
@@ -191,10 +168,7 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, int automatic)
pv_error(state, "%s %u: %s %d: %s: %s",
_("pid"),
info->watch_pid,
_("fd"),
info->watch_fd,
info->file_fdpath,
_("not a regular file or block device"));
_("fd"), info->watch_fd, info->file_fdpath, _("not a regular file or block device"));
return ret;
}
@@ -272,13 +246,11 @@ long long pv_watchfd_position(pvwatchfd_t info)
#ifdef __APPLE__
static int pidfds(pvstate_t state, unsigned int pid,
struct proc_fdinfo **fds, int *count)
static int pidfds(pvstate_t state, unsigned int pid, struct proc_fdinfo **fds, int *count)
{
int size_needed = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, 0, 0);
if (size_needed == -1) {
pv_error(state, "%s: unable to list pid fds: %s", _("pid"),
strerror(errno));
pv_error(state, "%s: unable to list pid fds: %s", _("pid"), strerror(errno));
return -1;
}
@@ -286,8 +258,7 @@ static int pidfds(pvstate_t state, unsigned int pid,
*fds = (struct proc_fdinfo *) malloc(size_needed);
if (*fds == NULL) {
pv_error(state, "%s: alloc failed: %s", _("pid"),
strerror(errno));
pv_error(state, "%s: alloc failed: %s", _("pid"), strerror(errno));
return -1;
}
@@ -306,8 +277,7 @@ static int pidfds(pvstate_t state, unsigned int pid,
*/
int pv_watchpid_scanfds(pvstate_t state, pvstate_t pristine,
unsigned int watch_pid, int *array_length_ptr,
pvwatchfd_t * info_array_ptr,
pvstate_t * state_array_ptr, int *fd_to_idx)
pvwatchfd_t * info_array_ptr, pvstate_t * state_array_ptr, int *fd_to_idx)
{
char fd_dir[512] = { 0, };
int array_length = 0;
@@ -326,8 +296,7 @@ int pv_watchpid_scanfds(pvstate_t state, pvstate_t pristine,
DIR *dptr;
struct dirent *d;
(void) pv_snprintf(fd_dir, sizeof(fd_dir), "/proc/%u/fd",
watch_pid);
(void) pv_snprintf(fd_dir, sizeof(fd_dir), "/proc/%u/fd", watch_pid);
dptr = opendir(fd_dir);
if (NULL == dptr)
@@ -389,14 +358,9 @@ int pv_watchpid_scanfds(pvstate_t state, pvstate_t pristine,
use_idx = array_length - 1;
if (NULL == info_array) {
new_info_array =
malloc(array_length *
sizeof(*info_array));
new_info_array = malloc(array_length * sizeof(*info_array));
} else {
new_info_array =
realloc(info_array,
array_length *
sizeof(*info_array));
new_info_array = realloc(info_array, array_length * sizeof(*info_array));
}
if (NULL == new_info_array)
return 2;
@@ -405,14 +369,9 @@ int pv_watchpid_scanfds(pvstate_t state, pvstate_t pristine,
info_array[use_idx].watch_pid = 0;
if (NULL == state_array) {
new_state_array =
malloc(array_length *
sizeof(*state_array));
new_state_array = malloc(array_length * sizeof(*state_array));
} else {
new_state_array =
realloc(state_array,
array_length *
sizeof(*state_array));
new_state_array = realloc(state_array, array_length * sizeof(*state_array));
}
if (NULL == new_state_array)
return 2;
@@ -421,10 +380,8 @@ int pv_watchpid_scanfds(pvstate_t state, pvstate_t pristine,
*array_length_ptr = array_length;
for (check_idx = 0; check_idx < array_length;
check_idx++) {
state_array[check_idx].name =
info_array[check_idx].display_name;
for (check_idx = 0; check_idx < array_length; check_idx++) {
state_array[check_idx].name = info_array[check_idx].display_name;
state_array[check_idx].reparse_display = 1;
}
}
@@ -434,10 +391,8 @@ int pv_watchpid_scanfds(pvstate_t state, pvstate_t pristine,
/*
* Initialise the details of this new entry.
*/
memcpy(&(state_array[use_idx]), pristine,
sizeof(*pristine));
memset(&(info_array[use_idx]), 0,
sizeof(info_array[use_idx]));
memcpy(&(state_array[use_idx]), pristine, sizeof(*pristine));
memset(&(info_array[use_idx]), 0, sizeof(info_array[use_idx]));
info_array[use_idx].watch_pid = watch_pid;
info_array[use_idx].watch_fd = fd;
@@ -453,9 +408,7 @@ int pv_watchpid_scanfds(pvstate_t state, pvstate_t pristine,
*/
if ((rc != 0) && (rc != 4)) {
info_array[use_idx].watch_pid = 0;
debug("%s %d: %s: %d", "fd", fd,
"lookup failed - marking slot for re-use",
use_idx);
debug("%s %d: %s: %d", "fd", fd, "lookup failed - marking slot for re-use", use_idx);
continue;
}
@@ -466,18 +419,14 @@ int pv_watchpid_scanfds(pvstate_t state, pvstate_t pristine,
* show it.
*/
if (rc != 0) {
debug("%s %d: %s", "fd", fd,
"marking as not displayable");
debug("%s %d: %s", "fd", fd, "marking as not displayable");
info_array[use_idx].watch_fd = -1;
}
state_array[use_idx].size = info_array[use_idx].size;
if (state_array[use_idx].size < 1) {
char *fmt;
while (NULL !=
(fmt =
strstr(state_array[use_idx].default_format,
"%e"))) {
while (NULL != (fmt = strstr(state_array[use_idx].default_format, "%e"))) {
debug("%s", "zero size - removing ETA");
/* strlen-1 here to include trailing NUL */
memmove(fmt, fmt + 2, strlen(fmt) - 1);
@@ -485,8 +434,7 @@ int pv_watchpid_scanfds(pvstate_t state, pvstate_t pristine,
}
}
state_array[use_idx].name =
info_array[use_idx].display_name;
state_array[use_idx].name = info_array[use_idx].display_name;
pv_watchpid_setname(state, &(info_array[use_idx]));
@@ -532,8 +480,7 @@ void pv_watchpid_setname(pvstate_t state, pvwatchfd_t info)
path_length = strlen(info->file_fdpath);
cwd_length = strlen(state->cwd);
if (cwd_length > 0 && path_length > cwd_length) {
if (0 ==
strncmp(info->file_fdpath, state->cwd, cwd_length)) {
if (0 == strncmp(info->file_fdpath, state->cwd, cwd_length)) {
file_fdpath += cwd_length + 1;
path_length -= cwd_length + 1;
}
@@ -542,9 +489,7 @@ void pv_watchpid_setname(pvstate_t state, pvwatchfd_t info)
max_display_length = (state->width / 2) - 6;
if (max_display_length >= path_length) {
(void) pv_snprintf(info->display_name,
PV_SIZEOF_DISPLAY_NAME,
"%4d:%.498s", info->watch_fd,
file_fdpath);
PV_SIZEOF_DISPLAY_NAME, "%4d:%.498s", info->watch_fd, file_fdpath);
} else {
int prefix_length, suffix_length;
@@ -555,13 +500,10 @@ void pv_watchpid_setname(pvstate_t state, pvwatchfd_t info)
PV_SIZEOF_DISPLAY_NAME,
"%4d:%.*s...%.*s",
info->watch_fd, prefix_length,
file_fdpath, suffix_length,
file_fdpath + path_length -
suffix_length);
file_fdpath, suffix_length, file_fdpath + path_length - suffix_length);
}
debug("%s: %d: [%s]", "set name for fd", info->watch_fd,
info->display_name);
debug("%s: %d: [%s]", "set name for fd", info->watch_fd, info->display_name);
}
/* EOF */