888 Commits
Author SHA1 Message Date
Andrew Wood e4f8493ffe Note the addition of an empty Romanian message catalogue. 2026-08-17 21:30:07 +01:00
Andrew Wood 687eaa0eb5 Add an empty Romanian message catalogue. 2026-08-17 21:29:14 +01:00
Andrew Wood 011d93c524 Merge in the supplied Russian translations. 2026-08-17 21:21:04 +01:00
Andrew Wood 97f0f5726c Merge in changes from ldm on translate.codeberg.org. 2026-08-12 20:27:12 +01:00
Andrew Wood 9c546dfd05 Update the translation count. 2026-08-04 21:11:40 +01:00
Andrew Wood 8941548ddc Note the translations that are to be merged. 2026-08-03 21:53:45 +01:00
Andrew Wood 179d480020 Datestamp update. 2026-08-01 19:59:48 +01:00
Andrew Wood 4092a164d8 Note the Italian translations. 2026-08-01 19:47:26 +01:00
Andrew Wood ca7c29ab8d Complete the first draft of the Italian translations. 2026-08-01 19:37:05 +01:00
Andrew Wood e4a9a3621f Translate the help for the new --conemu option. 2026-08-01 19:36:32 +01:00
Andrew Wood f1b7d5ddbe Partial draft of Italian translations based on libretranslate and on it.po from coreutils. 2026-08-01 16:53:40 +01:00
Andrew Wood 78fae360f7 Add new strings for --conemu. 2026-08-01 14:53:42 +01:00
Andrew Wood cb29deed54 Note the new --conemu option to go with the format string. 2026-08-01 14:52:25 +01:00
Andrew Wood 390cf01ce1 Add option -9 / --conemu to switch on OSC 9;4 sequences without having to use a custom --format string (#202). 2026-08-01 14:51:15 +01:00
Andrew Wood 7387b80843 Added empty Italian message catalogue as requested. 2026-08-01 14:01:54 +01:00
Andrew Wood c6b71ecfe1 Line number updates. 2026-08-01 14:01:35 +01:00
Andrew Wood 1422edeb6a New format string "%{progress-conemu}" to emit OSC 9;4 (ConEmu progress bar) codes (#202). 2026-07-30 23:04:53 +01:00
Andrew Wood 7c57fb08ad Note and acknowledge PR #201. 2026-06-14 20:45:25 +01:00
Andrew Wood 88a304dc16 Merge pull request 'Fix resetting fd counter to -1' (#201) from dirkmueller/pv:main into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/201
2026-06-14 21:36:41 +02:00
Dirk Müller 411808c680 Fix resetting fd counter to -1
Standard output corresponds to file descriptor `1` (`STDOUT_FILENO`).
Since the closed file descriptor variable is set to `1` (which is not
`-1`), any subsequent checks using `if (-1 != x)` will evaluate to true.
If `close_if_open` is called again on the same variable, or if error
cleanup code triggers redundant closures, it executes `close(1)`,
closing the standard output descriptor of the process
2026-06-14 21:05:11 +02:00
Andrew Wood 1fbd9b56a3 Commit to release date. 2026-06-11 22:05:37 +01:00
Andrew Wood bbfc794852 Datestamp update. 2026-06-11 22:02:55 +01:00
Andrew Wood 65edd8ff3a Add the missing new file. 2026-06-11 22:02:30 +01:00
Andrew Wood 5e8d201571 Link to the issue in which the benchmark script was introduced. 2026-06-10 22:56:44 +01:00
Andrew Wood 7523111d67 Message line number updates. 2026-06-10 21:28:26 +01:00
Andrew Wood d4a0d4ffdd Document the benchmark script. 2026-06-09 23:26:30 +01:00
Andrew Wood aeecd914cf Report the filename and then the error, the same as all other messages. 2026-06-08 21:56:00 +01:00
Andrew Wood 1190e70085 Report the system error message along with the syscall. 2026-06-08 21:50:32 +01:00
Andrew Wood 34ee909c59 Minor wording correction. 2026-06-08 21:33:21 +01:00
Andrew Wood ed14b56a7c Remove leftover "elapsed" file reference. 2026-06-07 20:38:51 +01:00
Andrew Wood ca7829b996 End the last command in the sed function with a semicolon to fix breakage on OpenBSD. 2026-06-07 20:35:21 +01:00
Andrew Wood 1c99a3820b Eliminate "\t" from sed substitutions. 2026-06-07 20:30:20 +01:00
Andrew Wood 9258cee615 Don't rely on "\n" substituting a newline in a sed replacement - doesn't work on OpenBSD sed. 2026-06-07 00:40:31 +01:00
Andrew Wood c427c367c1 Add alternative sorting for systems without "sort -V". 2026-06-07 00:28:11 +01:00
Andrew Wood f58ad83c95 Try to use "-r" with cksum since on OpenBSD that gives the hash first. 2026-06-07 00:10:19 +01:00
Andrew Wood 05f9adade5 Fall back to "cksum -a md5" if "md5sum" is not available. 2026-06-07 00:04:19 +01:00
Andrew Wood b29da37462 Use a maximum of 3/4 of the space in the temporary directory, to avoid the "quota exceeded" errors on /dev/shm seen on some OSes during testing. 2026-06-06 19:57:39 +01:00
Andrew Wood 827614dd66 Note the timer addition to splice (and copy_file_range) to match what happens with a write. 2026-06-06 00:52:37 +01:00
Andrew Wood d075ddf1ed Add timed signal interruption to the read side as well as the write, so that a non-write transfer method like splice or copy_file_range will still get interrupted if it takes too long. 2026-06-05 23:30:49 +01:00
Andrew Wood 5971d622bd Remove the TODO after testing confirmed that ENOSPC in copy_file_range causes fallback through splice() to read()/write() and eventually normal termination; and add more debugging. 2026-06-05 23:01:07 +01:00
Andrew Wood 14ee298bc3 Fall back through the different transfer methods in a consistent way, so that after a copy_file_range failure, splice through intermediate pipes can still be tried (#196). 2026-06-04 23:44:56 +01:00
Andrew Wood 07c1798b5e Re-order and re-word for clarity so the user-visible features come first, and mention the extension to %T. 2026-06-01 23:28:07 +01:00
Andrew Wood 4765b677e7 Message line number updates. 2026-06-01 23:25:47 +01:00
Andrew Wood 9dbec3cf50 Remove the build directory after running the benchmarks in -d mode (#198). 2026-06-01 21:41:32 +01:00
Andrew Wood 246d7701e4 Cap the amount passed to splice() and copy_file_range() to a specific value, don't just pass SIZE_MAX, since that value can cause errors, making the transfer fall back to read()/write(). 2026-06-01 21:36:38 +01:00
Andrew Wood 8f4bed3274 Remove the "directed output" tests since they give the same results as writing stdout to a file and can't be used with stdout going to a pipe; and add formatting options to show transfer buffer usage details (#198). 2026-06-01 21:11:18 +01:00
Andrew Wood 7e993ba14e Note the use of copy_file_range (#196). 2026-05-31 23:40:11 +01:00
Andrew Wood ae0fe82d8a Cast to unsigned long long to avoid issues on 32-bit systems (#196). 2026-05-31 23:33:28 +01:00
Andrew Wood 76a8da7dc1 Cast in the other direction because on 32-bit systems a size_t is smaller than an off_t (#196). 2026-05-31 22:29:54 +01:00
Andrew Wood 6130d65249 Use copy_file_range() for transfers if it is available (#196). 2026-05-31 22:18:18 +01:00
Andrew Wood 85918358a5 Clean up at the end of a benchmark run, before the next one, in multi-sources mode; and remove the output files before starting each measurement. 2026-05-31 01:43:54 +01:00
Andrew Wood 0331673e02 Minor documentation fixes, and update the version (#198). 2026-05-31 01:16:41 +01:00
Andrew Wood 542c91cdbc Correct the minimum temp space requirements since there are 2 input files and 2 output files, not 1 output file. 2026-05-31 01:01:23 +01:00
Andrew Wood 868a054366 Add an option to read source tar.gz files from a directory and extract, compile, and benchmark pv from each one. 2026-05-31 00:58:52 +01:00
Andrew Wood 549db120db Documentation cleanup. 2026-05-30 23:49:58 +01:00
Andrew Wood 0a1e53c2db Silence the warning about tr. 2026-05-30 23:24:49 +01:00
Andrew Wood ecfe1f72e3 Allow comparison between runs as well as between pv versions, with auto selection the default; add an option to only show the final line of each comparison so only the latest is shown; and add an option for a terse analysis format. 2026-05-30 23:22:42 +01:00
Andrew Wood 703cf06b7e Add an explanation to the version comparison report. 2026-05-30 22:38:03 +01:00
Andrew Wood 3628ed5072 Show each measurement command in the analysis. 2026-05-30 22:29:47 +01:00
Andrew Wood 067c9aa7a3 Line up the columns in the analysis report. 2026-05-30 22:24:20 +01:00
Andrew Wood 9b3f37c233 Make the awk variable names more consistent. 2026-05-30 21:59:04 +01:00
Andrew Wood b20598ff72 Move measurement definitions into a list so that individual measurements can be selected to be run on their own. 2026-05-30 21:52:29 +01:00
Andrew Wood 8bd5e89f92 Remove accidental extra field from mean and standard deviation reports, and add an analysis of how each measurement performs between PV versions. 2026-05-30 20:10:24 +01:00
Andrew Wood 905894f294 Rename the new benchmark script. 2026-05-29 22:17:27 +01:00
Andrew Wood 453bcec11a Accept command line options, and allow addition of an analysis step later. 2026-05-29 22:16:25 +01:00
Andrew Wood a984ab5dd3 Be less specific and so more accurate. 2026-05-29 21:24:33 +01:00
Andrew Wood 624097639f Message line number updates. 2026-05-29 21:09:47 +01:00
Andrew Wood 47ca0d8cf8 Provide a system ID to identify the host running test, the PV version, and a run ID for the whole test, as three separate fields in each output line, for easier processing later. 2026-05-29 20:03:37 +01:00
Andrew Wood 5944115d94 Measure each type of transfer several times, and calculate the mean and standard deviation afterwards. 2026-05-28 23:42:19 +01:00
Andrew Wood b99026d7d7 Add a benchmark script to measure transfer rate and CPU usage of various options (#198). 2026-05-27 23:27:56 +01:00
Andrew Wood f72486d4e8 Don't cap splice() amounts to the transfer buffer size, since the transfer buffer isn't being used. 2026-05-26 23:32:38 +01:00
Andrew Wood e74cab6985 If discarding input but /dev/null can't be used as a splice() destination, fall back to normal read() rather than exiting with an error (#192). 2026-05-26 22:36:58 +01:00
Andrew Wood a0a097decb Mention that the ETA will be displayed on the second part. 2026-05-24 15:51:06 +01:00
Andrew Wood d0b230bceb Reword the explanation. 2026-05-24 15:29:01 +01:00
Andrew Wood 63f4a0bc39 Datestamp update. 2026-05-24 15:03:42 +01:00
Andrew Wood 983f75c7df Message line number updates. 2026-05-23 00:33:08 +01:00
Andrew Wood e043efd259 Handle splice failures more robustly when the intermediate pipe is involved. 2026-05-23 00:32:50 +01:00
Andrew Wood 7e99aa5b13 Expand the description of --no-splice. 2026-05-22 21:43:30 +01:00
Andrew Wood 2d08b3208a Expand the explanation of "--name" and "--cursor" and remove "you". 2026-05-22 21:31:09 +01:00
Andrew Wood 944ae9aca1 Reword to remove implied agency. 2026-05-22 21:18:34 +01:00
Andrew Wood e82d5e48f4 Simplify the explanation of --delay-start. 2026-05-22 21:15:06 +01:00
Andrew Wood 98c92e0239 Make the --wait example a little clearer. 2026-05-22 20:52:42 +01:00
Andrew Wood 6c5d86c66f Add the missing closing bracket. 2026-05-22 20:44:43 +01:00
Andrew Wood 9d96c7d6eb Fill in more empty translations, using coreutils translations as a guide. 2026-05-21 21:31:43 +01:00
Andrew Wood 1f27ba3b35 Try to explain more clearly. 2026-05-20 22:58:53 +01:00
Andrew Wood 4aa73d5fc6 Note the updated translations. 2026-05-19 21:30:28 +01:00
Andrew Wood 50150d0d66 Fill in empty translations, move accidentally repeated comment. 2026-05-19 21:22:05 +01:00
Andrew Wood 192566a9fd Fill in empty translations and make capitalisation more consistent. 2026-05-19 21:21:24 +01:00
Andrew Wood 6dcb41f2fa Fill in empty translations. 2026-05-19 21:20:02 +01:00
Andrew Wood 54b0c8bc23 Datestamp update. 2026-05-18 22:00:54 +01:00
Andrew Wood 6609500d90 Note the addition of a partial Georgian translation catalogue. 2026-05-17 21:27:47 +01:00
Andrew Wood 905e27ad47 Remove overly specific edge-case error messages, where just the filename and the system error would suffice; replace all the different types of memory allocation error with "memory allocation failure", since the action for the end-user is the same in all cases; and use the error messages "memory allocation failure", "interrupted by a signal", "error closing file", "input file is also the output", and "write error" since these are all used by either coreutils and grep, in similar contexts, so their translations can be copied. 2026-05-17 00:31:46 +01:00
Andrew Wood df77b78e23 Merge pull request 'Translations update from Codeberg Translate' (#195) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/195
2026-05-16 21:27:26 +02:00
a-j-woodandCodeberg Translate 87f2326012 Translated using Weblate (Georgian)
Currently translated at 54.0% (80 of 148 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/ka/
2026-05-16 19:25:57 +00:00
Andrew Wood a0cd6a5d18 Describe the values in the --stats line in the correct order. 2026-05-16 20:21:31 +01:00
Andrew Wood e11d1dec19 Message line number updates. 2026-05-16 16:13:51 +01:00
Andrew Wood b51afc07e2 Correct the --bar-style description to use the same placeholder as in the option spec. 2026-05-16 16:13:26 +01:00
Andrew Wood 813f6aaeab Note the fixes in splice() handling. 2026-05-16 16:12:39 +01:00
Andrew Wood 49adee62c4 Merge pull request 'Translations update from Codeberg Translate' (#194) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/194
2026-05-16 17:06:10 +02:00
a-j-woodandCodeberg Translate 35d1e59f74 Translated using Weblate (Georgian)
Currently translated at 20.2% (30 of 148 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/ka/
2026-05-16 15:05:00 +00:00
Andrew Wood 1a00a7fdf5 Correct the off_t/size_t max_to_write overflow check. 2026-05-15 23:42:49 +01:00
Andrew Wood d546e90a94 Break pv__transfer_read() into smaller functions to separate out the different parts, and improve the splice() handling when rate limiting and when EOF / Control-D is typed into stdin. 2026-05-15 23:23:24 +01:00
Andrew Wood 82de6be6fd Adjust removal note now Georgian has been restored. 2026-05-14 21:54:07 +01:00
Andrew Wood 958cacf4bb Restore the empty Georgian language file as requested. 2026-05-14 21:53:11 +01:00
Andrew Wood 8198058bb2 Message line number updates. 2026-05-14 21:51:45 +01:00
Andrew Wood 60203aabf5 Add retries on signal interrupt to the splicing into and out of the intermediate input pipe, and add a TODO marker highlighting a problem with the way splice() is currently handled. 2026-05-13 22:19:03 +01:00
Andrew Wood d65dbd2f37 Make pv_format() static, as it is only used in one place (cppcheck recommendation). 2026-05-12 23:06:09 +01:00
Andrew Wood 65741d9b2e Remove needless "continue" in the empty "for" loop (cppcheck recommendation). 2026-05-11 20:59:42 +01:00
Andrew Wood 4fbcfebc6c Remove needless comparisons that would always be true here (cppcheck recommendation). 2026-05-11 20:56:10 +01:00
Andrew Wood 270bcb066e Make pv_watchfd_info() and pv_reset_watchfd() static, as they are only used in one place (cppcheck recommendation). 2026-05-11 20:50:43 +01:00
Andrew Wood 229aadf194 Make the struct dirent a const (cppcheck recommendation). 2026-05-11 20:43:45 +01:00
Andrew Wood 6b0f8477d0 Message line number updates. 2026-05-10 20:52:15 +01:00
Andrew Wood 61b412b0f1 Mark pointers to constant buffers as const (cppcheck recommendation). 2026-05-10 20:38:49 +01:00
Andrew Wood 6772d7e5a1 Read the EOF values in the debug statements by dereferencing the eof_in and eof_out pointers, not by using the pointers as a truth value. 2026-05-10 20:17:11 +01:00
Andrew Wood f6b2196369 Reduce the scope of offset (cppcheck recommendation). 2026-05-10 20:05:42 +01:00
Andrew Wood d2c183d234 Remove redundant assigment (cppcheck recommendation). 2026-05-10 19:55:02 +01:00
Andrew Wood e09976042d Reduce the scope of the first keyword_index (cppcheck recommendation), and in the formatter, guard against a size_t underflow by checking the write position each time it's used (implied by cppcheck). 2026-05-10 19:25:07 +01:00
Andrew Wood 7ddbc72525 Make the struct tm a const (cppcheck recommendation). 2026-05-10 19:19:30 +01:00
Andrew Wood 7c19f58e75 Mark pointers to constant buffers as const (cppcheck recommendation). 2026-05-10 19:18:01 +01:00
Andrew Wood 723d96b54b Mark argument as pointer to const, since only the pointer changes (cppcheck recommendation). 2026-05-10 19:17:12 +01:00
Andrew Wood 6b5d217e22 Reduce the scope of end_idx (cppcheck recommendation). 2026-05-10 19:15:54 +01:00
Andrew Wood d9eb83e1f5 Make the struct tm a const (cppcheck recommendation). 2026-05-10 19:15:17 +01:00
Andrew Wood 411f9529a2 Message line number updates. 2026-05-09 20:25:04 +01:00
Andrew Wood adf2767763 Additional commentary on total_written and rate limiting. 2026-05-09 20:24:49 +01:00
Andrew Wood 4fc5d10671 Remove spurious extra word. 2026-05-09 20:08:25 +01:00
Andrew Wood 19d1835d37 Message line number updates. 2026-05-09 20:04:09 +01:00
Andrew Wood 6f9e73f058 Add more detailed comments about the rate limiter. 2026-05-09 20:04:02 +01:00
Andrew Wood 5897576ca1 Message line number updates. 2026-05-09 17:23:50 +01:00
Andrew Wood 9b28da72eb Acknowledge the contribution. 2026-05-09 17:22:32 +01:00
Andrew Wood d49234eefe Update the notes about numbers passed to --rate-limit. 2026-05-09 17:18:42 +01:00
Andrew Wood 4bfe83a445 Note the --rate-limit change allowing decimal values. 2026-05-09 17:16:22 +01:00
Andrew Wood 228ff740bf Merge branch 'fractional_rate_limit' (#193). 2026-05-09 16:15:14 +01:00
Andrew Wood c69343856a Correct the broken pull links from before the repository move (/pull/ should be /pulls/ on Codeberg). 2026-05-09 16:12:38 +01:00
Andrew Wood d381a1c714 Correct the rate limit burst cap so it won't prevent output when the rate is below 0.2, and handle the case where more than one rate limit interval has passed since the last calculation (#193). 2026-05-09 00:37:29 +01:00
Andrew Wood 0a98062586 Define RATE_BURST_WINDOW as a floating point value since it's used in floating point calculations (#193). 2026-05-09 00:35:19 +01:00
Andrew Wood e7087b101d Allow "-L 0" to be propagated with "-R" so that a remote process can have its rate limiting turned off as well as on; and update the manual to note this (#193). 2026-05-08 21:07:29 +01:00
Andrew Wood eae06cf3c0 Correct the remote setting of the rate limit so that -R without -L does not turn off the current rate limiting of the remote process (#193). 2026-05-07 23:00:33 +01:00
Andrew Wood 0e7a77b42a Allow the rate limit to be specified as a fractional number (#193). 2026-05-06 23:24:51 +01:00
Andrew Wood a78a432f50 Message line number updates. 2026-05-05 21:05:27 +01:00
Andrew Wood 4867b641a7 Adjust the item ordering. 2026-05-05 21:03:55 +01:00
Andrew Wood 355d030ce0 Datestamp update. 2026-05-05 20:55:17 +01:00
Andrew Wood 547efed258 Set the exit status to 8 when /dev/null is not usable and --discard is active (#192). 2026-05-04 16:30:34 +01:00
Andrew Wood a4b90879a0 Add the messages for the pipe buffer size option and /dev/null detection. 2026-05-03 20:57:00 +01:00
Andrew Wood 3b1bad2334 Acknowledgements update. 2026-05-03 20:56:33 +01:00
Andrew Wood cfe7b4e97a Whitespace correction in comment. 2026-05-03 19:42:33 +01:00
Andrew Wood 10895792d2 When opening /dev/null internally, check that it really is a null device, and refuse to use it if not (#192). 2026-05-03 19:37:27 +01:00
Andrew Wood 6b19d8e31c Note the changes relating to the intermediate input pipe and the discard splice. 2026-05-03 18:30:57 +01:00
Andrew Wood f3ce23e7c7 Adjust the text relating to splice() in relation to the intermediate pipe development. 2026-05-03 18:26:55 +01:00
Andrew Wood 663a54bda0 Merge the changes for #188 and #191 which add an intermediate pipe on the input side to allow splice() to be used for all transfers. 2026-05-03 17:59:13 +01:00
Andrew Wood ae60fc0688 Move output_fd into HAVE_SPLICE. 2026-05-03 17:06:47 +01:00
Andrew Wood 11d727a88d In discard mode, if splice() is available, open a file descriptor to /dev/null and splice the input to that, to improve performance (#191). 2026-05-03 14:53:45 +01:00
Andrew Wood b75ecd79d5 Add comments explaining the steps (#188). 2026-05-03 13:42:27 +01:00
Andrew Wood 5fb7e49848 Start the intermediary pipe buffer size at 1MiB (#188). 2026-05-03 13:41:52 +01:00
Andrew Wood 21c8237a73 When splice() is available but neither the input nor the output are pipes, splice the input through an intermediary pipe (#188). 2026-05-03 01:12:33 +01:00
Andrew Wood b300046eb1 Acknowledgements update. 2026-05-02 17:12:21 +01:00
Andrew Wood 17cbab3045 Add an option "-J" / "--pipe-buffer-size" to set the size of the output pipe buffer when the output is a pipe, and when that option is not specified, automatically increase the output pipe buffer size to match that of the input, when the first input is also a pipe (#188). 2026-05-02 16:42:35 +01:00
Andrew Wood d421024fb8 Run through "make indent" for consistency, update message line numbers. 2026-05-01 19:47:10 +01:00
Andrew Wood 7a6ce0f0b6 Message line number updates. 2026-05-01 19:10:30 +01:00
Andrew Wood b1bf99c09b Datestamp update. 2026-05-01 19:10:04 +01:00
Andrew Wood 096b655bb8 Remove the note about getting stuck when writing to an exited reader, as it was fixed in #189. 2026-05-01 19:09:20 +01:00
Andrew Wood 7a276040ad Note the fix for the endless wait on EOF issue (#189). 2026-05-01 19:07:44 +01:00
Andrew Wood 89d2a7840f Acknowledge the contributor of the fix for endlessly waiting for an exited receiver to empty the pipe buffer (#189, #190). 2026-05-01 19:07:07 +01:00
Andrew Wood fb2b325e94 Merge pull request 'fix: avoid EOF hang on unread pipe output (#189)' (#190) from whoschek/pv:wip/eof_hang into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/190
Reviewed-by: Andrew Wood <a-j-wood@noreply.codeberg.org>
2026-05-01 19:42:43 +02:00
Wolfgang Hoschek e7d188ac65 fix: avoid EOF hang on unread pipe output (#189)
At EOF, pv waits for bytes already written to an output pipe to be consumed before finishing. If the downstream reader exits without reading those bytes, the pipe can keep reporting unread data forever. Since pv has no more input, there is no later write that would fail with EPIPE and break the wait.

Detect this EOF drain-wait case with a non-blocking poll() on the output pipe. When the pipe reports that its readers are gone, mark the pipe closed and stop waiting for bytes that can no longer be consumed. While a reader is still present, keep the existing behaviour and continue waiting for the pipe buffer to drain.

Add regression coverage for both ways pv can reach this state: direct input that leaves unread output bytes behind, and a pipeline where the original producer fails but an intermediate filter such as gzip still emits a valid empty stream. The latter matters because pv can still have pending output at EOF even when the command at the start of the pipeline failed immediately.

Signed-off-by: Wolfgang Hoschek <wolfgang.hoschek@mac.com>
2026-04-30 04:47:09 -04:00
Andrew Wood 79a6420fea Replace the fixed-sized buffer file_fdpath with a dynamically allocated equivalent. 2026-04-29 21:43:46 +01:00
Andrew Wood c54c3258a6 Acknowledge the reporter (#187). 2026-04-29 20:10:02 +01:00
Andrew Wood 0c28d017de Note the signal interrupt message feature (#187). 2026-04-29 19:54:27 +01:00
Andrew Wood 0a69501594 Add the new signal interrupt message (#187). 2026-04-29 19:53:43 +01:00
Andrew Wood a3f0caeab4 Record the received number before setting the exit trigger, so it will definitely be available for reporting (#187). 2026-04-28 22:55:16 +01:00
Andrew Wood 478039f539 Report which signal triggered the exit (#187). 2026-04-28 22:53:23 +01:00
Andrew Wood 2a25221eaf Suppress the error message about a signal interrupt in cursor mode in all but the first instance in a pipeline (#187). 2026-04-27 21:27:20 +01:00
Andrew Wood c763f1fcaa Write an error message if interrupted by a signal such as SIGINT (#187). 2026-04-26 21:45:36 +01:00
Andrew Wood 8b4fa8ade7 Clear the terminal flag ECHOCTL before starting, and set it again at the end, similar to how TOSTOP is dealt with (#187). 2026-04-26 20:01:22 +01:00
Andrew Wood 57f0b91d16 Adjust the watchfd changes for Apple builds. 2026-04-25 23:05:17 +01:00
Andrew Wood a66a1cc10c Message line number updates. 2026-04-25 22:06:18 +01:00
Andrew Wood 2a31b73a32 Replace the fixed-sized buffers file_fdinfo and file_fdsymlink with dynamically allocated equivalents. 2026-04-25 22:04:38 +01:00
Andrew Wood ee96f3f43b Specify which watched PID had the problem. 2026-04-25 21:04:41 +01:00
Andrew Wood 2b1d359281 Use pv_asprintf() to allocate fd_dir instead of having it statically sized. 2026-04-25 21:03:09 +01:00
Andrew Wood 4854d71aa9 Adjustment from "make indent". 2026-04-25 21:01:56 +01:00
Andrew Wood 18b1926d61 Replace the fixed-size "cwd" buffer with a dynamically allocated one. 2026-04-24 23:00:45 +01:00
Andrew Wood 43a54bd541 Rename the pvwatchfd "file_fd" item to "file_fdsymlink" to to better distinguish it from the other structure members. 2026-04-23 21:42:10 +01:00
Andrew Wood bf371e9a8c Tidy up comments. 2026-04-22 22:21:36 +01:00
Andrew Wood 239a20d13f Tidy up comments. 2026-04-21 23:45:56 +01:00
Andrew Wood a220e993af Adjust the wording as pv does not "know" things. 2026-04-21 22:18:13 +01:00
Andrew Wood a955038360 Document the behaviour exhibited when pv writes to a pipe and the reader exits with unread data in the pipe buffer. 2026-04-21 22:13:44 +01:00
Andrew Wood c0e530eefd Use awk instead of the non-portable "~" sed command. 2026-04-20 22:55:24 +01:00
Andrew Wood 1d28da18ce Add a basic test for monitoring, each of the "in" and "out" sides. 2026-04-19 23:12:10 +01:00
Andrew Wood 571c3bee06 Datestamp update. 2026-04-19 21:51:24 +01:00
Andrew Wood 618f1c1578 Message line number updates. 2026-04-19 21:49:12 +01:00
Andrew Wood 496b1e431e Return a boolean from pv__transfer_read/write, where false indicates a transient error. 2026-04-19 21:47:46 +01:00
Andrew Wood ef9240a7a5 Add another _ to the internal read/write_repeated functions so they are easier to distinguish from pv__transfer_read/write when searching. 2026-04-19 21:15:33 +01:00
Andrew Wood b2f44b6724 Clamp the calculated ETA to within the size of a long integer to avoid over/underflows, and round off the floating point value rather than just truncating the decimal portion. 2026-04-19 17:57:32 +01:00
Andrew Wood c19d16b3c8 Loosen the limits on this test slightly. 2026-04-19 17:47:52 +01:00
Andrew Wood 0440ba26da Adjust the ETA clamp note to mention 64-bit. 2026-04-19 16:58:55 +01:00
Andrew Wood 070bcb5acc Message line number updates. 2026-04-19 16:58:14 +01:00
Andrew Wood f3353cb4bd Adjust the ETA max to 68 years on systems where a long integer is 32 bits wide, as that is all that will fit. 2026-04-19 16:58:05 +01:00
Andrew Wood 9f63212a7c Add pv_asprintf() and change the way the terminal lock file is stored, so it is in a dynamically allocated buffer rather than using one of a fixed size. 2026-04-19 16:24:26 +01:00
Andrew Wood a59c91f03d Note the time clamping changes. 2026-04-19 13:06:59 +01:00
Andrew Wood f724ebe158 Message line number updates. 2026-04-19 13:04:30 +01:00
Andrew Wood 3bc102c334 Increase the ETA max cutoff to just under 1,000,000 days, not 100,000. 2026-04-19 13:04:05 +01:00
Andrew Wood d638cd50f4 Remove pv_bound_long() and the blanket 100,000 hour cutoff - instead, clamp the ETA to just under 100,000 hours (to keep it from getting too wide), clamp the FINETA to a max of 7,000 years (to keep the date the same width), and make the timer show an overflow message when 1,000,000 days is reached. 2026-04-19 13:02:03 +01:00
Andrew Wood ebbcdf4b4d Remove obsolete TODO - there is no open issue for it, and it doesn't explain what "better" means. 2026-04-19 12:16:48 +01:00
Andrew Wood b3410cf8c0 Adjust the lower boundary to make failure less likely on a heavily loaded system. 2026-04-19 00:19:29 +01:00
Andrew Wood dc51002ba4 Reword the introduction, and mention monitor mode. 2026-04-19 00:09:26 +01:00
Andrew Wood 9bc5903337 Remove the empty translation catalogues for Spanish and Georgian, as they are unmaintained and have never received any submissions. 2026-04-18 22:34:32 +01:00
Andrew Wood 26c4ad45bd Note the error reporting change. 2026-04-18 22:30:39 +01:00
Andrew Wood cb8cac81aa Message line number updates. 2026-04-18 22:24:09 +01:00
Andrew Wood 7dc02a475e Make pv_error() and pv_perror() available outside of src/pv/, and use them throughout the program. 2026-04-18 22:23:28 +01:00
Andrew Wood 25f43e129f Use pv_perror() rather than perror(), for consistency. 2026-04-18 21:46:16 +01:00
Andrew Wood b12681d667 Add a pv_perror() function to remove all the repeated strerror(errno) calls from pv_error() arguments, and standardise the error lines so the filename in question always comes first. 2026-04-18 21:07:08 +01:00
Andrew Wood 0af9cb2314 Use pv_error() instead of writing directly to stderr. 2026-04-18 20:33:07 +01:00
Andrew Wood fc364d381f Dynamically allocate the error message prefix, instead of copying it into a static buffer. 2026-04-18 20:30:39 +01:00
Andrew Wood 0481e99c2f Use pv_error() instead of writing directly to stderr. 2026-04-18 20:29:40 +01:00
Andrew Wood 7eedf884ea Add TODO markers for changes to make the code easier to understand. 2026-04-18 20:11:20 +01:00
Andrew Wood ebefc02f4e Tidy up comments. 2026-04-18 18:00:48 +01:00
Andrew Wood 17d9ee59e7 Tidy up comments. 2026-04-18 17:41:14 +01:00
Andrew Wood fec4253f07 Tidy up comments. 2026-04-18 17:23:13 +01:00
Andrew Wood 505a6d9d2b Tidy up comments. 2026-04-18 14:48:13 +01:00
Andrew Wood 3a90959f9c Tidy up comments. 2026-04-18 14:37:29 +01:00
Andrew Wood 73d1237f1b Tidy up comments. 2026-04-17 23:27:30 +01:00
Andrew Wood 1b5a936ebf Tidy up comments. 2026-04-16 21:59:49 +01:00
Andrew Wood 7de5e2ca33 Tidy up comments. 2026-04-16 20:49:44 +01:00
Andrew Wood 854186c942 Tidy up comments. 2026-04-16 20:46:07 +01:00
Andrew Wood 39c7d4f586 Tidy up comments. 2026-04-15 22:00:50 +01:00
Andrew Wood 2e08bbb20a Tidy up comments. 2026-04-14 22:17:00 +01:00
Andrew Wood bea21335c0 Add TODO markers for the removal of fprintf(stderr). 2026-04-14 21:54:33 +01:00
Andrew Wood ba80d546bc Tidy up comments. 2026-04-14 21:49:50 +01:00
Andrew Wood d120d654c6 Tidy up comments. 2026-04-13 21:25:03 +01:00
Andrew Wood b68560a5b6 Tidy up comments. 2026-04-13 20:16:48 +01:00
Andrew Wood d66343d6f6 Fix a typo in a comment. 2026-04-12 21:33:57 +01:00
Andrew Wood 7e1aa366b6 Note the cleanups made so far. 2026-04-12 20:14:37 +01:00
Andrew Wood 4749cdbb27 Tidy up comments, add a TODO marker for removal of a static buffer. 2026-04-12 20:08:21 +01:00
Andrew Wood 70fd445307 Fix a typo in a comment. 2026-04-12 18:41:15 +01:00
Andrew Wood 99d27893eb Add TODO markers for later improvements. 2026-04-12 18:39:38 +01:00
Andrew Wood ef730dda06 Minor corrections to the comments. 2026-04-12 17:42:16 +01:00
Andrew Wood e82aa71f26 Update message positions. 2026-04-11 15:52:28 +01:00
Andrew Wood e0f091384f Replace fgets() with getline() to eliminate buffers of a fixed size. 2026-04-11 15:51:42 +01:00
Andrew Wood bca6fc9542 Tidy up the comments. 2026-04-11 13:39:51 +01:00
Andrew Wood 937298eec2 Update message positions. 2026-04-11 13:39:35 +01:00
Andrew Wood 2ff99ab1cd Add TODO markers for elimination of fixed size buffers. 2026-04-09 22:01:54 +01:00
Andrew Wood 593723ba92 Explain the error branch. 2026-04-09 21:58:38 +01:00
Andrew Wood 989a34b7c7 Explain what's going on with realloc(). 2026-04-09 21:44:57 +01:00
Andrew Wood 49b6c71f42 Message line number updates. 2026-04-08 22:05:32 +01:00
Andrew Wood b3eacc71d0 Note the --help fix on small terminals. 2026-04-07 23:09:42 +01:00
Andrew Wood 0eab393715 Make it clearer what display_word_wrap() does and set the margins more appropriately when the terminal size is small. 2026-04-07 23:08:53 +01:00
Andrew Wood 52585447f0 Correct the wrapping width on lines after the first, improve the commenting, and avoid size_t underflow on very narrow terminals. 2026-04-07 22:20:55 +01:00
Andrew Wood 3eff81f1a6 Update the translations count for coralpink. 2026-04-06 16:58:15 +01:00
Andrew Wood 72376e2d29 Merge changes from weblate (#186). 2026-04-06 16:44:15 +01:00
Coral PinkandCodeberg Translate 7532f33c7d Translated using Weblate (Polish)
Currently translated at 100.0% (145 of 145 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/pl/
2026-04-06 15:34:16 +00:00
Andrew Wood cf68a17f33 Message line number updates. 2026-04-06 16:08:10 +01:00
Andrew Wood f4a3d61a17 Restructure the "monitor remaining side" part to avoid the need for a fallthrough in the case statement, getting rid of compiler warnings on CentOS 5, 6, and 7, and arguably making the code easier to follow. 2026-04-06 16:07:56 +01:00
Andrew Wood e01e456825 Note the cleanup of the OpenBSD warning. 2026-04-06 15:20:08 +01:00
Andrew Wood ba0738496e In the stub pv_remote_check() used where remote control is unavailable (OpenBSD), return false so there is a return value. 2026-04-06 15:19:24 +01:00
Andrew Wood bec0b6924e Update message positions, and add the new strings for monitor mode. 2026-04-06 14:12:59 +01:00
Andrew Wood 1f96f368bd Note the correction to --pidfile error checking. 2026-04-05 20:42:05 +01:00
Andrew Wood 3aac6a7b64 Tidy up the comments. 2026-04-05 20:23:38 +01:00
Andrew Wood fc23d71226 Return an error from pv__write_pidfile() if the final rename() fails. 2026-04-05 19:34:00 +01:00
Andrew Wood c2474f5c33 Tidy up the comments. 2026-04-05 19:30:51 +01:00
Andrew Wood 9427d210d8 Remove the "ratio" option flag, as it is not needed (#67). 2026-04-05 15:10:53 +01:00
Andrew Wood bd5b709dda Calculate the size, in monitor mode (#67). 2026-04-04 21:43:43 +01:00
Andrew Wood b79273bb91 At the end of the transfer, exchange information with the other monitor when in "monitor both" mode, so both sides learn each other's final transfer value, to give the correct final ratio (#67). 2026-04-04 21:07:04 +01:00
Andrew Wood f5fd94ef77 Note the warning cleanup. 2026-04-04 13:44:47 +01:00
Andrew Wood 7c0573c847 Version bump for feature addition. 2026-04-04 13:37:15 +01:00
Andrew Wood 02b3f215fc Update to match the source material, for --monitor (#67). 2026-04-04 13:35:52 +01:00
Andrew Wood 00b03fbfea Note the --monitor option (#67). 2026-04-04 13:34:14 +01:00
Andrew Wood 74de4e9a01 Merge branch 'wrap_process' 2026-04-04 13:30:50 +01:00
Andrew Wood d8cc637b56 Add the "%{ratio}" formatter (#67). 2026-04-03 21:49:41 +01:00
Andrew Wood 8f19633dd7 In "-M both" mode, exchange information about the total amount transferred with the other side (#67). 2026-04-03 21:12:13 +01:00
Andrew Wood 6c3a08af2b Document the ratio formatting sequence (#67). 2026-04-03 20:32:14 +01:00
Andrew Wood 7892e54d7e Rather than setting an option flag for ratio, add it to the default format string on the "out" side (#67). 2026-04-03 20:20:50 +01:00
Andrew Wood d7327aaf95 Replace pv_state_set_format() with pv_set_format_options(), which takes a structure rather than a long list of arguments, to make it easier to pass around - and rely on pv_state_name_set() being called first rather than doing it within this function, so it is only doing one job (#67). 2026-04-03 20:00:42 +01:00
Andrew Wood 80358e84f3 If no display options are passed and "-M both" is active, set a "ratio" option flag to display the in:out ratio as well (#67). 2026-04-02 23:08:49 +01:00
Andrew Wood 002780fbaf Ignore files autogenerated by "autoreconf" (#185). 2026-04-01 22:14:57 +01:00
Andrew Wood 1003bbb121 Remove src/include/config.h.in from the repository as it is generated by "autoreconf" and causes conflicts (#185). 2026-04-01 22:11:40 +01:00
Andrew Wood f36ff9b378 Remove po/Makefile.in.in from the repository as it is generated by "autoreconf" and causes conflicts (#185). 2026-04-01 22:09:19 +01:00
Andrew Wood ad834055db Acknowledge PR#180. 2026-03-31 22:18:00 +01:00
Andrew Wood 7ce6d275ba Merge pull request 'fix discard const qualifier from pointers' (#180) from heitbaum/pv:const into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/180
2026-03-31 23:10:13 +02:00
Andrew Wood 8ef4ff2e84 If an empty format string is supplied, such as -F "", make that imply -q and cancel -c, so that -F "" -F "%b %t %r %p %e" -M both will monitor both sides but only display the output side - which will be useful when ratio is added (#67). 2026-03-30 21:41:16 +01:00
Andrew Wood 00f06f2b2c Pass the othermonitor_* values into the main state, and add TODO markers for next steps (#67). 2026-03-29 21:49:47 +01:00
Andrew Wood 2a54d4edcc Set up a pair of pipes for the in and out monitors to use to pass progress details between each other, and replace repeated "close if open" code with a macro (#67). 2026-03-28 22:40:45 +00:00
Andrew Wood 8281b918ef Add a TODO marker for monitor mode suggesting another way to pass ratio information between in and out (#67). 2026-03-27 22:28:07 +00:00
Andrew Wood 3c8393f8be Note the translation updates. 2026-03-26 23:42:56 +00:00
Andrew Wood b1178b2ee2 Acknowledge Finnish translations submitter (#184). 2026-03-25 23:46:22 +00:00
Andrew Wood d670d47542 Merge pull request 'Translations update from Codeberg Translate' (#184) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/184
2026-03-26 00:43:49 +01:00
Ricky-TiggandCodeberg Translate 00cd3cfcc5 Translated using Weblate (Finnish)
Currently translated at 90.7% (127 of 140 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/fi/
2026-03-24 23:25:21 +00:00
Andrew Wood 7edbd3e951 Add a TODO about how to get ratio information (#67). 2026-03-24 23:06:36 +00:00
Andrew Wood d98237134b Adjust the -M help so it specifies the range of accepted values (#67). 2026-03-23 22:33:25 +00:00
Andrew Wood 53d9f81eee Update the translation totals. 2026-03-22 16:47:21 +00:00
Andrew Wood 7e504b2f47 Merge pull request 'Translations update from Codeberg Translate' (#183) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/183
Reviewed-by: Andrew Wood <a-j-wood@noreply.codeberg.org>
2026-03-22 17:42:33 +01:00
Andrew Wood 0e2e30a74c Add a release checklist step to check for updates translations. 2026-03-22 16:36:33 +00:00
Codeberg Translate 7373ccfaad Merge remote-tracking branch 'origin/main' 2026-03-22 16:32:04 +00:00
Coral PinkandCodeberg Translate 1442c148d8 Translated using Weblate (Polish)
Currently translated at 100.0% (140 of 140 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/pl/
2026-03-22 15:50:00 +00:00
Andrew Wood 59873f1d41 Commit to new version and release date. 2026-03-22 14:54:11 +00:00
Andrew Wood 805f66badf Timestamp update. 2026-03-22 14:53:43 +00:00
Andrew Wood a063b95005 Fix the rate calculation when --bits is used - patch from user mojohakase (#182). 2026-03-21 22:28:27 +00:00
Andrew Wood 5c84305817 Hide the __attribute__() definition from splint so it doesn't generate spurious warnings. 2026-03-21 15:48:35 +00:00
Andrew Wood c8e13d226b Wait for the other processes associated with monitoring mode before returning, closing stdout beforehand so the monitored command will end (#67). 2026-03-21 15:47:07 +00:00
Andrew Wood 6a20139f5c Add a macro to remove __attribute__(()) if not compiling with GCC. 2026-03-20 23:48:28 +00:00
Andrew Wood 7be959ece1 Add more debugging, and pass a dummy input file list of just "-" to the monitoring transfer loop (#67). 2026-03-20 23:13:33 +00:00
Andrew Wood b3896f93b2 Add more debugging, and set the pipefd entries to -1 after closing them to avoid double-close (#67). 2026-03-20 23:00:44 +00:00
Andrew Wood 09a55ef62a Put the constant on the left hand side to avoid accidental assignment if an "=" is omitted (#67). 2026-03-20 22:14:35 +00:00
Andrew Wood 149be3f9ab Run the transfer main loop for the in and out monitoring sides, using another process for "out" if monitoring both (#67). 2026-03-20 22:12:14 +00:00
Andrew Wood f647b12a2d Pass through "make indent" for consistency (#67). 2026-03-20 22:11:19 +00:00
Andrew Wood ff8e396500 Do not add the monitor command arguments as PV input files; and execute the monitor command in the monitor process (#67). 2026-03-19 22:58:47 +00:00
Andrew Wood 04f99c4951 Use a special type for opts->argv[] so that the whole array, and array entries, can both be NULL, and the array entries pointers to constant strings; and ensure that argv[] always has a NULL pointer on the end - all so argv can be passed to execvp() (#67). 2026-03-19 22:57:41 +00:00
Andrew Wood 29c65ad9e1 Set up stdin/stdout for the monitored command (#67). 2026-03-18 22:28:51 +00:00
Andrew Wood f84a668098 Fork for the command to monitor (#67). 2026-03-17 23:41:23 +00:00
Andrew Wood 06721c7be1 Create pipes for monitoring (#67). 2026-03-14 22:34:17 +00:00
Andrew Wood bd70b0c6cb Set exit status for --monitor errors (#67). 2026-03-14 22:33:52 +00:00
Andrew Wood 220625f370 Add TODO markers for the next steps of monitor mode (#67). 2026-03-14 21:50:50 +00:00
Andrew Wood 4606638567 Constrain the options so that -M cannot be used with -U (as it is a different action) and -M will report the right error message if mixed with -R or -Q (#67). 2026-03-14 17:20:30 +00:00
Andrew Wood 882428883a Remember both -N and -F values if two were given (#67). 2026-03-14 14:54:53 +00:00
Andrew Wood c2bbb8eef1 Parse the monitoring side setting from "--monitor" (#67). 2026-03-14 14:28:30 +00:00
Andrew Wood 111b687449 Give "--monitor" a parameter to set which side(s) of the command to monitor (#67). 2026-03-13 23:06:43 +00:00
Andrew Wood 547b52a313 Specify which command since pv is also a command. 2026-03-12 21:59:01 +00:00
Andrew Wood 5f1893f094 Draft documentation and option parsing for a "--monitor" option to run a command and monitor its input and output (#67). 2026-03-11 23:37:09 +00:00
Andrew Wood a33ee8ef26 Avoid a comparison of signed and unsigned values. 2026-03-09 20:28:05 +00:00
heitbaum 6d8fbbf848 fix discard const qualifier from pointers
Since glibc-2.43 and ISO C23, the functions bsearch, memchr, strchr, strpbrk, strrchr, strstr, wcschr, wcspbrk, wcsrchr, wcsstr and wmemchr that return pointers into their input arrays now have definitions as macros that return a pointer to a const-qualified type when the input argument is a pointer to a const-qualified type.

Fixes:
../src/pv/display.c: In function 'pv__format_init':
../src/pv/display.c:715:37: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  715 |                      strchr(format_component_array[component_idx].match, (int) ':');
      |                       ^~~~~~
2026-03-09 01:27:04 +01:00
Andrew Wood d28d2f3155 Address the splint warning due to not recognising strlcat(). 2026-03-08 11:23:08 +00:00
Andrew Wood 9566e7d7ea Run through "make indent" for consistency. 2026-03-08 11:21:38 +00:00
Andrew Wood c39601bbb2 Datestamp updates. 2026-03-08 11:20:54 +00:00
Andrew Wood e3fcc6ae71 Commit to release date. 2026-03-08 11:19:21 +00:00
Andrew Wood 9c18fecb98 Acknowledge #179. 2026-03-08 11:10:10 +00:00
Andrew Wood 521391a495 Version bump. 2026-03-07 23:23:35 +00:00
Andrew Wood f65caacfca Version bump, and note the change to "--size @x" (#179). 2026-03-07 23:23:13 +00:00
Andrew Wood 0a27a85b4a Update the copyright years. 2026-03-07 23:20:20 +00:00
Andrew Wood d186d618e3 Look up the right maxfds value to use with nftw() for the current system (#179). 2026-03-07 23:15:09 +00:00
Andrew Wood ae97565e13 Message line number updates. 2026-03-07 23:14:23 +00:00
Andrew Wood d028d5165c Make the gettext macros behave on Debian 13. 2026-03-07 22:34:28 +00:00
Andrew Wood e17f64fce7 Allow "--size @dir" to read the size of all files under "dir" (#179). 2026-03-07 22:23:10 +00:00
Andrew Wood e4bc770054 Timestamp update. 2025-12-15 20:11:17 +00:00
Andrew Wood a890e8e0c8 Update version and release date. 2025-12-15 20:09:56 +00:00
Andrew Wood 3af38221ee Correct the process title truncation. 2025-12-12 23:12:03 +00:00
Andrew Wood 579aebf6a7 Date update. 2025-11-22 15:08:13 +00:00
Andrew Wood d91bf78cac Timestamp update. 2025-11-22 15:08:00 +00:00
Andrew Wood 6e45fe0f8d Update translations count for Finnish. 2025-11-22 15:07:31 +00:00
Andrew Wood 8d7ced4195 Merge pull request 'Translations update from Codeberg Translate' (#175) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/175
2025-11-22 16:07:08 +01:00
artnayandCodeberg Translate cae6049edd Translated using Weblate (Finnish)
Currently translated at 43.5% (61 of 140 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/fi/
2025-11-22 15:06:06 +00:00
Andrew Wood 1293f70575 Link to the Debian bug as well, and commit to a release date. 2025-11-22 15:03:53 +00:00
Andrew Wood ff412009da Version bump for #174. 2025-11-21 23:27:47 +00:00
Andrew Wood 10bc46af6e Suppress by source file name rather than function name, since in an LTO build the function name is optimised out (#174). 2025-11-21 23:26:52 +00:00
Andrew Wood 1e5fae3b7b Note the Finnish translations. 2025-11-21 05:53:21 +00:00
Andrew Wood a6f72cf985 Merge pull request 'Translations update from Codeberg Translate' (#173) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/173
2025-11-21 06:46:29 +01:00
artnayandCodeberg Translate e617b92f2b Translated using Weblate (Finnish)
Currently translated at 24.2% (34 of 140 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/fi/
2025-11-21 05:43:17 +00:00
Andrew Wood b24771d224 Added empty Georgian language file as requested. 2025-11-20 21:18:50 +00:00
Andrew Wood 6de160192a Renamed to something more specific. 2025-11-15 15:37:43 +00:00
Andrew Wood 72774e34ff Timestamp update. 2025-11-12 15:03:02 +00:00
Andrew Wood 4ab9536733 Set the release date. 2025-11-12 14:56:16 +00:00
Andrew Wood bd9af0421c Note the fix for --watchfd with multiple arguments (#170). 2025-11-12 14:32:49 +00:00
Andrew Wood 7ba474509c Version bump. 2025-11-12 14:32:39 +00:00
Andrew Wood ac13765fa5 Test --watchfd with more than one argument (#170). 2025-11-12 14:31:57 +00:00
Andrew Wood ca7997fe7d Use the new watchfd_count to size the array, not the one we just zeroed, otherwise multiple --watchfd arguments result in a memory error (#170) 2025-11-12 14:31:22 +00:00
Andrew Wood 22b729f9ea Datestamp update. 2025-11-09 22:27:57 +00:00
Andrew Wood 864895f8f2 Commit to release date. 2025-11-07 23:08:21 +00:00
Andrew Wood 5d185398ac Position updates. 2025-10-31 19:48:12 +00:00
Andrew Wood 94b8b8625f Bump minor version, since there is a new feature. 2025-10-31 19:47:07 +00:00
Andrew Wood 282823f660 Correct the stub functions used when PV_REMOTE_CONTROL is not set. 2025-10-30 22:54:02 +00:00
Andrew Wood a5fd8d662e Version bump, and mention the fix to timer behaviour when "--watchfd" is paused and resumed (#169). 2025-10-30 21:18:26 +00:00
Andrew Wood 2904eacefe Use the per-fd stoppage time rather than the global one (#169). 2025-10-29 21:31:23 +00:00
Andrew Wood 5d538da63a Add the stoppage time to the each of currently watched fds' counters (#169). 2025-10-29 21:30:43 +00:00
Andrew Wood fdfceb79c6 Add a TODO marker for next planned steps. 2025-10-28 23:34:42 +00:00
Andrew Wood 5aff62414a Add a total stoppage time counter to the per-fd watchfd structure (#169). 2025-10-28 23:34:26 +00:00
Andrew Wood c7a6f85dd2 Remove unnecessary splint annotation. 2025-10-28 21:39:54 +00:00
Andrew Wood 22e9e00f63 Move the array of watchfd item information into the main state, instead of being local to the watchfd loop, so that in future we can add stoppage time to individual fd info and it will be accessible to the signal handler (#169). 2025-10-27 20:41:32 +00:00
Andrew Wood 60ca91209a Rename structure members for clarity - "tstp_time" becomes "when_tstp_arrived", and "toffset" becomes "total_stoppage_time". 2025-10-27 19:20:22 +00:00
Andrew Wood 8c440b5417 Move remote.c, line position updates, and new strings for --query / --remote option parsing. 2025-10-26 13:19:43 +00:00
Andrew Wood 07e6255e7e Version bump, and mention the new "--query" option (#101). 2025-10-26 13:14:28 +00:00
Andrew Wood 82283ee434 Remove the TODO now it is done. 2025-10-26 12:56:28 +00:00
Andrew Wood 42cf7ed628 Move the remote control code into the pv library. 2025-10-26 12:55:15 +00:00
Andrew Wood b1cac9b78d Record all old-style formatting options, and the full string for the extra display spec, in the control structure; make pv_remote_set only use internal pv state structures so it can be part of the internal pv library where it belongs, and not need to know about main()'s options array. 2025-10-26 12:53:51 +00:00
Andrew Wood 528889888c Always calculate the elapsed transfer time every time around the loop, even if not displaying anything; and take -W into account so the elapsed time doesn't start ticking up until the first byte or line transferred, even if not displaying anything - so that -Q will report the right thing when querying a "pv -n" (#101). 2025-10-26 12:06:32 +00:00
Andrew Wood e6e6ab3b6d Consolidate repeated code into new pv__elapsed_transfer_time function. 2025-10-26 11:49:35 +00:00
Andrew Wood d2d3ec1cde Add a TODO marker for the next step. 2025-10-26 01:35:53 +01:00
Andrew Wood f518257bc9 Consolidate repeated code into new pv__show_stats function. 2025-10-25 22:49:33 +01:00
Andrew Wood 96a411671c Consolidate repeated code into new pv__resize_display_on_signal function. 2025-10-25 00:43:59 +01:00
Andrew Wood f07a7b1c87 Correct the noise interrupting the display of the original pv if the querying pv is terminated. Correct the transfer of size information to main() so that ETA can still be shown. (#101) 2025-10-24 09:24:31 +01:00
Andrew Wood 7598b4d46c Add pv_query_loop() to run a main loop watching another pv (#101). 2025-10-24 09:00:10 +01:00
Andrew Wood 15ed99eee7 Implement --query message send/receive (#101). 2025-10-23 23:27:34 +01:00
Andrew Wood 4df6fbf6f7 Mention that the --query PID needs to be owned by the same user (#101). 2025-10-23 22:02:59 +01:00
Andrew Wood f125f41428 Correct the comment naming pv__target_bufsize, which should be control.target_buffer_size. 2025-10-23 21:26:34 +01:00
Andrew Wood 2e9fc77ccd Add -Q to the remote check comments (#101). 2025-10-22 17:55:43 +01:00
Andrew Wood 590a3535d8 Don't keep PV_REMOTE_QUERY separate from PV_REMOTE_CONTROL after all since they will need to work together; extend pv_remote_check() so it will check for both -R and -Q signals (#101). 2025-10-21 23:39:17 +01:00
Andrew Wood b34bba8b4a Remove unused pv_remote_init, pv_remote_fini functions; add initial stubs for -Q (#101). 2025-10-21 23:17:23 +01:00
Andrew Wood 4f82525c39 Correct the comment at the end of the conditional. 2025-10-21 23:03:30 +01:00
Andrew Wood a2191ff270 Mention --query where --remote was mentioned, since it has the same requirements (#101). 2025-10-21 23:01:46 +01:00
Andrew Wood 8361ed1fe2 Rename signal.sender to signal.sender_usr2 so it is specific to SIGUSR2 (#101). 2025-10-21 22:15:23 +01:00
Andrew Wood 9bd96614b3 Add an action type for query mode, and more TODOs to plan how it will work (#101). 2025-10-21 22:11:10 +01:00
Andrew Wood d27672b7a3 Declare pv_open_controlfile so it can be used for the query action (#101). 2025-10-21 22:10:38 +01:00
Andrew Wood 36d82e313a Rename pv__control_file to pv_open_controlfile, and move it in with the other file functions so it can be used by both the remote-control and the remote-query code (#101). 2025-10-21 22:09:44 +01:00
Andrew Wood 8b3b61e2d3 Separate the data transfer modifier options from the alternative operating mode options. 2025-10-21 21:13:27 +01:00
Andrew Wood 60067ed4ea Define whether --query should be available, based on the same criteria as --remote for now (#101). 2025-10-21 20:59:32 +01:00
Andrew Wood de71cc2389 Prevent the use of any non-option arguments with -R or -Q (#101). 2025-10-21 20:48:44 +01:00
Andrew Wood 3f1782a573 Draft manual entry, help text, and option parsing for "--query" option (#101). 2025-10-20 21:17:59 +01:00
Andrew Wood fc379727cc Add empty unreleased line for next changes. 2025-10-19 23:47:28 +01:00
Andrew Wood 0b687edfbe Remove the obsolete build-package script, and the scripts for the release process and lab testing (which are now maintained separately at https://codeberg.org/ivarch/scripts), and add a release config file for the new release script under the same location. 2025-10-19 00:20:03 +01:00
Andrew Wood 546074853e Datestamp update. 2025-10-18 19:35:10 +01:00
Andrew Wood 7deef78ea5 Set the release date. 2025-10-18 19:32:44 +01:00
Andrew Wood a38e05e749 Datestamp update. 2025-10-18 17:09:30 +01:00
Andrew Wood 493634e26c Cover more of the features in the description. 2025-10-17 23:49:08 +01:00
Andrew Wood f96a43e366 Line number updates. 2025-10-17 23:22:33 +01:00
Andrew Wood b434c858a2 Version and datestamp bump. 2025-10-17 23:21:52 +01:00
Andrew Wood 30e30f0196 Note and acknowledge the change (#81). 2025-10-17 23:09:38 +01:00
Andrew Wood 1a70cc228a Correction to the description and removal of the TODO marker; and use the transfer interval as the time to wait after closure (#81). 2025-10-17 22:50:33 +01:00
Andrew Wood 17ca4fc9c9 Keep displaying --watchfd fds for a short time after they are closed, and don't clear the display at the end but just move the cursor past it (#81). 2025-10-17 20:40:14 +01:00
Andrew Wood 0aac6d6aac Add comments and "pid_last_seen", "fd_last_seen" structure members for proposed new logic that will hold fd info on-screen a short time after closure, to retain the progress display when a watched process exits (#81). 2025-10-17 19:09:46 +01:00
Andrew Wood 61021eab6b Remove the TODO markers for #81 as this work will be done in a separate branch. 2025-10-17 17:52:33 +01:00
Andrew Wood e59452d765 Add a note describing the apparent lack of output file growth during transfer of null bytes with --sparse (#45). 2025-10-16 21:13:43 +01:00
Andrew Wood d2647ac55c Line number updates, and remove incorrect fuzzy entries. 2025-10-15 23:46:04 +01:00
Andrew Wood c2c58762f0 Datestamp update. 2025-10-15 23:28:24 +01:00
Andrew Wood 0a55710cfc Acknowledge the suggestions for --sparse (#45). 2025-10-15 23:28:18 +01:00
Andrew Wood 660d3da704 Note the new --sparse option (#45). 2025-10-15 23:27:53 +01:00
Andrew Wood 972f8b7df8 Re-order no_splice and sparse_output relative to other flags to more closely match the order they appear in the manual. 2025-10-15 23:23:16 +01:00
Andrew Wood a40bdfb55f Merge branch 'issue45_sparse' (#45). 2025-10-15 23:17:05 +01:00
Andrew Wood 3c9ab822fe Call lseek() at the start if output is appending, so that future lseek()s are relative to the right position, fixing the issue with incorrect truncation size (#45). 2025-10-15 23:08:33 +01:00
Andrew Wood fb5ce33518 Add debugging messages about truncation and seeking (#45). 2025-10-15 22:43:56 +01:00
Andrew Wood 5c15337662 Only call ftruncate() once, when the output file descriptor is closed at the end, instead of after every lseek() - this corrects the file growth on XFS but has the side effect that writing to stdout in >> (append) mode truncates the file to the wrong size (#45). 2025-10-15 22:32:21 +01:00
Andrew Wood 71f929e29c Add a TODO indicating the problems so far and what to try next (#45). 2025-10-15 17:49:38 +01:00
Andrew Wood c21ad6fdf1 For sparse output, instead of fstat(), ftruncate(), then lseek(), do lseek() then ftruncate(), like dd does (#45). 2025-10-14 23:38:15 +01:00
Andrew Wood f0895177e7 Remove comment lines from the lab-hosts config when reading it. 2025-10-14 22:11:40 +01:00
Andrew Wood 72686655cf Move the pv__transfer_write_completed label, jumped to on a sparse write, outside of the compound statement; and so, move all of the variables within that compound statement to the start of the function. The GCC on RHEL derivatives like AlmaLinux 9, Rocky 8, CentOS 7/6/5 throws an error if the label is at the end of that block rather than just outside it (#45). 2025-10-14 22:03:41 +01:00
Andrew Wood 2efe598855 Add a test for --sparse (#45). 2025-10-14 21:46:16 +01:00
Andrew Wood 54913fddbe First working draft of --sparse transfers, tests still needed (#45). 2025-10-13 22:13:54 +01:00
Andrew Wood 023cf22a59 Add --sparse / -O to the manual, to --help, and to option processing (#45). 2025-10-13 21:26:24 +01:00
Andrew Wood 164d7f7738 Add the extra --watchfd syntax to the help for that option. 2025-10-13 17:58:37 +01:00
Andrew Wood 6b8acd9e01 Add sparse_output option and control flags, and an output_not_seekable transfer flag, to structures for "sparse output" mode in future (#45). 2025-10-12 18:12:43 +01:00
Andrew Wood 3f6dc99aa5 Change the release process to build packages with parmo. 2025-10-11 22:01:59 +01:00
Andrew Wood d939d45c27 Commit to the release date. 2025-10-11 21:31:26 +01:00
Andrew Wood fc8326a2b4 Message position updates. 2025-10-11 16:00:44 +01:00
Andrew Wood 8d939c9b99 Provisional version bump. 2025-10-11 16:00:13 +01:00
Andrew Wood 72d9efc993 More specific TODOs for one way of implementing #81. 2025-10-07 22:17:10 +01:00
Andrew Wood 64c4e8efb9 Add TODO markers for one way of implementing #81. 2025-10-06 18:03:46 +01:00
Andrew Wood 25dadb2bfd Add a comment describing what this structure is for. 2025-10-06 18:01:57 +01:00
Andrew Wood 80b68a73ee Include -C in the test, since splice can have an effect (#166). 2025-10-05 21:50:09 +01:00
Andrew Wood 3437b75256 Position updates and new strings. 2025-10-05 21:41:51 +01:00
Andrew Wood 462415a88a Note the Turkish translation updates. 2025-10-05 21:40:52 +01:00
Andrew Wood d23a7e929e Acknowledge Turkish translation updates (#168). 2025-10-05 21:40:25 +01:00
Andrew Wood f18fa637c6 Merge pull request 'Translations update from Codeberg Translate' (#168) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/168
2025-10-05 22:34:50 +02:00
Oğuz ErsenandCodeberg Translate 9bff7f0bb5 Translated using Weblate (Turkish)
Currently translated at 100.0% (134 of 134 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/tr/
2025-10-05 20:33:46 +00:00
Andrew Wood 771b61db30 Add test for over-read when using stop-at-size (#166). 2025-10-05 21:33:32 +01:00
Andrew Wood 615c1d5321 Explicitly cast both sides of the comparison to "long long", otherwise there is an overflow on 32-bit systems and stop-at-size stops at the wrong point (#166). 2025-10-05 21:20:27 +01:00
Andrew Wood 3442d7651a Use a void *, not a char *, so the types are consistent throughout. 2025-10-05 21:16:34 +01:00
Andrew Wood 7982badb65 Write a debugging line when truncating transfers for stop-at-size. 2025-10-05 21:15:58 +01:00
Andrew Wood a83a549de5 Correct the value size in the debug statement, otherwise it overflows on 32-bits systems. 2025-10-05 21:02:27 +01:00
Andrew Wood b1797c51e6 Note the new "=NAME" and "@LISTFILE" syntax additions to --watchfd. 2025-10-05 18:10:41 +01:00
Andrew Wood 8504964f1a Remove old non-functional code relating to ETAs and --size in the --watchfd loop. 2025-10-05 18:07:02 +01:00
Andrew Wood f83aa2272b Fix incorrect usage of "optarg". 2025-10-04 21:51:26 +01:00
Andrew Wood fb7c05c262 Implement the "pgrep" call for --watchfd =NAME (#95). 2025-10-04 21:50:25 +01:00
Andrew Wood e6f611f4de Adjust formatting. 2025-10-04 20:27:24 +01:00
Andrew Wood bd4ca7301c Document the new "=NAME" (#95) and "@FILE" (#12) syntax for --watchfd options. 2025-10-04 20:17:46 +01:00
Andrew Wood 242297a3c6 Partial draft of "-d @filename" (#12) and "-d =processname" syntax (#95). 2025-10-04 17:46:43 +01:00
Andrew Wood 0a658f99bb In --watchfd, when deciding whether to insert %N into the format, check for %{name} in the current format as well as the existing check for %N. 2025-10-04 14:49:06 +01:00
Andrew Wood 8df1c29c37 Note the addition of an empty Finnish translation file. 2025-10-04 00:54:48 +01:00
Andrew Wood a8b7cd19bd Add an empty translation file for Finnish. 2025-10-03 23:03:38 +01:00
Andrew Wood b4f525fd79 Merge pull request 'Translations update from Codeberg Translate' (#167) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/167
Reviewed-by: Andrew Wood <a-j-wood@noreply.codeberg.org>
2025-10-02 22:31:05 +02:00
Coral PinkandCodeberg Translate 8caa977a35 Translated using Weblate (Polish)
Currently translated at 100.0% (134 of 134 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/pl/
2025-10-02 13:23:16 +00:00
Andrew Wood f6d398738e Note the behaviour change of --stop-at-size with a zero size. 2025-10-01 22:09:33 +01:00
Andrew Wood 11dc25966d If stop_at_size is true, do not read more than control.size even if that is 0 (#166). 2025-10-01 18:06:59 +01:00
Andrew Wood efc8b33e81 Position updates. 2025-09-30 22:30:36 +01:00
Andrew Wood be066f6c8c Restrict the amount to read when --stop-at-size is active so that reads, as well as writes, never go past --size bytes (#166). 2025-09-30 22:27:25 +01:00
Andrew Wood 6a1ad7d374 Note the improvement to the control of a --watchfd with a remote -R. 2025-09-29 22:05:47 +01:00
Andrew Wood 751263376b Adjust the format and reparse the display, if a remote update -R was received while in the --watchfd loop. 2025-09-29 21:42:48 +01:00
Andrew Wood d903a7d188 Add a return value to pv_remote_check() so its caller can know whether a message was received. 2025-09-29 21:31:05 +01:00
Andrew Wood a4e2243102 Position updates. 2025-09-29 17:55:39 +01:00
Andrew Wood 9fe604df1a Move the declaration of changes_made outside the conditional, so as to not break on macOS. 2025-09-29 17:53:56 +01:00
Andrew Wood 64cd9cd85c Move the watchfd %N format insertion into its own function, so it can be called separately elsewhere in future, and to make it easier to extend the %N detection to find %{name} later as well. 2025-09-28 17:22:56 +01:00
Andrew Wood 10ef5a8596 If watching more than one distinct PID with --watchfd, display the PID as well as the FD number (#12). 2025-09-28 16:36:06 +01:00
Andrew Wood 77ed2e5989 Another minor issue noted as a TODO. 2025-09-27 18:32:27 +01:00
Andrew Wood 8ae549c47f Mention the --watchfd multiple arguments feature (#12). 2025-09-27 18:31:24 +01:00
Andrew Wood 284ceba52b Add TODO marker after some testing showed an issue. 2025-09-27 18:24:59 +01:00
Andrew Wood 3ea19829d7 Merge pv_watchpid_loop into pv_watchfd_loop, and allow multiple PID / PID:FD sets to be watched at once (#12). 2025-09-27 17:55:18 +01:00
Andrew Wood c49fc4aa57 Eliminate the fd_to_idx array in --watchfd, so that file descriptors aren't constrained to FD_SETSIZE and so we don't have to track another array. 2025-09-26 23:40:39 +01:00
Andrew Wood 7fdb6716e1 In the pvwatchfd_s structure, use booleans "displayable" and "unused" instead of having values of watch_pid=0 for unused and watch_fd=-1 for not displayable, so that each item only means one thing. 2025-09-26 23:01:07 +01:00
Andrew Wood c61c589378 Typo correction in the comment. 2025-09-26 22:29:36 +01:00
Andrew Wood c688987087 Adjust the --watchfd documentation to say that multiple PID/PID:FD arguments are allowed (#12). 2025-09-25 06:21:55 +01:00
Andrew Wood 0b2f9ec397 Only call pv_watchfd_loop() from main, so that eventually pv_watchpid_loop() can be removed and multiple "-d" values supported (#12). 2025-09-24 22:11:44 +01:00
Andrew Wood 8a8e6d71a4 Reinstate the previously removed "cannot transfer files" message for "-d". 2025-09-23 05:46:53 +01:00
Andrew Wood a0a9d682ca Reject "-o" when using "-d". 2025-09-23 05:45:43 +01:00
Andrew Wood 05a72bf75e Position updates, two new strings, one old message removed. 2025-09-23 05:39:43 +01:00
Andrew Wood 22bf08f8e4 Accept additional arguments when -d is specified, expecting them to be more pid[:fd] values (#12). 2025-09-22 21:50:35 +01:00
Andrew Wood b5fbd1978e Replace watch_pid, watch_fd with arrays, though for now only use the first item in the arrays (#12). 2025-09-21 19:50:56 +01:00
Andrew Wood db80f838ff Explicitly set an action variable to say which action to perform, instead of inferring it from other settings like whether a watch PID was set (#12). 2025-09-18 06:18:18 +01:00
Andrew Wood 8c2e934768 Add a TODO marker for the next step to take. 2025-09-18 05:47:15 +01:00
Andrew Wood dbce5b355e Add --watchfd option values to an array in the main state, as well as to the currently used variables (#12). 2025-09-17 23:12:13 +01:00
Andrew Wood 12cc996d32 Add --watchfd option values to an array as well as to the currently used variables (#12). 2025-09-17 22:12:45 +01:00
Andrew Wood 4a0f9e713c Define struct pvwatchspec_s for future use in an array for --watchfd, and add a comment defining nullable_string_t. 2025-09-16 23:05:41 +01:00
Andrew Wood 8771b901d9 Add TODO markers as part of looking at supporting multiple "-d" options (#12). 2025-09-15 20:12:55 +01:00
Andrew Wood 48ac509af7 Line number updates. 2025-09-14 16:42:42 +01:00
Andrew Wood f70627c031 Pass through indent. 2025-09-14 16:42:08 +01:00
Andrew Wood 1e6c9704b1 Adjustments to remove the need for the unqualifiedtrans and nullstate splint workarounds. 2025-09-14 16:39:47 +01:00
Andrew Wood a629a488d7 Add TODO marker for the planned next step. 2025-07-28 20:39:05 +01:00
Andrew Wood ad1d0e1c9a In the watchfd info array, instead of using copies of the global state, each fd has its own flags, transfer, calc, and display sub-structures (#165). 2025-07-28 00:25:14 +01:00
Andrew Wood 4f9d746823 Split the state reset functions into smaller pieces, so sub-structures can be reset individually (#165). 2025-07-27 23:24:56 +01:00
Andrew Wood 9fc9b6a8ed Carry the fd info_array "size" into the global "control" structure just before calling pv_display() so it gets used without having to have a per-fd copy of "control" (#165). 2025-07-27 21:39:36 +01:00
Andrew Wood 9ab82cde1e Use the original info_aray size for comparison as the "control" structure may be made irrelevant here soon (#165). 2025-07-27 21:38:55 +01:00
Andrew Wood a7f392e3c3 Address splint warnings about setting and clearing state->control.name (#165). 2025-07-27 21:34:46 +01:00
Andrew Wood 574ea04502 Instead of adding an aliased display name and having to maintain it and treat it differently, go back to keeping the name only in the "control" sub-structure of the state, but share the global state "control" across all watched fds, and just change it before each pv_display() call so it points to the relevant fd display_name when needed (#165). 2025-07-27 21:23:41 +01:00
Andrew Wood 5282a521b5 Pass only the relevant sub-structure to pv_alloc_history (#165). 2025-07-27 20:59:21 +01:00
Andrew Wood 52634f01f9 Do not call pv_state_name_set when adjusting an fd display_name, but instead set the alias state->display.name ourselves. Since the fd display_name we are pointing to is within the info_array, if we extend info_array with realloc we then have to also reset those aliases since display_name may move if realloc rebases the array. (#165) 2025-07-27 20:51:00 +01:00
Andrew Wood a0f2d9c9c7 Use status, cursor from main state, and a null extra_display, to reduce the dependency on the per-watched-fd state (#165). 2025-07-27 20:46:51 +01:00
Andrew Wood 8386c05978 Explicitly check for non-NULL rather than treating NULL as boolean false. 2025-07-27 20:43:52 +01:00
Andrew Wood 6a2b9a2788 Add an alias for the name for %N to the display sub-structure, so that the name can be varied between displays without having to alter the control value (#165). 2025-07-27 19:53:28 +01:00
Andrew Wood e04f50f0dc Change all cursor positioning functions to use sub-structures rather than the whole state structure, and if turning off cursor positioning, do so via a new flag "cursor->disable" rather than changing the operator-supplied options in "control" (#165). 2025-07-27 17:05:04 +01:00
Andrew Wood 021dc6e054 Pass individual sub-structures to pv_display, but still keep state for now, until the functions cursor.c have been updated to take sub-structures rather than the whole state (#165). 2025-07-27 15:56:03 +01:00
Andrew Wood 7d7efac7c6 Move the terminal_supports_utf8, terminal_supports_colour, and checked_colour_support flags out of "control" and into "status", as they are not operator-supplied options, but are program-generated status flags; this will allow "control" to remain read-only for larger parts of the program (#165). 2025-07-27 15:37:16 +01:00
Andrew Wood f79bed3cb8 Rename "can_display_colour" and "can_display_utf8" to "terminal_supports_colour" and "terminal_supports_utf8" to make it clearer that these are not operator-supplied option settings, they are derived from terminal capabilities (colour) and the environment (UTF-8). 2025-07-27 15:20:05 +01:00
Andrew Wood 2171f40703 Address the splint warning. 2025-07-27 00:34:09 +01:00
Andrew Wood 960ff1572f Pass state->status, rather than state itself, to pv_format (#165). 2025-07-27 00:31:45 +01:00
Andrew Wood da2a2e6fd2 Remove the state from the pv_error arguments, by adding a new function pv_set_error_prefix to call on startup, eliminating the need for a state program_name string; and add a private boolean to track whether there has been any output which means errors need preceding by a newline, which is updated by pv_display directly (#165). 2025-07-27 00:22:57 +01:00
Andrew Wood 005bc2f841 Pass the sub-structures separately to pv_format and pv__format_init rather than the whole state; but still pass state for now, as pv_error needs it (#165). 2025-07-26 22:49:29 +01:00
Andrew Wood ecc0c0e414 Adjust the readonly structure pointer types so the pointer itself is not read-only but the thing it points to is; and change the display formatters to use pointers to control, transfer, and calc structures instead of the whole state, with read-only access enforced at compile time (#165). 2025-07-26 22:28:39 +01:00
Andrew Wood 18548d217b Rename struct pvipcstate_s to pvcursorstate_s since it is for cursor positioning, not for IPC (#165). 2025-07-26 21:30:16 +01:00
Andrew Wood 653326ca9b Rename struct pvcursorstate_s to pvipccursorstate_s for clarity since it is only for IPC (#165). 2025-07-26 21:29:20 +01:00
Andrew Wood 0cf8902d9b Rename display structure member "display_visible" to "output_produced" for clarity. 2025-07-26 21:25:54 +01:00
Andrew Wood 762676f4e1 Make pv_tty_write take only the transient flags part of the state rather than the whole state, and rename the "flag" part of the state to "flags" for better readability (#165). 2025-07-26 21:18:13 +01:00
Andrew Wood 3bd49a0c3f Ensure the current average rate calculation can't accidentally divide by zero. 2025-07-26 20:53:22 +01:00
Andrew Wood 870dfad9fd Introduce read-only structure pointer typedefs for each of the state sub-structures, so the compiler will catch anywhere that a function would alter a structure it isn't expected to (#165). 2025-07-26 20:51:28 +01:00
Andrew Wood 3b0891b128 Pass more specific structures to pv_calculate_transfer_rate rather than the whole state (#165). 2025-07-26 19:22:07 +01:00
Andrew Wood b3c854b27a Add typedefs for the pointers to the sub-structures within struct pvstate_s, so they can be used as types in function declarations (#165). 2025-07-26 18:33:24 +01:00
Andrew Wood a923bdaca4 Give struct names to each of the sub-structures within struct pvstate_s, so they can be used as types in function declarations (#165). 2025-07-26 18:24:47 +01:00
Andrew Wood 0070a74390 Correct a minor typo in a comment. 2025-07-26 17:57:46 +01:00
Andrew Wood 283bafa228 Word wrap update from auto generation. 2025-07-26 14:58:02 +01:00
Andrew Wood 03bd428345 Timestamp updates. 2025-07-26 14:50:58 +01:00
Andrew Wood f77b853f3f Commit to a release date. 2025-07-26 14:50:39 +01:00
Andrew Wood 43a89a5c61 Line number updates. 2025-07-25 23:58:17 +01:00
Andrew Wood 44d7f94c31 Version bump. 2025-07-25 23:57:51 +01:00
Andrew Wood 7c84dc9890 Note the fix for #163. 2025-07-25 23:57:23 +01:00
Andrew Wood 025577a13f Free default_bar_style on exit. 2025-07-25 23:46:24 +01:00
Andrew Wood c180cc85cf Allocate the state copy's default_bar_style using the setter function rather than pv_strdup directly (#163). 2025-07-25 23:44:12 +01:00
Andrew Wood 092a30dd7d When watching file descriptors, duplicate the default_bar_style string rather than copying its pointer, to avoid double-free() (#163). 2025-07-25 23:40:41 +01:00
Andrew Wood cd7c8f7849 Version bump. 2025-07-25 22:32:05 +01:00
Andrew Wood 89ee1332fe Timestamp and line number update. 2025-07-25 22:31:52 +01:00
Andrew Wood b926fffe80 Note issue #164. 2025-07-25 22:08:44 +01:00
Andrew Wood 7924a796ea Add debugging message when SIGPIPE is received. 2025-07-25 20:49:50 +01:00
Andrew Wood 8d45738126 Line number updates. 2025-07-25 20:14:37 +01:00
Andrew Wood e687c9b4d9 When EOF on input and output is reached but the output pipe buffer is not empty, sleep for a short time before looping while waiting for the buffer to empty, to avoid a busy-wait (#164). 2025-07-25 20:13:49 +01:00
Andrew Wood d2e9028726 Add debugging output to pv_transfer wherever it returns zero (#164) 2025-07-25 19:49:02 +01:00
Andrew Wood e6638faffc New shorter home page URL. 2025-05-31 15:21:56 +01:00
Andrew Wood f000530746 Correct which language Maxi_Mega is acknowledged for providing translations to. 2025-05-31 15:15:56 +01:00
Andrew Wood 5bf04f841b Acknowledge translations from user milimarg. 2025-05-31 15:12:55 +01:00
Andrew Wood 5d95797aff Merge pull request 'Translations update from Codeberg Translate' (#162) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/ivarch/pv/pulls/162
2025-05-31 16:07:58 +02:00
milimargandCodeberg Translate 9db2907a48 Translated using Weblate (French)
Currently translated at 100.0% (132 of 132 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/fr/
2025-05-31 08:58:24 +00:00
Andrew Wood 5423ae40d6 Removed www. prefix from ivarch.com URL. 2025-02-19 23:18:56 +00:00
Andrew Wood 2de68acfea Remove the bug reporting email address. 2025-02-19 21:55:28 +00:00
Andrew Wood 71e29b7388 Adjust project URL. 2025-02-19 20:42:22 +00:00
Andrew Wood 6d6619cbb4 Merge pull request 'Translations update from Codeberg Translate' (#129) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/129
2025-02-09 17:18:14 +00:00
a-j-woodandCodeberg Translate 651053491e Translated using Weblate (French)
Currently translated at 90.1% (119 of 132 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/fr/
2025-02-09 17:17:10 +00:00
Andrew Wood 81f9919992 Acknowledge new French translations. 2025-02-09 17:16:44 +00:00
Andrew Wood b57170d596 Merge pull request 'Translations update from Codeberg Translate' (#128) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/128
2025-02-09 17:11:41 +00:00
Maxi_MegaandCodeberg Translate 60462c033b Translated using Weblate (French)
Currently translated at 90.1% (119 of 132 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/fr/
2025-02-09 16:43:58 +00:00
Andrew Wood 3f597e59e0 Adjust the installer test to retry with both "gmake" and "make", to work around strange behaviour on NetBSD. 2025-01-28 22:10:49 +00:00
Andrew Wood a62051e5ff Adjust the sensitivity of the test. 2025-01-28 21:35:42 +00:00
Andrew Wood 5483ddf024 Version bump. 2025-01-28 21:22:12 +00:00
Andrew Wood 62ef4b91fc Timestamp update. 2025-01-28 21:21:56 +00:00
Andrew Wood 8664521f08 Reformat with indent; update translation string line numbers. 2025-01-26 20:08:17 +00:00
Andrew Wood 6ef23916f0 Adjust formatting of indented paragraphs. 2025-01-25 21:38:26 +00:00
Andrew Wood 73f8a2fb02 Acknowledge #127. 2025-01-25 21:34:21 +00:00
Andrew Wood a552fc5329 Document the use of "--numeric" with "--format". 2025-01-25 21:28:33 +00:00
Andrew Wood 505a91a6ed In --numeric mode, still call the same formatting functions, only with a different default string, and end with a newline rather than a carriage return (#127). 2025-01-25 21:15:05 +00:00
Andrew Wood 0d3b678800 Format the average rate, byte/line count, percentage completion, transfer rate, and elapsed time as just a number on its own in numeric mode. 2025-01-24 23:10:59 +00:00
Andrew Wood efb115c2aa Remove the TODO since buffer utilisation may not be useful with --numeric, as it is not always a number. 2025-01-24 23:07:05 +00:00
Andrew Wood 8721d285ce Add TODO markers at possible touch points for "--numeric --format" implementation (#127). 2025-01-23 21:56:57 +00:00
Andrew Wood f421f9979d Acknowledge updated Polish and Russian translations. 2025-01-15 21:20:37 +00:00
Andrew Wood d5ad641102 Merge pull request 'Translations update from Codeberg Translate' (#126) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/126
2025-01-15 21:17:23 +00:00
0koandCodeberg Translate ec6199c973 Translated using Weblate (Russian)
Currently translated at 90.1% (119 of 132 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/ru/
2025-01-15 19:08:24 +00:00
coralpinkandCodeberg Translate 0eb09d097e Translated using Weblate (Polish)
Currently translated at 100.0% (132 of 132 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/pl/
2025-01-15 19:08:24 +00:00
Andrew Wood 13265b3d6b Note the translation update. 2025-01-14 21:19:53 +00:00
Andrew Wood dbc7cd7bac Update the translation acknowledgements. 2025-01-14 20:54:46 +00:00
Andrew Wood 4c1f36cda4 Merge pull request 'Translations update from Codeberg Translate' (#125) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/125
2025-01-14 20:42:58 +00:00
BennyandCodeberg Translate 987af6ba16 Translated using Weblate (German)
Currently translated at 100.0% (132 of 132 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/de/
2025-01-14 20:39:46 +00:00
m0yellowandCodeberg Translate 58451ae18b Translated using Weblate (German)
Currently translated at 100.0% (132 of 132 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/de/
2025-01-14 17:19:02 +00:00
Andrew Wood cd2f5cbbfa Date adjustment. 2025-01-12 13:41:35 +00:00
Andrew Wood 896ff890d8 Adjustments to reduce false positives on slow systems. 2025-01-12 13:14:38 +00:00
Andrew Wood 8ba24e39e0 Version bump. 2025-01-11 21:40:02 +00:00
Andrew Wood 0cf4e50e96 Timestamp update. 2025-01-11 21:22:02 +00:00
Andrew Wood c8ad7eb0e2 Bypass valgrind checks on ARM by default due to false positives. 2025-01-11 20:57:26 +00:00
Andrew Wood 42e47e8291 Turn off IPC support when sys/shm.h is missing, to fix compilation on Termux. 2025-01-10 23:23:07 +00:00
Andrew Wood 7d6c7d0735 Copyright note update for 2025. 2025-01-03 16:11:08 +00:00
Andrew Wood 16177a3b9d Record the issue associated with the fault. 2024-12-22 12:19:25 +00:00
Andrew Wood 16a16460fc Version and date update. 2024-12-22 12:18:42 +00:00
Andrew Wood 24d3351d5d Position updates. 2024-12-22 12:10:08 +00:00
Andrew Wood daa06e5415 Note the macOS --watchfd fix. 2024-12-22 11:30:57 +00:00
Andrew Wood dc6cd1819d Initialise the newly allocated memory, not the pointer to it. 2024-12-22 11:29:21 +00:00
Andrew Wood 1ef1d858f8 Initialise the newly allocated memory. 2024-12-22 11:24:52 +00:00
Andrew Wood 74c75d36cc Move the array bounds check outside the conditional section, so that it is also performed on macOS. 2024-12-22 11:15:29 +00:00
Andrew Wood 7a4264fe1e Do not show negative timer values. 2024-12-22 00:42:01 +00:00
Andrew Wood 5decddeb42 Ensure the dynamic segment width never tries to go negative. 2024-12-22 00:21:34 +00:00
Andrew Wood 0f08153214 Skip the valgrind tests when building an RPM, as it appears that the optimisation flags do not work well with valgrind and lead to false results. 2024-12-19 22:01:56 +00:00
Andrew Wood 5c3743e1f8 Skip the valgrind tests when building an RPM, as it appears that the optimisation flags do not work well with valgrind and lead to false results. 2024-12-19 21:40:11 +00:00
Andrew Wood 4a287f96fd Timestamp update. 2024-12-19 21:11:17 +00:00
Andrew Wood 0c35ae8d9e Add missing formatter source to POTFILES.in. 2024-12-19 21:10:44 +00:00
Andrew Wood ddb2ff9b06 Follow similar formatting conventions to the manual. 2024-12-19 21:03:48 +00:00
Andrew Wood 32398dd5fb Follow similar formatting conventions to the manual. 2024-12-19 21:01:15 +00:00
Andrew Wood cec252f98f Version adjustment and news reformatting for release. 2024-12-19 20:50:06 +00:00
Andrew Wood c186198a7e Line number updates. 2024-12-18 22:41:38 +00:00
Andrew Wood ec46261757 Type boundary checks. 2024-12-18 22:23:19 +00:00
Andrew Wood ff0355ca9c Make the moving indicator more granular on wide displays by calculating its position with floating point rather than integer values. 2024-12-18 21:59:17 +00:00
Andrew Wood 2bd364fee8 Add TODO note. 2024-12-18 00:01:10 +00:00
Andrew Wood 823350a186 Preliminary version update. 2024-12-17 23:57:26 +00:00
Andrew Wood c58ddb4d66 Line number updates. 2024-12-17 23:57:07 +00:00
Andrew Wood 447ec06234 Note the memory footprint reduction. 2024-12-17 23:56:00 +00:00
Andrew Wood 21ca350946 Use specific types for display widths, byte counts, and type of format string component, mainly to have the option of packing more into less space. 2024-12-17 23:55:15 +00:00
Andrew Wood 46902e1c0c Line number updates. 2024-12-17 23:02:44 +00:00
Andrew Wood 02bf302f96 If ncurses is not supported, provide code to call "tputs" via popen(), but do not enable it because it is not very safe, and instead just assume colour is always available. 2024-12-17 22:48:43 +00:00
Andrew Wood 76327fdf01 Only set format_uses_colour if colour is permitted for this display (i.e. the display is for a terminal and not a process or window title). 2024-12-17 22:47:41 +00:00
Andrew Wood 0044ed18ae Use AS_HELP_STRING() consistently. 2024-12-17 21:42:56 +00:00
Andrew Wood a9bbb55220 Preliminary version update. 2024-12-17 21:37:11 +00:00
Andrew Wood 69a2358d47 Add a version and date. 2024-12-16 21:25:39 +00:00
Andrew Wood 8664395e5b Adjust the script so it does not specifically apply to this package and can be re-used in others. 2024-12-16 21:25:25 +00:00
Andrew Wood 3c09b31f92 Add colour code support with a %{sgr:...} format sequence. 2024-12-15 23:25:20 +00:00
Andrew Wood 43e2eaa4db Removed misplaced splint annotation. 2024-12-15 22:54:15 +00:00
Andrew Wood f3e98da13b Prevent the background test components from waiting forever for the following PV process to start. 2024-12-15 15:00:51 +00:00
Andrew Wood 25eaa2661a Note the test race condition cleanup. 2024-12-15 14:42:52 +00:00
Andrew Wood 4f58a3d751 Make background test processes wait for their subsequent foreground PV to start, to make a race condition less likely to trigger test failures on slower systems. 2024-12-15 13:36:14 +00:00
Andrew Wood 7d18083dda Handle the fact that the GNU Hurd sets the signal sender PID to -1, not either 0 or the signal sender, in the siginfo structure. 2024-12-14 23:41:24 +00:00
Andrew Wood f0aca0a2ce Store the calculated percentage as a double rather than an int, so the granular progress bar is still granular on wide displays. 2024-12-14 17:06:37 +00:00
Andrew Wood 18c76175b2 Read the PID from the correct work file when testing remote control of the extra display. 2024-12-14 16:28:51 +00:00
Andrew Wood 6dbde0c559 Acknowledge issue #15. 2024-12-14 00:08:57 +00:00
Andrew Wood 8fa9df6e7a New --bar-style option; replace "default" with "plain" or with a lookup against the selected default, as appropriate. 2024-12-14 00:06:30 +00:00
Andrew Wood e3382b1a62 Document the %{bar-*} format sequences. 2024-12-13 23:15:08 +00:00
Andrew Wood 29c7a21725 Increase the size of the progress bar buffer. 2024-12-13 20:55:39 +00:00
Andrew Wood 7a0ee9c7fa Correct the width calculations. 2024-12-13 20:54:11 +00:00
Andrew Wood cb71277df4 Allocate more space for the display buffer, as wide characters take up more room. 2024-12-13 20:38:45 +00:00
Andrew Wood 9f5923864b Inhibit UTF-8 based bar formats when UTF-8 output support is not detected, falling back to the default format instead. 2024-12-13 20:17:01 +00:00
Andrew Wood 60563f3e3c New bar formats - default, block, granular, shaded - with the granular format providing a smoother bar using Unicode block characters (#15) 2024-12-13 20:02:36 +00:00
Andrew Wood c49abf1608 Indentation updates. 2024-12-13 19:57:18 +00:00
Andrew Wood 250a794873 Add globs to the indent, indentclean, and clean-local targets. 2024-12-13 19:46:31 +00:00
Andrew Wood 78f4a60bf7 Change the formatter functions to take their 6 arguments as one struct pointer, making it less messy. 2024-12-12 22:36:07 +00:00
Andrew Wood 2a93e33d38 Add a rate-limiting example. 2024-12-11 21:40:08 +00:00
Andrew Wood 5efd4d045f Adjust the way the leading space is formatted, to better translate to Markdown. 2024-12-10 23:10:57 +00:00
Andrew Wood 0516ba53bd Remove the example with "dialog" and add a more usual use case with tar. 2024-12-10 23:08:00 +00:00
Andrew Wood 1d76c0bc64 Permit decimals with suffix for --size, --rate-limit, --buffer-size, and --error-skip-block (#35); and document the types of numbers allowed in the manual. 2024-12-10 22:09:32 +00:00
Andrew Wood 73bc1ab139 Classify --watchfd and --remote as "alternative operating modes" rather than "data transfer modifiers" since they change the way PV runs entirely. 2024-12-10 21:05:59 +00:00
Andrew Wood 35fdb331e4 Add a leading space to the exit status codes, for readability. 2024-12-10 21:01:38 +00:00
Andrew Wood 9ceda2059d Set the indent so that the exit status items do not waste a line each. 2024-12-10 20:59:04 +00:00
Andrew Wood 0e24c9f453 Use long options in examples where it makes sense to do so, for readability. 2024-12-10 20:56:25 +00:00
Andrew Wood ad54067b48 Note that --watchfd works on macOS as well as Linux, and correct the capitalisation of macOS elsewhere. 2024-12-10 20:50:53 +00:00
Andrew Wood e99a58b430 Remove the SY macros from the manual since they are not universally supported, and replace the technically correct and complete, but user-hostile, synopsis with a simplified version that lists the main modes of operation. 2024-12-10 20:44:43 +00:00
Andrew Wood 51a5de71c1 Add a "can_display_utf8" flag based on the current locale, for future use. 2024-12-09 23:23:07 +00:00
Andrew Wood 06eca8cefa Renamed for consistency - pv__ for static functions, and name the array an array. 2024-12-09 21:52:25 +00:00
Andrew Wood a4494159ea Positions update after moving the formatter functions. 2024-12-09 21:46:00 +00:00
Andrew Wood c95e25776e Move the formatter functions into separate files so that display.c is less of a monolith; and replace the ctype.h macros with internal versions. 2024-12-09 21:42:16 +00:00
Andrew Wood c2a5be6aa9 Allow SKIP_VALGRIND_TESTS to be passed through to package building. 2024-12-08 23:15:31 +00:00
Andrew Wood 135eb71a75 Make the issues into links. 2024-12-08 23:13:29 +00:00
Andrew Wood af99120067 Timestamp update. 2024-12-08 22:22:22 +00:00
Andrew Wood 2d28520ae4 Version bump. 2024-12-08 22:21:45 +00:00
Andrew Wood 35d5b9efab Handle wide characters and ECMA-48 CSI sequences in the format string when calculating string widths. 2024-12-08 21:38:38 +00:00
Andrew Wood f495303177 List all supported format sequences in the output of "--help". 2024-12-08 20:40:05 +00:00
Andrew Wood fb2e6b4074 New "--format" sequences "{progress-bar-only}" and "{progress-amount-only}". 2024-12-08 20:13:33 +00:00
Andrew Wood 4ffdee0002 Introduce the pv_strwidth() function so that in future we can add support for escape sequences and UTF-8 in format strings. 2024-12-08 17:40:12 +00:00
Andrew Wood 5c5d53e1d1 Address two splint-related TODOs. 2024-12-08 17:31:59 +00:00
Andrew Wood 269d2f5729 Correction to "make indentclean". 2024-12-08 17:27:06 +00:00
Andrew Wood 57149c2d03 Add long names to format sequences, such as "%{rate}". 2024-12-08 17:16:02 +00:00
Andrew Wood 838ebcb78f Improve the handling of dangling or invalid "%" sequences. 2024-12-08 16:18:58 +00:00
Andrew Wood 6298a7be9d Refactor the display formatters into their own functions, remove the static arrays for component contents, and start tracking the displayed width of each segment separately from the length in bytes. 2024-12-08 16:04:00 +00:00
Andrew Wood cfea00b200 Use standalone flags to indicate whether we are tracking the last bytes output or the previous line written, so that the component array is not needed outside of display.c. 2024-12-08 10:23:24 +00:00
Andrew Wood 3d52919411 Remove the caveat about only specifying "%p" once, as it can now be used more than once. 2024-12-07 23:26:12 +00:00
Andrew Wood 52ea1b5ba2 Acknowledge %nL (#121). 2024-12-07 23:24:51 +00:00
Andrew Wood 619a84949f New format sequence "%nL" to display the most recently written line (#121). 2024-12-07 23:12:41 +00:00
Andrew Wood c3648af57f Handle the progress bar appearing more than once in the format string. 2024-12-07 20:23:20 +00:00
Andrew Wood 53b5ea54c6 Track the chosen size of format segments so that "%nA" can appear more than once, with different "n" values (#122). 2024-12-07 19:39:44 +00:00
Andrew Wood c4c7b9ec00 Refer to "bytes" rather than "length", so that in future we can differentiate between the number of bytes in a string and how many display columns it occupies. 2024-12-07 17:17:59 +00:00
Andrew Wood b428e7613d Revert back to one test at a time, make it tunable. 2024-12-07 16:39:12 +00:00
Andrew Wood 0e9534c10e Correct how the permissions are set, now that subdirectories are present. 2024-12-07 16:20:48 +00:00
Andrew Wood 7f8aa3f985 Timestamp update. 2024-12-07 14:31:54 +00:00
Andrew Wood 238e07e7d7 Add a section to generate OS packages containing the compiled program. 2024-12-07 14:30:27 +00:00
Andrew Wood b6462ad865 Correction for compatibility with Debian 11. 2024-12-07 14:27:38 +00:00
Andrew Wood 2d7d854a97 Allow all tests to be skipped if SKIP_ALL_TESTS is 1. 2024-12-07 14:23:03 +00:00
Andrew Wood 0626737a15 Pass "-j4" to "make" during the checks. 2024-12-07 13:34:36 +00:00
Andrew Wood 17a1c9d639 Keep the exit trap. 2024-12-07 02:29:48 +00:00
Andrew Wood 31ea20dbd3 New script to help with the release process. 2024-12-07 02:20:30 +00:00
Andrew Wood 97c48c8901 Allow valgrind tests to be skipped with an environment variable. 2024-12-07 02:20:04 +00:00
Andrew Wood bb339ba519 New script to build a package from the source (.rpm, .deb). 2024-12-07 01:26:44 +00:00
Andrew Wood 499f8418bf Move dev/test scripts from dist_doc_DATA to EXTRA_DIST so they do not get installed in /usr/share/doc/ but are just included in the sources. 2024-12-07 01:23:20 +00:00
Andrew Wood b84432ec7f Change buffer pointer type to "char *" to avoid doing pointer arithmetic on "void *". 2024-12-06 22:46:28 +00:00
Andrew Wood 111b514a05 Replace non-standard \e with \033. 2024-12-06 19:39:57 +00:00
Andrew Wood 90829dad51 Minor formatting tweaks. 2024-12-05 23:32:34 +00:00
Andrew Wood 943e433f7e Implement test of cross-compilation with the check being run on a host of the target type. 2024-12-05 21:54:16 +00:00
Andrew Wood 02e6d0e04c Skip this test if environment file XCFILE is set to 1. 2024-12-05 21:52:57 +00:00
Andrew Wood 1e7c92a107 Reworked to allow cross-compilation, but not yet finished. 2024-12-04 23:53:31 +00:00
Andrew Wood 2a97d699a8 Minor updates. 2024-12-04 22:05:17 +00:00
Andrew Wood 2d0321e544 Draft test script to run "make check" on multiple VMs at once. 2024-12-04 22:02:59 +00:00
Andrew Wood ebb209a371 Add support for --extra-display to --remote (#123). 2024-12-03 23:48:44 +00:00
Andrew Wood ddd9430bc9 Line positions update. 2024-12-03 23:48:15 +00:00
Andrew Wood cc37877607 Acknowledge the assistance with issue #120. 2024-12-03 22:00:37 +00:00
Andrew Wood b35591ff8d Note the cross-compilation fix. 2024-12-03 22:00:14 +00:00
Andrew Wood 29423f1f9a Add a cross-compilation check before release. 2024-12-03 21:59:53 +00:00
Andrew Wood d51c57379a When cross-compiling, we cannot run a test program to check whether a siginfo_t provides the signal sender PID, so we fall back to assuming that it does, and also check that SA_SIGINFO is declared so compilation will not fail on systems without it (#120). 2024-12-03 21:04:58 +00:00
Andrew Wood 5f86aed17d Adjust the "configure" instructions. 2024-12-02 18:03:10 +00:00
Andrew Wood 99bd1fc8d5 Version bump and associated updates. 2024-12-02 17:57:34 +00:00
Andrew Wood 70f2f9f1b7 Minor wording update. 2024-12-02 17:46:26 +00:00
Andrew Wood cf9e33a4e4 Rename the installation section to reflect what it is for. 2024-12-02 17:40:14 +00:00
Andrew Wood c07d6f9c49 Reword the compilation instructions. 2024-12-02 17:39:32 +00:00
Andrew Wood 503a559b2a Move "--extra-display" and "--stats" to the "Output modifiers" section, since they are not really display switches that directly affect the terminal progress display. 2024-12-02 17:36:16 +00:00
Andrew Wood 2dac3d1128 Acknowledge the reporting of issue #118. 2024-12-02 17:31:46 +00:00
Andrew Wood d7d87fed76 Restructure and reformat the manual to be more in line with man-pages(7), with some small wording changes; move -8 and -k to the modifiers section rather than display switches; adjust "--help" output to report the options in the same order the manual lists them. 2024-12-02 00:02:18 +00:00
Andrew Wood c08349517b Acknowledge the submitters of issues #3 and #4. 2024-12-01 19:44:57 +00:00
Andrew Wood f3774b5987 Indentation update. 2024-12-01 19:40:33 +00:00
Andrew Wood dccc7345ab New option "--extra-display" (#3, #4). 2024-12-01 19:39:59 +00:00
Andrew Wood 7e51fb8371 Update line numbers. 2024-12-01 16:09:29 +00:00
Andrew Wood 0d7c9ac091 Address splint warnings. 2024-12-01 16:05:17 +00:00
Andrew Wood aee34fce32 Address splint warnings when debugging is turned off. 2024-12-01 15:55:48 +00:00
Andrew Wood c29d306d10 Additional configure.ac cleanups. 2024-12-01 15:42:59 +00:00
Andrew Wood a5edc8071c Note that we now test at compile time whether siginfo_t is usable for --remote (#119). 2024-12-01 15:28:18 +00:00
Andrew Wood 106a673ba8 Test at compile time whether siginfo_t is usable for --remote (#119). 2024-12-01 15:26:59 +00:00
Andrew Wood 99fe01a0d6 Note the test script shellcheck warnings cleanup. 2024-12-01 15:18:28 +00:00
Andrew Wood 94e496c77e Raise an error if variables are not defined. 2024-12-01 14:01:10 +00:00
Andrew Wood 5a9a694050 Acknowledge issue #97 2024-12-01 09:46:54 +00:00
Andrew Wood 68c8046a55 Record the sending PID before setting the flag saying we received a signal. 2024-12-01 01:27:48 +00:00
Andrew Wood c3fae61dda Include the control filename in the error message when a SIGUSR2 is received and the control file cannot be opened. 2024-12-01 01:10:47 +00:00
Andrew Wood b783e5fa63 Memory safety check for --watchfd. 2024-11-30 23:40:09 +00:00
Andrew Wood 869a4e68a4 Memory safety check for --watchfd. 2024-11-30 23:39:32 +00:00
Andrew Wood 2ad827dfb9 Note the watchfd tests. 2024-11-30 23:39:18 +00:00
Andrew Wood fa745f2cfe Test "--watchfd PID". 2024-11-30 22:55:00 +00:00
Andrew Wood e8cc443681 Note the fd leak false positive workaround. 2024-11-30 22:30:35 +00:00
Andrew Wood 97fc6a10a4 Work around issues with valgrind 3.23.0 treating inherited open file descriptors as an error with --track-fds=yes (#97). 2024-11-30 22:26:20 +00:00
Andrew Wood d0218bfe54 Skip this test where "-d" is not available. 2024-11-30 22:25:20 +00:00
Andrew Wood b8b7ff882d Position updates. 2024-11-30 17:46:17 +00:00
Andrew Wood c17b6a8821 Add the new test. 2024-11-30 17:46:01 +00:00
Andrew Wood 2b489bae26 Correction to the file and descriptor handling. 2024-11-30 17:32:42 +00:00
Andrew Wood a9d4bf4a25 Fix bug with "--watchfd" not reporting file positions (#118). 2024-11-30 17:25:12 +00:00
Andrew Wood 0d618efd0d Remove pointless EOF lines from all sources. 2024-11-30 16:40:50 +00:00
Andrew Wood 5b0697b68c Add a test for --watchfd with a single file descriptor. 2024-11-30 16:35:30 +00:00
Andrew Wood 725b5f7932 Line numbers update. 2024-11-03 01:40:34 +00:00
Andrew Wood 2945d4ce08 Update POTFILES.in. 2024-11-03 01:40:14 +00:00
Andrew Wood 14ff1451ce Translation acknowledgements update. 2024-10-22 22:18:36 +01:00
Andrew Wood 27716597d5 Merge pull request 'Translations update from Codeberg Translate' (#117) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/117
2024-10-22 21:17:04 +00:00
0koandCodeberg Translate fd86520e91 Translated using Weblate (Russian)
Currently translated at 91.2% (115 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/ru/
2024-10-22 18:07:48 +00:00
Andrew Wood 815ed8e768 Insights update from Weblate. 2024-10-20 16:38:17 +01:00
Andrew Wood 08f61b33f0 Merge pull request 'Translations update from Codeberg Translate' (#116) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/116
2024-10-20 15:37:09 +00:00
0koandCodeberg Translate cb8f37bd2a Translated using Weblate (Russian)
Currently translated at 88.8% (112 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/ru/
2024-10-20 14:07:50 +00:00
coralpinkandCodeberg Translate b13277c156 Translated using Weblate (Polish)
Currently translated at 100.0% (126 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/pl/
2024-10-20 14:07:50 +00:00
Andrew Wood b4438bbdfb Explain exactly what pv__write_pidfile is intended to do, in its header comment. As per reviewer suggestions, replace the unexplained constant buffer size padding with a static template string and an extra strlen(), and explain why the flawfinder check is being bypassed. 2024-10-20 13:40:37 +01:00
Andrew Wood 5af711465d Formatting typo fix. 2024-10-17 20:43:16 +01:00
Andrew Wood 32cbad389a Acknowledge Russian translations. 2024-10-17 20:42:51 +01:00
Andrew Wood 6022578901 Merge pull request 'Translations update from Codeberg Translate' (#115) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/115
2024-10-17 19:30:39 +00:00
0koandCodeberg Translate 740acf3664 Translated using Weblate (Russian)
Currently translated at 67.4% (85 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/ru/
2024-10-17 19:19:35 +00:00
Andrew Wood 46e07b2ec3 Added empty translation file for Russian. 2024-10-17 05:34:26 +01:00
Andrew Wood 0318db838e Version bump. 2024-10-15 22:11:38 +01:00
Andrew Wood 04400b0d18 Indent home link. 2024-10-15 21:57:37 +01:00
Andrew Wood 69c5572161 Mention contributors first. 2024-10-15 21:56:01 +01:00
Andrew Wood 0d63932eab Consistently quote the "-" characters where used for options. 2024-10-15 21:10:27 +01:00
Andrew Wood bb6c120691 Replace "zero byte" with "null byte" as per man-pages style guide. 2024-10-15 21:07:04 +01:00
Andrew Wood e657f745f4 Add back the simplest synopsis line. 2024-10-15 21:04:01 +01:00
Andrew Wood 9a1c9173a3 More specific option groups in the synopsis. 2024-10-14 23:37:18 +01:00
Andrew Wood dc648a5368 Work around a pandoc formatting bug with .OP when it wraps to have a square bracket at the start of the line. 2024-10-14 23:36:48 +01:00
Andrew Wood 84651210e6 Manual formatting fix. 2024-10-14 22:46:38 +01:00
Andrew Wood 054183b73a Provide a complete synopsis. 2024-10-14 22:28:05 +01:00
Andrew Wood d0612752f0 Use the right macros for examples and URLs. 2024-10-14 22:02:22 +01:00
Andrew Wood c3a1810890 Remove accidental commit. 2024-10-14 21:49:03 +01:00
Andrew Wood 51de6abbed Formatting correction. 2024-10-14 21:48:44 +01:00
Andrew Wood 94f4a239cc Document the zsh 5.8 issue from #105 in the manual. 2024-10-14 21:46:01 +01:00
Andrew Wood 14a23268ad Mention the new Czech translations. 2024-10-14 21:25:16 +01:00
Andrew Wood 35a9bfe025 Translation acknowledgements update. 2024-10-13 21:53:58 +01:00
Andrew Wood 212bf3e96e Merge pull request 'Translations update from Codeberg Translate' (#114) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/114
2024-10-13 20:45:08 +00:00
mmatousandCodeberg Translate 9021a7ceec Translated using Weblate (Czech)
Currently translated at 100.0% (126 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/cs/
2024-10-13 20:43:00 +00:00
fnetXandCodeberg Translate b56cf08319 Translated using Weblate (German)
Currently translated at 99.2% (125 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/de/
2024-10-13 20:43:00 +00:00
Andrew Wood a09ef9576d Acknowledgements update for Czech translations. 2024-10-13 18:02:51 +01:00
Andrew Wood ea70bbc1b6 Merge pull request 'Translations update from Codeberg Translate' (#113) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/113
2024-10-13 16:57:22 +00:00
mmatousandCodeberg Translate 6fce88d93a Translated using Weblate (Czech)
Currently translated at 41.2% (52 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/cs/
2024-10-13 16:30:07 +00:00
Andrew Wood 82edb8cdf1 Escape the @ in @FILE. 2024-10-13 17:18:47 +01:00
Andrew Wood 5ba70e05fc Escape the @ in @FILE. 2024-10-13 17:18:05 +01:00
Andrew Wood 5c036059f8 Escape the @ in @FILE. 2024-10-13 17:16:14 +01:00
Andrew Wood a3c52ca679 Added empty translation file for Spanish. 2024-10-13 15:46:29 +01:00
Andrew Wood f8138974c1 Remove default comments. 2024-10-13 15:46:12 +01:00
Andrew Wood 08908a5511 Added empty translation file for Czech. 2024-10-13 14:49:22 +01:00
Andrew Wood 50df3e415d Make it clearer that new languages can be added by raising an issue. 2024-10-13 13:16:53 +01:00
Andrew Wood b3b385dd06 Formatting correction. 2024-10-13 01:04:20 +01:00
Andrew Wood 1047e9096a Update to translation acknowledgements. 2024-10-13 01:03:15 +01:00
Andrew Wood 772afe4b5b Merge pull request 'Translations update from Codeberg Translate' (#111) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/111
2024-10-12 23:52:45 +00:00
a-j-woodandCodeberg Translate 6a791267a0 Translated using Weblate (Turkish)
Currently translated at 100.0% (126 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/tr/
2024-10-12 23:51:11 +00:00
Andrew Wood e9b7e13be1 Merge pull request 'Translations update from Codeberg Translate' (#110) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/110
2024-10-12 22:38:38 +00:00
omerdduranandCodeberg Translate 516d64a1ff Translated using Weblate (Turkish)
Currently translated at 100.0% (126 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/tr/
2024-10-12 22:28:46 +00:00
Andrew Wood af7079f708 Merge pull request 'Translations update from Codeberg Translate' (#109) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/109
2024-10-12 21:40:46 +00:00
omerdduranandCodeberg Translate 93502bb64b Translated using Weblate (Turkish)
Currently translated at 49.2% (62 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/tr/
2024-10-12 21:40:23 +00:00
omerdduranandCodeberg Translate 0b74716668 Translated using Weblate (Turkish)
Currently translated at 46.8% (59 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/tr/
2024-10-12 21:38:49 +00:00
omerdduranandCodeberg Translate 61a8f2adea Translated using Weblate (Turkish)
Currently translated at 46.0% (58 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/tr/
2024-10-12 21:38:31 +00:00
omerdduranandCodeberg Translate 4d9701613f Translated using Weblate (Turkish)
Currently translated at 19.0% (24 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/tr/
2024-10-12 21:20:04 +00:00
Andrew Wood 90ab359ed3 Add a comment to say what this does. 2024-10-12 16:11:57 +01:00
Andrew Wood 8ef234dacf Merge pull request 'Translations update from Codeberg Translate' (#108) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/108
2024-10-12 11:14:18 +00:00
a-j-woodandCodeberg Translate ea82ae5090 Translated using Weblate (French)
Currently translated at 86.5% (109 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/fr/
2024-10-12 11:13:41 +00:00
Andrew Wood 65aa347a9f Merge pull request 'Translations update from Codeberg Translate' (#107) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/107
2024-10-11 22:37:53 +00:00
BennyandCodeberg Translate 3ba6d78241 Translated using Weblate (German)
Currently translated at 99.2% (125 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/de/
2024-10-11 22:36:22 +00:00
kreandCodeberg Translate 0e2bb55483 Translated using Weblate (German)
Currently translated at 99.2% (125 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/de/
2024-10-11 22:36:22 +00:00
Andrew Wood c0b64f4bae Line number updates. 2024-10-11 19:51:40 +01:00
Andrew Wood 6d70c0889d Merge pull request 'Translations update from Codeberg Translate' (#106) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/106
2024-10-11 18:50:45 +00:00
BennyandCodeberg Translate 22a614bbf4 Translated using Weblate (German)
Currently translated at 96.0% (121 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/de/
2024-10-11 18:49:50 +00:00
Andrew Wood 1fec5622b6 Line number updates. 2024-10-11 19:49:29 +01:00
Andrew Wood a1e2651b4c Remove the tcsetpgrp() code, as it did not work, since it turns out that zsh 5.8 was setting the terminal process group ID to that of itself when the last command in the pipeline was not a subshell - not to an invalid pgid or anything like that - so we cannot safely detect this or work around it. 2024-10-11 19:48:56 +01:00
Andrew Wood ec498ec476 Added a possible workaround, and extra debugging, for the missing display output issue in #100, but turned off at the moment. 2024-10-09 22:07:56 +01:00
Andrew Wood e433ad319e Merge pull request 'Translations update from Codeberg Translate' (#104) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/104
2024-10-09 17:59:37 +00:00
BennyandCodeberg Translate 30f9d01df9 Translated using Weblate (German)
Currently translated at 96.0% (121 of 126 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/de/
2024-10-09 17:57:53 +00:00
Andrew Wood 579b592c12 Correct the wording of the line buffer allocation failure error message. 2024-10-09 18:55:33 +01:00
Andrew Wood dfbab9a7c0 Add PO file stub for Turkish as requested. 2024-10-09 18:43:19 +01:00
Andrew Wood d1730258bf Sync with code. 2024-10-09 18:42:53 +01:00
Andrew Wood 1afd3e821a Acknowledgement of --store-and-forward suggestion. 2024-10-06 16:27:51 +01:00
Andrew Wood 9e36b0fdc7 Standardise formatting of options. 2024-10-06 16:24:48 +01:00
Andrew Wood 857637c1fb Acknowledge translations. 2024-10-06 16:16:09 +01:00
Andrew Wood 40854f6edb Merge pull request 'Translations update from Codeberg Translate' (#103) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/103
2024-10-06 15:11:22 +00:00
BennyandCodeberg Translate 7f403b8050 Translated using Weblate (German)
Currently translated at 96.0% (120 of 125 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/de/
2024-10-06 15:06:20 +00:00
Andrew Wood 2a59199870 Merge pull request 'Translations update from Codeberg Translate' (#102) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/102

All strings cross-checked with machine translation to check they look plausible (albeit to a non-Polish speaker).
2024-10-06 14:58:11 +00:00
coralpinkandCodeberg Translate 6712d8c844 Translated using Weblate (Polish)
Currently translated at 100.0% (125 of 125 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/pl/
2024-10-06 02:45:41 +00:00
Andrew Wood 856da09741 Add a circular buffer of line positions so that in line mode we can work out how many lines are in the unconsumed portion of the output pipe buffer. 2024-10-05 23:04:18 +01:00
Andrew Wood c4cf410a59 Adjusted Markdown formatting. 2024-10-05 20:52:15 +01:00
Andrew Wood 0994dd4070 Note the new MANIFEST file in releases. 2024-10-05 20:32:15 +01:00
Andrew Wood 6cddce9f15 Adjust dist-hook rule so that a failure to sign, when MAINTAINER is set, will be detected - and to add a note to the top of the manifest. 2024-10-05 20:31:25 +01:00
Andrew Wood ac44fd59e3 Added a hook to write a signed MANIFEST file listing the SHA-512 hashes of all included files. 2024-10-05 17:41:40 +01:00
Andrew Wood 5c25f9270c Line number updates. 2024-10-05 17:41:08 +01:00
Andrew Wood bfe301ae1c Preserve errno after the output write, and if the output pipe is closed, propagate this to the main loop so it does not wait forever for the pipe buffer to empty. 2024-10-05 17:05:14 +01:00
Andrew Wood 29aa64092a Timestamp update 2024-10-05 17:03:58 +01:00
Andrew Wood d9a0041870 New --store-and-forward option (#100), including refactoring several areas to allow PV to run in two passes, and the ability to look at the output pipe buffer utilisation to more accurately reflect the total data transferred to the receiving end, rather than just the total amount written to the output buffer. 2024-10-05 16:21:59 +01:00
Andrew Wood ea3787e393 Call posix_fadvise() each time we open a new file, not just on the first one. 2024-10-05 15:00:08 +01:00
Andrew Wood de2fe7f6be Correct the O_DIRECT flag setting to use the output file descriptor rather than assuming stdout. 2024-10-05 14:17:15 +01:00
Andrew Wood c548d1f2d8 Add a "--gauge" option which alters the progress bar to show the current rate as a percentage of the max rate seen, if the size is unknown (#46). 2024-10-04 22:15:14 +01:00
Andrew Wood fbe726e4c4 Add missing three dots to [OPTION] since there can be more than one. 2024-10-04 21:05:06 +01:00
Andrew Wood 208ac286f8 Calculate rate_min, rate_max, etc, regardless of whether show_stats is true, since the overhead is minimal and it will allow us to use that information for other options later. 2024-10-04 20:15:15 +01:00
Andrew Wood 9aef419c4c Surround the "--average-rate" average rate with brackets rather than square brackets, to differentiate it from the "--rate" current rate. 2024-10-04 19:59:21 +01:00
Andrew Wood a2c6490d31 Prefix the estimated completion time of "--fineta" with "FIN" rather than "ETA" to differentiate it from the "ETA" provided by "--eta" (#43). 2024-10-04 19:45:08 +01:00
Andrew Wood 4b399995f5 Allow --rate to be used with --numeric (#17). 2024-10-04 19:08:02 +01:00
Andrew Wood 877bb1f91f Move calculation code into its own file, to make display.c smaller and keep it focused purely on display. 2024-10-04 17:22:43 +01:00
Andrew Wood cd696e60ab Make pv__calc_percentage() into pv_percentage() in number.c instead of a static function in display.c, so it can be used in multiple places in future. 2024-10-04 17:15:18 +01:00
Andrew Wood 9bd5a518ea New option "--stats", to show a line of statistics about the transfer once it has ended (issue #49). 2024-10-04 15:12:22 +01:00
Andrew Wood fe4cc4b01d Source line number updates. 2024-10-04 13:27:54 +01:00
Andrew Wood 65d568c283 Refactor display and calculation functions to separate them out more cleanly, move more information into the state structure instead of repeating it as function parameters, and fix a memory leak in the whole-PID mode of --watchfd. 2024-10-04 13:27:17 +01:00
Andrew Wood a118f110fa Use verbose variable names for readability. 2024-10-04 11:58:57 +01:00
Andrew Wood f803f29158 Move transfer rate calculations into their own function, and make pv__format stand alone, to maintain separation of concerns. 2024-10-04 11:54:47 +01:00
Andrew Wood 954c2d32c1 Move calculated values out of state.display into a new structure, state.calc, to separate out the display portion from the calculation portion; and move history_interval into state.control, as it is a control parameter set at the start. 2024-10-04 11:08:01 +01:00
Andrew Wood 5112251894 Source line number updates. 2024-10-04 10:24:28 +01:00
Andrew Wood 545769885d Raise a SIGCONT to the whole process group after receiving a SIGTTOU, so that pipelines can be resumed in the background (for example "pv /dev/zero | cat > /dev/null" can now be suspended and put into the background - if we do not send that signal then "cat" remains stopped, as mentioned in issue #56). 2024-10-04 10:24:08 +01:00
Andrew Wood 94ea82c10a Indentation correction. 2024-10-04 10:21:23 +01:00
Andrew Wood a6c978573f Move pv_write_retry() and pv_tty_write() from cursor.c to display.c so they sit with all the other display functions. 2024-10-04 09:06:24 +01:00
Andrew Wood 31d70dae49 Use i18n tag rather than fix. 2024-10-04 08:53:44 +01:00
Andrew Wood 9a639b40b7 Use gmtime() instead of localtime() in debugging output to avoid lockups in signal handlers due to time zone lookups. 2024-10-04 08:53:14 +01:00
Andrew Wood e84f47abc8 Refactor handling of TTOU so that instead of shuffling stderr to another file descriptor and using /dev/null when backgrounded, we set a flag to suspend terminal output, and perform all terminal writes through a new pv_tty_write function which checks that flag. 2024-10-03 23:03:31 +01:00
Andrew Wood 741e4b0b30 Source line number updates. 2024-10-03 23:00:03 +01:00
Andrew Wood 52a720ec33 Improve the readability of the code that handles SIGTTOU. 2024-10-03 22:08:11 +01:00
Andrew Wood 416c61a663 Re-order structure members to minimise padding / holes, after analysis with "pahole" on a 64-bit system. 2024-10-03 22:07:03 +01:00
Andrew Wood 23bd296aeb Re-order structure members to minimise padding / holes, after analysis with "pahole" on a 64-bit system. 2024-10-03 21:25:41 +01:00
Andrew Wood 2c8843fc86 Expand the list of places to check for patches and bug reports. 2024-10-03 12:09:09 +01:00
Andrew Wood aa07373c4e Removed TODO.md, since it is just an outdated copy of the issue tracker. 2024-10-03 11:52:30 +01:00
Andrew Wood a3b5a44f79 Add a translation status widget. 2024-09-29 16:04:41 +01:00
Andrew Wood d5fad8db39 New German translations. 2024-09-29 12:18:11 +01:00
Andrew Wood ef5d703682 Merge pull request 'Translations update from Codeberg Translate' (#99) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/99
2024-09-29 11:09:37 +00:00
a-j-woodandCodeberg Translate 40efaf848e Translated using Weblate (German)
Currently translated at 100.0% (118 of 118 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/de/
2024-09-29 11:07:52 +00:00
Andrew Wood 575854c8b9 Merge pull request 'Translations update from Codeberg Translate' (#98) from translate/pv:weblate-pv-pv into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/98
2024-09-29 10:56:36 +00:00
a-j-woodandCodeberg Translate 3299947cc1 Translated using Weblate (German)
Currently translated at 99.1% (117 of 118 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/de/
2024-09-29 10:47:39 +00:00
Hartmut GoebelandCodeberg Translate 9daeea7400 Translated using Weblate (German)
Currently translated at 99.1% (117 of 118 strings)

Translation: pv/pv
Translate-URL: https://translate.codeberg.org/projects/pv/pv/de/
2024-09-29 10:47:39 +00:00
Andrew Wood 4e51afc36c Added a link to the Weblate instance for translations. 2024-09-28 22:09:07 +01:00
Andrew Wood f1f333dc7a Update version to 1.8.14. 2024-09-07 21:33:24 +01:00
Andrew Wood 69a56ced7a Correct double-free on exit when using --watchfd - issue #96. 2024-09-07 21:04:09 +01:00
Andrew Wood 2c468b0bb2 Version bump for new release. 2024-08-18 21:59:32 +01:00
Andrew Wood c67248ffc7 Update to add the new strings in the options parser. 2024-08-06 23:35:55 +01:00
Andrew Wood 60936080da Move the "--size @FILE" file size reading into its own function for clarity; standardise its error message format to "program: file: message: detail"; uniquely name variables; refuse to accept a directory as a file; and with this option, try reading the size of a block device from sysfs if we can, to avoid requiring read permissions on the device. 2024-08-06 23:17:15 +01:00
Andrew Wood 4db04564a9 Merge pull request 'Support block devices in @-syntax' (#94) from alexanderperlis/pv:support-block-device-size into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/94
2024-08-06 20:26:43 +00:00
Alexander Perlis f6b0ddc0b3 Support block devices in @-syntax 2024-08-01 00:36:02 +00:00
Andrew Wood b42399e9a9 Timestamp update. 2024-07-18 22:23:48 +01:00
Andrew Wood ba72056bf2 Version bump. 2024-07-18 22:10:57 +01:00
Andrew Wood b8e4a51228 Update line numbers. 2024-07-18 22:08:34 +01:00
Andrew Wood 0b12f7db42 Update TODO to reflect issue tracker. 2024-07-18 22:01:36 +01:00
Andrew Wood 5053cffdad Further clarification of #92, #93. 2024-07-17 07:45:13 +01:00
Andrew Wood 02f852604f Add #93. 2024-07-17 07:42:18 +01:00
Andrew Wood e4ab8c56a0 Minor adjustment to comments. 2024-07-17 07:41:48 +01:00
Andrew Wood 86016d41d7 Merge pull request 'Improve description and comments for blocking-write() after select()' (#93) from eborisch/pv:update-block-after-select into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/93
2024-07-17 06:36:50 +00:00
Eric A. Borisch 3fdfd07443 Improve description and comments for blocking-write() after select() 2024-07-16 23:39:15 -05:00
Andrew Wood d801cdd722 Remove spurious strerror() call from debug report. 2024-07-16 22:44:10 +01:00
Andrew Wood 72e5078ce9 Move the MAKE_OUTPUT_NONBLOCKING code to state.c, as it can no longer work in main.c due to accessing internal structures; but still leave it switched off by default for now. 2024-07-16 22:41:31 +01:00
Andrew Wood a7c3f3dd35 Write the error from write() to the debugging output if nwritten is <0. 2024-07-16 22:23:51 +01:00
Andrew Wood 729fc10674 News item and acknowledgement for zero write bug fix (#92). 2024-07-16 22:03:56 +01:00
Andrew Wood 12f0312b00 Move the "stop at size" option setting to before the size calculation, otherwise if the size calculation tries to override that setting, it cannot do so (#91). 2024-07-16 21:58:47 +01:00
Andrew Wood 8c0e3e9dad When checking how many bytes were written, place the constant to the left of the equality check to match the rest of the code (this avoids accidental assignment if one equals sign is accidentally written instead of two), and write the appropriate debug message depending on whether the write was interrupted or it was empty. 2024-07-16 21:54:13 +01:00
Andrew Wood c7104f0c0d Merge pull request 'src/pv/transfer.c: timer going off returns with total_written==0; which is not an error.' (#92) from eborisch/pv:write-can-return-0 into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/92
2024-07-16 20:47:32 +00:00
Andrew Wood 679638beb2 More details. 2024-07-16 21:42:23 +01:00
Andrew Wood f8fc5844b1 Re-order the output file descriptor setting and the size detection to correct the problem with output block device size detection that was broken in 1.8.10 (#91). 2024-07-16 21:39:29 +01:00
eborisch d86d8cf65a Clarify state. 2024-07-16 03:57:11 +00:00
eborisch 11e5b5fe95 src/pv/transfer.c: write(2) returning 0 is not an error
This is being hit easily on FreeBSD with pv sitting in a zfs send/recv pipeline. As write(2) returning 0 is not an error, handle it similar to returning -1 with EINTR or EAGAIN: wait a bit and try again.
2024-07-15 21:36:57 +00:00
Andrew Wood 42b623e9b0 Pre-release version and datestamp updates. 2024-06-15 23:40:07 +01:00
Andrew Wood 21e65b8742 Relax the strictness of this check a little, to avoid false failures on heavily loaded systems. 2024-06-15 23:11:53 +01:00
Andrew Wood c6ac4d11be Added an example of how to list untranslated strings. 2024-06-15 23:00:12 +01:00
Andrew Wood 2d48e07139 Updated the instructions for testing translations, now that a method has been found that actually works. 2024-06-15 22:47:53 +01:00
Andrew Wood 3fee341ac2 Update the line numbers etc in the language files (from "make -C po update-po") - no actual translation changes included. 2024-06-08 22:06:08 +01:00
Andrew Wood 2bed6776e4 Truncate files written with "-o". 2024-06-08 22:02:11 +01:00
Andrew Wood 01e0290d6e More replacement of hard-coded exit status bitmask values with named constants. 2024-06-08 21:57:36 +01:00
Andrew Wood 1c61154206 Replace hard-coded exit status bitmask values with named constants. 2024-06-08 21:49:46 +01:00
Andrew Wood addf25ff16 Minor cleanups after merge. 2024-06-08 21:21:11 +01:00
Andrew Wood 578c1613d1 Merge pull request 'Add '-o' option to write to a file other than stdout' (#90) from xmort/pv:add-output-file-option into main
Reviewed-on: https://codeberg.org/a-j-wood/pv/pulls/90
2024-06-08 19:22:14 +00:00
Martin Dørum 6073445551 document the --output in the man page and help text 2024-06-08 14:31:21 +02:00
Martin Dørum 30763684b7 add -o/--output option 2024-06-08 14:31:19 +02:00
Andrew Wood ace8f44f59 Added more debugging to stdout writes. 2024-05-11 21:13:12 +01:00
Andrew Wood 98994bbeaa Correct the copyright year in the "--version" output. 2024-04-22 22:25:22 +01:00
122 changed files with 20749 additions and 6977 deletions
+45 -8
View File
@@ -5,24 +5,41 @@ AUTOMAKE_OPTIONS = subdir-objects
SUBDIRS = po
bin_PROGRAMS = pv
dist_doc_DATA = README.md docs/INSTALL docs/COPYING docs/NEWS.md docs/ACKNOWLEDGEMENTS.md docs/DEVELOPERS.md docs/TODO.md docs/benchmark.sh
dist_doc_DATA = README.md docs/INSTALL docs/COPYING docs/NEWS.md docs/ACKNOWLEDGEMENTS.md docs/DEVELOPERS.md
dist_man1_MANS = docs/pv.1
EXTRA_DIST = docs/pv.1.md
EXTRA_DIST = docs/pv.1.md docs/benchmark-rw-syscalls-vs-data.sh docs/benchmark-pv-transfers.sh docs/release.cf
pv_SOURCES = \
src/main/debug.c \
src/main/help.c \
src/main/main.c \
src/main/options.c \
src/main/remote.c \
src/main/version.c \
src/pv/calc.c \
src/pv/cursor.c \
src/pv/display.c \
src/pv/elapsedtime.c \
src/pv/file.c \
src/pv/format/averagerate.c \
src/pv/format/barstyle.c \
src/pv/format/bufferpercent.c \
src/pv/format/bytes.c \
src/pv/format/conemu.c \
src/pv/format/eta.c \
src/pv/format/fineta.c \
src/pv/format/lastwritten.c \
src/pv/format/name.c \
src/pv/format/previousline.c \
src/pv/format/progressbar.c \
src/pv/format/rate.c \
src/pv/format/ratio.c \
src/pv/format/sgr.c \
src/pv/format/timer.c \
src/pv/loop.c \
src/pv/number.c \
src/pv/proctitle.c \
src/pv/remote.c \
src/pv/signal.c \
src/pv/state.c \
src/pv/string.c \
@@ -66,28 +83,39 @@ tests/Integrity_-_Basic.test \
tests/Integrity_-_Binary_data.test \
tests/Integrity_-_From_bursty_source.test \
tests/Integrity_-_Large_file_support.test \
tests/Integrity_-_On_closed_output_pipe_at_EOF.test \
tests/Integrity_-_On_failed_input_pipe_at_EOF.test \
tests/Integrity_-_On_output_pipe_close.test \
tests/Integrity_-_When_adjusted_remotely.test \
tests/Memory_safety_-_Basic.test \
tests/Memory_safety_-_Process_title.test \
tests/Memory_safety_-_Remote_control_receiver.test \
tests/Memory_safety_-_Remote_control_sender.test \
tests/Memory_safety_-_Watchfd.test \
tests/Modifiers_-_--direct-io.test \
tests/Modifiers_-_--force.test \
tests/Modifiers_-_--interval.test \
tests/Modifiers_-_--line-mode.test \
tests/Modifiers_-_--size_from_file_size.test \
tests/Modifiers_-_--size_from_dir_size.test \
tests/Modifiers_-_--size.test \
tests/Modifiers_-_--sync.test \
tests/Monitor_-_Basic.test \
tests/Sparse_-_Basic.test \
tests/Terminal_-_Detect_width.test \
tests/Transfer_-_--rate-limit.test \
tests/Transfer_-_--remote.test \
tests/Transfer_-_--stop-at-size.test
tests/Transfer_-_--stop-at-size.test \
tests/Transfer_-_--stop-at-size_reads.test \
tests/Watchfd_-_Multiple_arguments.test \
tests/Watchfd_-_Multiple_descriptors.test \
tests/Watchfd_-_Single_descriptor.test
EXTRA_DIST += $(TESTS) tests/run-valgrind.sh tests/test-env.sh
docs/pv.1.md: $(srcdir)/docs/pv.1
test -d docs || mkdir docs
pandoc --from man --to markdown < $< | sed '/\*\*\*\*/{s/\*//g;s/^/**/;s/$$/**/}' | sed '/^```/,/^```/d' > $@
pandoc --from man --to markdown < $< | sed '/\*\*\*\*/{s/\*//g;s/^/**/;s/$$/**/}' | sed '/^```/,/^```/d' | sed 's/^\\\[/[/' > $@
SUFFIXES = .c .o .e
@@ -96,10 +124,10 @@ SUFFIXES = .c .o .e
-flawfinder $< >> $@ 2>&1
indent:
cd $(srcdir) && indent -npro -kr -i8 -cd42 -c45 -l120 src/*/*.c
cd $(srcdir) && indent -npro -kr -i8 -cd42 -c45 -l120 src/*/*.c src/*/*/*.c
indentclean:
rm -f $(srcdir)/*/*.c~
rm -f $(srcdir)/src/*/*.c~ $(srcdir)/src/*/*/*.c~
analyse: $(pv_SOURCES:.c=.e) FORCE
grep -E -e '^Finished checking --' -e 'Hits = ' $+ 2>/dev/null || true
@@ -107,11 +135,20 @@ analyse: $(pv_SOURCES:.c=.e) FORCE
FORCE:
clean-local:
rm -f src/*/*.e
rm -f src/*/*.e src/*/*/*.e
# Convenience alias for "make check": "make test"
test: check
# Generate a package manifest if MAINTAINER is set.
dist-hook:
if test -n "$(MAINTAINER)"; then \
cd "$(top_distdir)" \
&& { printf "%s\n\n" "Check file integrity with 'sha512sum -c MANIFEST && echo OK'."; \
find -type f -not -name MANIFEST -exec sha512sum '{}' ';' | sort -k 2; } \
| gpg -u "$(MAINTAINER)" --clearsign > MANIFEST; \
else true; fi
# "release" target - requires MAINTAINER variable to select GPG key.
release: distcheck
gpg --list-secret-keys 2>&1 | grep -F 'uid' | grep -Fq "$(MAINTAINER)"
+48 -21
View File
@@ -1,10 +1,21 @@
# Introduction
This is the README for **pv** ("Pipe Viewer"), a terminal-based 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
quickly data is passing through, how long it has taken, how near to
completion it is, and an estimate of how long it will be until completion.
**pv** ("Pipe Viewer") is a terminal-based tool for monitoring the progress
of data through a pipeline and modifying its flow.
When used just like "**cat**", **pv** displays how quickly data is being
transferred, how long it has taken, how near to completion it is, and an
estimate of how long it will be until completion. Data flow rate, error
handling strategy, buffer size, and cache interaction can all be adjusted.
With the "**\--cursor**" option, several **pv** instances can work together,
showing transfer progress at different points in the same pipeline.
In "**\--watchfd**" mode, **pv** will inspect another process and show its
progress through the files it has open.
In "**\--monitor**" mode, **pv** will run a command and display the progress
of data through both its standard input and its standard output.
# Documentation
@@ -12,28 +23,46 @@ completion it is, and an estimate of how long it will be until completion.
A manual page is included in this distribution ("`man pv`"). Before
installation, it is in "[docs/pv.1](./docs/pv.1.md)".
Changes are listed in "[docs/NEWS.md](./docs/NEWS.md)". The to-do list is "[docs/TODO.md](./docs/TODO.md)".
Changes are listed in "[docs/NEWS.md](./docs/NEWS.md)".
Developers and translators, please see "[docs/DEVELOPERS.md](./docs/DEVELOPERS.md)".
Translators can use the Weblate instance hosted by Codeberg:
[https://translate.codeberg.org/engage/pv/](https://translate.codeberg.org/engage/pv/)
# Compilation
[![Translation status](https://translate.codeberg.org/widget/pv/multi-auto.svg)](https://translate.codeberg.org/engage/pv/)
To compile the package, type "`sh ./configure`", which should generate a
Makefile for your system. You may then type "`make`" to build everything,
and "`make install`" to install it.
If you don't see your language listed, raise an issue on the issue tracker
(or just email the maintainer) asking for it to be added.
See the file "[docs/INSTALL](./docs/INSTALL)" for more about the _configure_ script.
If this is not a packaged release, you will need the GNU build system tools
(`autoconf`, `aclocal`, `autopoint`, `automake`) and the `gettext`
development tools. You can then run "`autoreconf -is`" to generate the
"`configure`" script.
# Installation
See "[docs/INSTALL](./docs/INSTALL)" for more about the _configure_ script.
The typical process for a system-wide install is:
sh ./configure --prefix=/usr
make
sudo make install
This requires the build toolchain ("`sudo apt install build-essential`" on
Debian or Ubuntu systems).
If this is not a packaged release, the _configure_ script is not included.
It is generated with the GNU build system tools (_autoconf_, _aclocal_,
_autopoint_, _automake_); _gettext_ is also needed. On Debian or Ubuntu,
run "`sudo apt install automake autopoint gettext`". Once those tools are
in place, call "`autoreconf -is`" to generate the _configure_ script, and
run it as described above.
# Copyright, bug reporting, and acknowledgements
Copyright (C) 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood.
See "[docs/ACKNOWLEDGEMENTS.md](./docs/ACKNOWLEDGEMENTS.md)" for a list of
contributors.
Copyright (C) 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood.
License GPLv3+: GNU GPL version 3 or later <https://www.gnu.org/licenses/gpl-3.0.html>.
@@ -51,15 +80,13 @@ You should have received a copy of the GNU General Public License, version
3, in "[docs/COPYING](./docs/COPYING)". If not, see
<https://www.gnu.org/licenses/gpl-3.0.html>.
Please report any bugs to **pv@ivarch.com**, or use the issue tracker linked
from the **pv** home page.
Please report bugs or request features via the issue tracker linked from the
home page.
The **pv** home page is at:
[https://www.ivarch.com/programs/pv.shtml](https://www.ivarch.com/programs/pv.shtml)
> [https://ivarch.com/p/pv](https://ivarch.com/p/pv)
The latest version can always be found here.
**Please see "[docs/ACKNOWLEDGEMENTS.md](./docs/ACKNOWLEDGEMENTS.md)" for a list of contributors.**
---
+100 -8
View File
@@ -1,10 +1,10 @@
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
dnl Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
dnl
dnl License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
AC_INIT([pv], [1.8.9], [pv@ivarch.com], [pv], [https://www.ivarch.com/programs/pv.shtml])
AC_INIT([pv], [1.11.0], [https://codeberg.org/ivarch/pv/issues], [pv], [https://ivarch.com/p/pv])
AC_CONFIG_SRCDIR([src/include/config.h.in])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([src/include/config.h])
@@ -17,6 +17,7 @@ AC_C_CONST
AC_HEADER_STDBOOL
AC_SYS_LARGEFILE
AM_GNU_GETTEXT_VERSION([0.21])
AM_GNU_GETTEXT_REQUIRE_VERSION([0.21])
AM_GNU_GETTEXT([external])
if test "$USE_NLS" = "yes"; then
CPPFLAGS="$CPPFLAGS -DLOCALEDIR=\\\"\$(localedir)\\\""
@@ -25,25 +26,43 @@ fi
dnl Items we can use if present, but can do without if not present.
AC_CHECK_FUNCS([getopt_long])
AC_CHECK_FUNCS([vsnprintf strlcat strtoul memrchr])
AC_CHECK_FUNCS([vsnprintf vasprintf strlcat strtoul memrchr])
AC_CHECK_FUNCS([fdatasync])
AC_CHECK_FUNCS([fpathconf sysconf posix_memalign posix_fadvise])
AC_CHECK_FUNCS([getcwd])
AC_CHECK_FUNCS([nanosleep])
AC_CHECK_FUNCS([setitimer])
AC_CHECK_FUNCS([setproctitle])
AC_CHECK_FUNCS([nftw])
AC_CHECK_FUNCS([strsignal])
AC_CHECK_HEADERS([getopt.h])
AC_CHECK_HEADERS([limits.h])
AC_CHECK_HEADERS([langinfo.h])
AC_CHECK_HEADERS([wctype.h])
AC_CHECK_HEADERS([termios.h])
AC_CHECK_HEADERS([libgen.h])
AC_CHECK_HEADERS([sys/ioctl.h])
AC_CHECK_HEADERS([libintl.h locale.h])
AC_CHECK_HEADERS([sys/sysmacros.h])
AC_CHECK_HEADERS([ftw.h])
AC_CHECK_HEADERS([poll.h sys/poll.h])
AC_CHECK_FUNCS([poll])
AC_CHECK_MEMBERS([struct stat.st_blksize])
AC_CHECK_DECLS([SA_SIGINFO], [], [], [[#include <signal.h>]])
AC_SEARCH_LIBS([sqrtl],[m])
AC_SEARCH_LIBS([fmod],[m])
AC_SEARCH_LIBS([lroundl],[m])
AC_CHECK_HEADERS([math.h])
AC_CHECK_FUNCS([sqrtl])
AC_CHECK_FUNCS([fmod])
AC_CHECK_FUNCS([lroundl])
dnl Libraries that may contain key functions.
AC_SEARCH_LIBS([clock_gettime],[rt])
dnl Items we can't do without.
AC_CHECK_FUNCS([alarm basename clock_gettime dup2 getcwd memcpy memmove memset select setlocale strchr strerror strrchr strstr], [], [AC_MSG_ERROR([required function is missing])])
AC_CHECK_FUNCS([alarm basename clock_gettime dup2 memcpy memmove memset mkdir select setlocale strchr strerror strrchr strstr], [], [AC_MSG_ERROR([required function is missing])])
AC_CHECK_HEADERS([fcntl.h sys/file.h sys/time.h unistd.h], [], [AC_MSG_ERROR([required header file is missing])])
dnl Make sure all the types we use are defined.
@@ -55,10 +74,53 @@ AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UID_T
AC_CHECK_MEMBERS([struct stat.st_rdev])
dnl Check whether a signal handler can see the PID of the sender.
AC_MSG_CHECKING([siginfo_t provides a signal sender's PID])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <string.h>
#include <signal.h>
#include <unistd.h>
static pid_t signalSender = 0;
#ifdef SA_SIGINFO
static void receiveUSR2( __attribute__((unused))
int sig, siginfo_t * info, __attribute__((unused))
void *ucontext)
{
if (NULL != info)
signalSender = info->si_pid;
}
#endif
]], [[
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
#ifdef SA_SIGINFO
sa.sa_sigaction = receiveUSR2;
(void) sigemptyset(&(sa.sa_mask));
sa.sa_flags = SA_SIGINFO;
(void) sigaction(SIGUSR2, &sa, NULL);
raise(SIGUSR2);
#endif
return signalSender < 1 ? 1 : 0;
]])], [
AC_MSG_RESULT([yes])
AC_DEFINE([SIGINFO_PROVIDES_PID], [1], [Signal handlers can determine the sending PID])
], [
AC_MSG_RESULT([no])
], [
AC_MSG_RESULT([cannot check, assuming yes])
AC_DEFINE([SIGINFO_PROVIDES_PID], [1], [Signal handlers can determine the sending PID])
]
)
AH_BOTTOM([#include "config-aux.h"])
AC_ARG_ENABLE([debugging],
[ --enable-debugging compile with debugging support],
[AS_HELP_STRING([--enable-debugging], [compile with debugging support])],
if test "$enable_debugging" = "yes"; then
CFLAGS="$CFLAGS -g -Wall"
AC_DEFINE([ENABLE_DEBUGGING], [1], [Debugging support enabled])
@@ -66,28 +128,53 @@ AC_ARG_ENABLE([debugging],
)
AC_ARG_ENABLE([profiling],
[ --enable-profiling compile with profiling support],
[AS_HELP_STRING([--enable-profiling], [compile with profiling support])],
if test "$enable_profiling" = "yes"; then
CFLAGS="-pg $CFLAGS"
fi
)
SPLICE_SUPPORT="no"
AC_ARG_ENABLE([splice], [ --disable-splice do not use splice system call],
AC_ARG_ENABLE([splice],
[AS_HELP_STRING([--disable-splice], [do not use splice system call])],
if test "$enable_splice" = "yes"; then
SPLICE_SUPPORT="yes"
fi,
SPLICE_SUPPORT="yes"
)
COPY_FILE_RANGE_SUPPORT="no"
AC_ARG_ENABLE([copy-file-range],
[AS_HELP_STRING([--disable-copy-file-range], [do not use copy_file_range system call])],
if test "$enable_copy_file_range" = "yes"; then
COPY_FILE_RANGE_SUPPORT="yes"
fi,
COPY_FILE_RANGE_SUPPORT="yes"
)
IPC_SUPPORT="no"
AC_ARG_ENABLE([ipc], [ --disable-ipc turn off IPC messaging],
AC_ARG_ENABLE([ipc],
[AS_HELP_STRING([--disable-ipc], [turn off IPC messaging])],
if test "$enable_ipc" = "yes"; then
IPC_SUPPORT="yes"
fi,
IPC_SUPPORT="yes"
)
AC_ARG_WITH([ncurses],
[AS_HELP_STRING([--without-ncurses], [disable the use of ncurses for terminal info])],
[],
[with_curses=yes])
AS_IF([test "x$with_ncurses" != xno],
[
AC_SEARCH_LIBS([tigetnum],[tinfo ncurses], [
AC_CHECK_HEADERS([term.h],[
AC_DEFINE([ENABLE_NCURSES], [1], [Build with ncurses support])
])
], [])
],
[])
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static], [enable static linking])],
[
@@ -104,6 +191,7 @@ yes
if test "$IPC_SUPPORT" = "yes"; then
AC_CHECK_HEADERS([sys/ipc.h], [], [IPC_SUPPORT=no])
AC_CHECK_HEADERS([sys/shm.h], [], [IPC_SUPPORT=no])
AC_CHECK_HEADERS([sys/param.h])
if test "$IPC_SUPPORT" = "yes"; then
AC_CHECK_FUNCS([shmget], [], [IPC_SUPPORT=no])
@@ -118,6 +206,10 @@ if test "$SPLICE_SUPPORT" = "yes"; then
AC_CHECK_FUNCS([splice])
fi
if test "$COPY_FILE_RANGE_SUPPORT" = "yes"; then
AC_CHECK_FUNCS([copy_file_range])
fi
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/src/include"
dnl This must go after all the compiler based tests above.
+90 -33
View File
@@ -12,18 +12,18 @@ is acknowledged and greatly appreciated:
* Joshua Jensen - reported RPM installation bug
* Boris Folgmann <http://www.folgmann.com/en/> - reported cursor handling bug
* Mathias Gumz - reported NLS bug
* Daniel Roethlisberger - submitted patch to use lockfiles for "`-c`" if terminal locking fails
* Adam Buchbinder - lots of help with a Cygwin port of "`-c`"
* Mark Tomich <http://metuchen.dyndns.org> - suggested "`-B`" option
* Daniel Roethlisberger - submitted patch to use lockfiles for **-c** if terminal locking fails
* Adam Buchbinder - lots of help with a Cygwin port of **-c**
* Mark Tomich <http://metuchen.dyndns.org> - suggested **-B** option
* Gert Menke - reported bug when piping to `dd` with a large input buffer size
* Ville Herva <Ville.Herva@iki.fi> - informative bug report about rate limiting performance
* Elias Pipping - patch to compile properly on Darwin 9; potential NULL deref report
* Patrick Collison - similar patch for OS X
* Boris Lohner - reported problem that "`-L`" does not complain if given non-numeric value
* Boris Lohner - reported problem that **-L** does not complain if given non-numeric value
* Sebastian Kayser - supplied testing for *SIGPIPE*, demonstrated internationalisation problem
* Laszlo Ersek <http://phptest11.atw.hu/> - reported shared memory leak on *SIGINT* with "`-c`"
* Laszlo Ersek <http://phptest11.atw.hu/> - reported shared memory leak on *SIGINT* with **-c**
* Phil Rutschman <http://bandgap.rsnsoft.com/> - provided a patch for fully restoring terminal state on exit
* Henry Precheur <http://henry.precheur.org/> - reporting and suggestions for "`--rate-limit`" bug when rate is under 10
* Henry Precheur <http://henry.precheur.org/> - reporting and suggestions for **--rate-limit** bug when rate is under 10
* E. Rosten <http://mi.eng.cam.ac.uk/~er258/> - supplied patch for block buffering in line mode
* Kjetil Torgrim Homme - reported compilation error with default *CFLAGS* on non-GCC compilers
* Alexandre de Verteuil - reported bug in OS X build and supplied test environment to fix in
@@ -31,65 +31,122 @@ is acknowledged and greatly appreciated:
* Sam Nelson <http://www.siliconfuture.net/> - supplied patch to fix trailing slash on *DESTDIR*
* Daniel Pape - reported Cygwin installation problem due to *DESTDIR*
* Philipp Beckers - ported to the Syabas PopcornHour A-100 series
* Henry Gebhard <hsggebhardt@googlemail.com> - supplied patches to improve SI prefixes and add "`--average-rate`"
* Henry Gebhard <hsggebhardt@googlemail.com> - supplied patches to improve SI prefixes and add **--average-rate**
* Vladimir Kokarev, Alexander Leo - reported that exit status did not reflect file errors
* Thomas Rachel - submitted patches for IEEE1541 (MiB suffixes), 1+e03 bug
* Guillaume Marcais - submitted speedup patch for line mode
* Moritz Barsnick - submitted patch for compile warning in size calculation
* Pawel Piatek - submitted RPM and patches for AIX
* Sami Liedes - submitted patch for "`--timer`" and "`--bytes`" with "`--numeric`"
* Steven Willis - reported problem with "`-R`" killing non-PV remote processes
* Vladimir Pal, Vladimir Ermakov - submitted patch which led to development of "`--format`" option
* Sami Liedes - submitted patch for **--timer** and **--bytes** with **--numeric**
* Steven Willis - reported problem with **-R** killing non-PV remote processes
* Vladimir Pal, Vladimir Ermakov - submitted patch which led to development of **--format** option
* Peter Samuelson <peter@p12n.org> - submitted patch to calculate size if stdout is a block device
* Miguel Diaz - much Cygwin help (and packaging), found narrow-terminal bug
* Jim Salter <http://ubuntuwiki.net> - commissioned work on the "`--skip-errors`" option
* Jim Salter <http://ubuntuwiki.net> - commissioned work on the **--skip-errors** option
* Wouter Pronk - reported build problem on SCO
* Bryan Dongray <http://www.dongrays.com> - provided patches for test scripts failing on older Red Hats
* Zev Weiss <www.bewilderbeest.net> - provided patch to fix `splice()` not using stdin
* Zing Shishak - provided patch for "`--null`" / "`-0`" (count null terminated lines)
* Jacek Wielemborek <http://deetah.jogger.pl/kategorie/english> - implemented fdwatch in Python, suggested PV port; reported bug with "`-l`" and ETA / size; many other contributions
* Zing Shishak - provided patch for **--null** / **-0** (count null terminated lines)
* Jacek Wielemborek <http://deetah.jogger.pl/kategorie/english> - implemented fdwatch in Python, suggested PV port; reported bug with **-l** and ETA / size; many other contributions
* Kim Krecht - suggested buffer fill status and last bytes output display options
* Cristian Ciupitu <http://ciupicri.github.io>, Josh Stone - pointed out file descriptor leak with helpful suggestions (Josh Stone initially noticed the missing close)
* Jan Seda - found issue with `splice()` and *SPLICE_F_NONBLOCK* causing slowdown
* André Stapf - pointed out formatting problem e.g. 13GB -> 13.1GB which should be shown 13.0GB -> 13.1GB; highlighted on-startup row swapping in "`-c`", and suggested "`--discard`"
* Damon Harper <http://www.usrbin.ca/> - suggested "`-D`" / "`--delay-start`" option
* André Stapf - pointed out formatting problem e.g. 13GB -> 13.1GB which should be shown 13.0GB -> 13.1GB; highlighted on-startup row swapping in **-c**, and suggested **--discard**; suggested making **--fineta** have a "FIN" prefix
* Damon Harper <http://www.usrbin.ca/> - suggested **-D** / **--delay-start** option
* Ganaël Laplanche <http://www.martymac.org> - provided patch for `lstat64()` on systems that do not support it
* Peter Korsgaard <http://www.buildroot.net/> - provided similar patch for `lstat64()`, specifically for uClibc support; provided AIX cross-compilation patch to fix bug in "`-lc128`" check
* Peter Korsgaard <http://www.buildroot.net/> - provided similar patch for `lstat64()`, specifically for uClibc support; provided AIX cross-compilation patch to fix bug in **-lc128** check
* Ralf Ramsauer <https://blog.ramses-pyramidenbau.de/> - reported bug which dropped transfer rate on terminal resize
* Michiel Van Herwegen - reported and discussed bug with "`-l`" and ETA / size
* Erkki Seppälä <http://www.inside.org/~flux/> - provided patch implementing "`-I`"
* Michiel Van Herwegen - reported and discussed bug with **-l** and ETA / size
* Erkki Seppälä <http://www.inside.org/~flux/> - provided patch implementing **-I**
* Eric A. Borisch - provided details of compatibility fix for "`%Lu`" in watchpid code
* Jan Venekamp - reported MacOS buffer size interactions with pipes
* Matt <https://github.com/lemonsqueeze/pv> - provided "rate-window" patches for rate calculation
* [Filippo Valsorda](https://github.com/FiloSottile) - provided patch for stat64 issue on Apple Silicon
* Matt Koscica, William Dillon - also reported stat64 issue on Apple Silicon
* [Demitri Muna](https://github.com/demitri) - assisted with stat64 patch on Apple Silicon
* Norman Rasmussen - suggested "`-c`" with "`-d PID:FD`", reject "`-N`" with "`-d PID`"
* Norman Rasmussen - suggested **-c** with **-d PID:FD**, reject **-N** with **-d PID**
* Andriy Gapon, Jonathan Elchison - reported bug where "`pv /dev/zero >/dev/null &`" stops immediately
* Marcelo Chiesa - reported unused-result warnings when compiling PV 1.6.6
* Jered Floyd - provided patches to improve "`--rate-limit`"
* Jered Floyd - provided patches to improve **--rate-limit**
* Christoph Biedl - provided ETA and dynamic interval patches
* Richard Fonfara - provided German translations for "`pv --help`"
* Johannes Gerer <http://johannesgerer.com> - suggested that "`-B`" should enable "`-C`"
* Johannes Gerer <http://johannesgerer.com> - suggested that **-B** should enable **-C**
* Sam James - provided fix for number.c build issue caused by missing stddef.h
* Jakub Wilk <jwilk@jwilk.net> - corrected README encoding
* Frederik Eaton - reported issue with `<()` shell constructs
* [gray](https://github.com/gray) - reported issue with "`--force`" and terminal process groups, and proposed a patch
* [gray](https://github.com/gray) - reported issue with **--force** and terminal process groups, and proposed a patch
* [Luc Gommans](https://github.com/lgommans) / https://lgms.nl/ - provided a "momentary ETA" patch
* [ikasty](https://github.com/ikasty) - added relative filename display to "`--watchfd`"
* [ikasty](https://github.com/ikasty) - added relative filename display to **--watchfd**
* [Michael Weiß](https://github.com/quitschbo) - corrected behaviour when not attached to a terminal
* [christoph-zededa](https://github.com/christoph-zededa) - provided OS X support for "`--watchfd`"
* [Dave Beckett](https://github.com/dajobe) - added "`@filename`" syntax to "`--size`", and corrected an autoconf problem with stat64 on OS X
* [christoph-zededa](https://github.com/christoph-zededa) - provided OS X support for **--watchfd**
* [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
* [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
* [fuschia74](https://github.com/fuchsia74) - provided "`--enable-static`" patch for "`configure`"
* [Wilhelm von Thiele](https://github.com/TurtleWilly) - assisted with OS X cleanups ([#73](https://codeberg.org/a-j-wood/pv/issues/73), [#74](https://codeberg.org/a-j-wood/pv/issues/74))
* Matějů Miroslav, Ing. - suggested fix for ETA and elapsed time faults when suspending and resuming a machine ([#13](https://codeberg.org/a-j-wood/pv/issues/13))
* Anthony DeRobertis - suggested the "`--error-skip-block`" option ([#37](https://codeberg.org/a-j-wood/pv/issues/37))
* [fuschia74](https://github.com/fuchsia74) - provided **--enable-static** patch for "`configure`"
* [Wilhelm von Thiele](https://github.com/TurtleWilly) - assisted with OS X cleanups ([#73](https://codeberg.org/ivarch/pv/issues/73), [#74](https://codeberg.org/ivarch/pv/issues/74))
* Matějů Miroslav, Ing. - suggested fix for ETA and elapsed time faults when suspending and resuming a machine ([#13](https://codeberg.org/ivarch/pv/issues/13))
* Anthony DeRobertis - suggested the **--error-skip-block** option ([#37](https://codeberg.org/ivarch/pv/issues/37))
* Benoit Pierre - provided patches for compilation without IPC support, without HAVE_STRUCT_STAT_ST_BLKSIZE, and on MacOS
* [gustav-b](https://codeberg.org/gustav-b) - suggested percentage formatting correction ([#80](https://codeberg.org/a-j-wood/pv/issues/80))
* [Thomas Bertels](https://codeberg.org/tbertels) - updated French translations ([#83](https://codeberg.org/a-j-wood/pv/pulls/83))
* [kevinruddy](https://codeberg.org/kevinruddy) - added decimal units option ([#85](https://codeberg.org/a-j-wood/pv/pulls/85))
* [gustav-b](https://codeberg.org/gustav-b) - suggested percentage formatting correction ([#80](https://codeberg.org/ivarch/pv/issues/80))
* [Thomas Bertels](https://codeberg.org/tbertels) - updated French translations ([#83](https://codeberg.org/ivarch/pv/pulls/83))
* [kevinruddy](https://codeberg.org/kevinruddy) - added decimal units option ([#85](https://codeberg.org/ivarch/pv/pulls/85))
* [xmort](https://codeberg.org/xmort) - added **--output** option ([#90](https://codeberg.org/ivarch/pv/pulls/90))
* [bogiord](https://codeberg.org/bogiord) - reported the loss of output block device size detection in 1.8.10, and suggested the fix ([#91](https://codeberg.org/ivarch/pv/issues/91))
* [eborisch](https://codeberg.org/eborisch) - provided fix for misbehaviour when used with "`zfs send`" due to treating zero sized writes (generally due to timer interruption) as end of file ([#92](https://codeberg.org/ivarch/pv/pulls/92), [#93](https://codeberg.org/ivarch/pv/pulls/93))
* [alexanderperlis](https://codeberg.org/alexanderperlis) - provided initial support for block devices with **--size `@`FILE** ([#94](https://codeberg.org/ivarch/pv/pulls/94))
* [jettero](https://codeberg.org/jettero) - reported double-free coredump when using **--watchfd** after 1.8.10 ([#96](https://codeberg.org/ivarch/pv/issues/96))
* Venky.N.Iyer - suggested **--stats** ([#49](https://codeberg.org/ivarch/pv/issues/49))
* Roland Kletzing - suggested **--rate** with **--numeric** ([#17](https://codeberg.org/ivarch/pv/issues/17))
* [Michael Mior](https://codeberg.org/michaelmior) - suggested **--store-and-forward** ([#100](https://codeberg.org/ivarch/pv/issues/100))
* [dbungert](https://codeberg.org/dbungert) - reported issue with *valgrind* 3.23 misreporting leaking file descriptors ([#97](https://codeberg.org/ivarch/pv/issues/97))
* Joachim Haga - suggested showing progress in the window title ([#3](https://codeberg.org/ivarch/pv/issues/3))
* [Martin Sarsale](https://github.com/runa) - suggested showing progress in the process title ([#4](https://codeberg.org/ivarch/pv/issues/4))
* [2bits](https://github.com/2bits) - reported position sensing fault with **--watchfd** in 1.9.0 ([#118](https://codeberg.org/ivarch/pv/issues/118))
* [heitbaum](https://codeberg.org/heitbaum) - assisted with cross-compilation fault introduced in 1.9.7 ([#120](https://codeberg.org/ivarch/pv/issues/120))
* [meego](https://codeberg.org/meego) - suggested "**%nL**", the last line preview ([#121](https://codeberg.org/ivarch/pv/issues/121))
* [Alexander Petrossian](https://github.com/neopaf) - suggested using Unicode output for a more granular progress bar, and provided the codepoints to use ([#15](https://codeberg.org/ivarch/pv/issues/15))
* [jmealo](https://codeberg.org/jmealo) - suggested JSON progress output ([#127](https://codeberg.org/ivarch/pv/issues/127))
* [ipaqmaster](https://codeberg.org/ipaqmaster) - investigated 100%-CPU utilisation bug when piping to a command that has exited ([#164](https://codeberg.org/ivarch/pv/issues/164))
* Andriy Galetski, and also [thinrope](https://codeberg.org/thinrope) - suggested the "**--sparse**" option ([#45](https://codeberg.org/ivarch/pv/issues/45))
* [KimHansen](https://codeberg.org/KimHansen) - suggested that "**--watchfd**" should keep its display when the process ends ([#81](https://codeberg.org/ivarch/pv/issues/81))
* [njt](https://codeberg.org/njt) - suggested that "**--size** @*PATH*" should accept directories ([#179](https://codeberg.org/ivarch/pv/issues/179))
* [mojohakase](https://codeberg.org/mojohakase) - provided fix for multiplication bug when combining "**--bits**" with "**--gauge**" ([#182](https://codeberg.org/ivarch/pv/issues/182))
* [traq6046](https://codeberg.org/traq6046) - highlighted autoreconf issues with the repository ([#185](https://codeberg.org/ivarch/pv/issues/185))
* [heitbaum](https://codeberg.org/heitbaum) - fixed GCC warning when using glibc 2.43 ([#180](https://codeberg.org/ivarch/pv/pulls/180))
* [haarp](https://codeberg.org/haarp) - reported that control-C writes "^C" over the progress, and suggested a fix ([#187](https://codeberg.org/ivarch/pv/issues/187))
* [Wolfgang Hoschek](https://codeberg.org/whoschek) - provided a fix for the endless wait if the output receiver exits before emptying the pipe ([#189](https://codeberg.org/ivarch/pv/issues/189))
* [oech3](https://codeberg.org/oech3) - suggested and tested performance improvements using `splice()` in more situations on Linux ([#188](https://codeberg.org/ivarch/pv/issues/188), [#191](https://codeberg.org/ivarch/pv/issues/191), [#192](https://codeberg.org/ivarch/pv/issues/192))
* [Barak A. Pearlmutter](https://codeberg.org/barak) - suggested that "**--rate-limit**" should accept non-integer values ([#193](https://codeberg.org/ivarch/pv/issues/193))
* [dirkmueller](https://codeberg.org/dirkmueller) - fixed the potential for stdout closure under a combination of error conditions in **--monitor** mode ([#201](https://codeberg.org/ivarch/pv/pulls/201))
* [InkstainTheBat](https://codeberg.org/InkstainTheBat) - suggested ConEmu OSC 9;4 support ([#202](https://codeberg.org/ivarch/pv/issues/202))
Translations provided through [Codeberg Weblate](https://translate.codeberg.org/projects/pv/):
* **Czech**
* [mmatous](https://translate.codeberg.org/user/mmatous/) (135)
* **Finnish**
* [artnay](https://translate.codeberg.org/user/artnay/) (65)
* [Ricky-Tigg](https://translate.codeberg.org/user/Ricky-Tigg/) (66)
* **French**
* anonymous suggestions (7)
* [milimarg](https://codeberg.org/milimarg) (13)
* [Maxi_Mega](https://translate.codeberg.org/user/Maxi_Mega/) (11)
* **German**
* [Hartmut Goebel](https://translate.codeberg.org/user/htgoebel/) (77)
* [m0yellow](https://translate.codeberg.org/user/m0yellow/) (9)
* [Benny](https://translate.codeberg.org/user/Benny/) (7)
* [kre](https://translate.codeberg.org/user/kre/) (2)
* [fnetX](https://translate.codeberg.org/user/fnetX/) (1)
* **Italian**
* [ldm](https://translate.codeberg.org/user/ldm/) (27)
* **Polish**
* [coralpink](https://translate.codeberg.org/user/coralpink/) (122)
* **Russian**
* [0ko](https://translate.codeberg.org/user/0ko/) (157)
* [some_user](https://translate.codeberg.org/user/some_user/) (7)
* **Turkish**
* [omerdduran](https://translate.codeberg.org/user/omerdduran/) (129)
* [Oğuz Ersen](https://codeberg.org/ersen) (8)
---
+135 -52
View File
@@ -1,30 +1,30 @@
# Notes for developers and translators
The following "`configure`" options will be of interest to developers and
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-debugging** - build in debugging support
* **--enable-profiling** - build in support for profiling
These "`make`" targets are available:
These targets are available when running _make_:
* `make analyse` - run _splint_ and _flawfinder_ on all C source files
* "`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.
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
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
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
@@ -35,11 +35,11 @@ Please note that the memory safety checks will fail with profiling enabled.
## 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`".
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, manually remove the relevant "`.e`" files, or update the
timestamp of the relevant "`.c`" files, before running "`make analyse`"
There are no dependency rules set up for these _".e"_ files, so if a header
file is altered, manually remove the relevant _".e"_ files, or update the
timestamp of the relevant _".c"_ files, before running "`make analyse`"
again.
The goal is for all C source files to generate zero warnings from either
@@ -55,9 +55,18 @@ altered in future.
## Translation notes
Translators can use the Weblate instance hosted by Codeberg:
[https://translate.codeberg.org/projects/pv/](https://translate.codeberg.org/projects/pv/)
If you don't see your language listed, raise an issue on the issue tracker
(or just email the maintainer) asking for it to be added.
Alternatively, read on for details of how to maintain the translations
directly within the source tree.
The message catalogues used to translate program messages into other
languages are in the "`po/`" directory, named "`xx.po`", where "`xx`"
is the ISO 639-1 2-letter language code, such as "`fr`" for French.
languages are in the _"po/"_ 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:
@@ -65,71 +74,145 @@ Each of these files contains lines like this:
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.
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.
It is the _"msgstr"_ lines which need to be updated by translators.
Message catalogue files should all be encoded as UTF-8.
_FIXME: The test below doesn't work on Debian with only en_GB installed, and
also it looks like the compiled-in LOCALEDIR is overriding LOCPATH._
After making a change to a _".po"_ file, test it by compiling it and
installing to a temporary location, like this:
After making a change to a "`.po`" file, test it by compiling it and installing
to a temporary location, like this:
./configure --enable-debugging --prefix=/tmp/yourtest
make clean
make install
localedef -f UTF-8 -i de_DE /tmp/yourtest/share/locale/de_DE.UTF-8
bash
export LOCPATH=/tmp/yourtest/share/locale
export LC_ALL=de_DE.UTF-8
export LANGUAGE=de_DE
/tmp/yourtest/bin/pv --help
exit
make install DESTDIR=/tmp/yourtest
localedef -f UTF-8 -i de_DE /tmp/yourtest/usr/local/share/locale/de_DE.UTF-8
LOCPATH=/tmp/yourtest/usr/local/share/locale \
LC_ALL=de_DE.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
Replace "**--help**" with whatever is appropriate for your test. In this
example, the language being tested is _"de"_ (German), on a system which is
running with UTF-8 support.
To add a new language, create the new message catalogue file under "`po/`"
by copying "`po/pv.pot`" to "`po/xx.po`", where "`xx`" is the language code,
and adjusting it. The "`.pot`" file is generated automatically by "`make`".
In the example above, a new shell is started by typing "`bash`" so that
after your tests, "`exit`" will return you to your previous shell with your
language settings intact.
Next, add the language code to "`po/LINGUAS`" - this is a list of the
Note that at the start, you have to re-run _configure_ with "**--prefix**"
rather than using "`make DESTDIR=...`", because the locale directory is set
at compile time. Also, on Debian at least, both the environment variables
_"LC_ALL"_ and _"LANGUAGE"_ must be set.
To find untranslated strings in a language that's already supported but
which you can help with gaps in, use this command:
msgattrib --untranslated < po/fr.po
replacing _"po/fr.po"_ as appropriate.
To add a new language, create the new message catalogue file under _"po/"_
by copying _"po/pv.pot"_ to _"po/xx.po"_, where _"xx"_ is the language code,
and adjusting it. The _".pot"_ file is generated automatically by _make_.
Next, add the language code to _"po/LINGUAS"_ - this is a list of the
2-letter codes of the supported languages.
Finally, run "`./config.status`" and "`make -C po update-po`".
When the source code is updated, running "`make -C po update-po`" will
update the "`pv.pot`" file so that it lists where all the messages are in
the source. It will also 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
update the _"pv.pot"_ file so that it lists where all the messages are in
the source. It will also 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.
## Benchmarking
The "`docs/benchmark-pv-transfers.sh`" script, introduced in
[#198](https://codeberg.org/ivarch/pv/issues/198), is used to check that new
changes to **pv** aren't making it less efficient at transferring data. Run
it with the **--help** option for a summary of its options.
In _benchmark_ mode, it takes multiple rounds of measurements of the
transfer rate using various different transfer options. The mean (μ) and
standard deviation (σ) of each measurement is produced at the end of the
run. All data is written to the standard output - pipe to "`tee OUTPUT`" to
write to a file _OUTPUT_ while still displaying it on the terminal.
Either a specific **pv** binary can be benchmarked (with the **-p** option),
or multiple **pv** versions can be benchmarked in a single call, each one
counting as an individual run (with the **-d** option, pointing to a
directory containing _tar.gz_ source archives).
Transfer rate measurements use up to two test files, the size of which can
be overridden by the **-s** option, and some measurements will transfer and
discard zeros from _/dev/zero_, the amount of which can be overridden with
the **-z** option.
The measured rates may vary significantly due to external factors such as
system load, so multiple measurement rounds (the **-r** option) are
recommended per run.
In _analyse_ mode, the results of multiple runs are read from standard
input, and a report is produced that shows how each measurement differs
between runs.
If the input data is from multiple versions of **pv**, the differences
between versions will be compared; otherwise, the differences between
individual runs will be compared. The **-c** option overrides this.
When re-using data from multiple runs, the **-f** option causes the report
to only show the differences between the last two runs (or versions).
The **-t** option produces a terse report that is more machine-readable.
In _measurements_ mode, a list of all of the measurement types is produced.
Each type of measurement has an associated ID - these IDs can be passed to
the benchmark mode to only run a subset of the measurements in that run.
## Release checklist
The package maintainer should run through these steps for a new release:
* Check for patches and bug reports at https://tracker.debian.org/pkg/pv
* Check for patches and bug reports:
* <https://codeberg.org/ivarch/pv/issues>
* <https://tracker.debian.org/pkg/pv>
* <https://launchpad.net/ubuntu/+source/pv>
* <https://archlinux.org/packages/extra/x86_64/pv/>
* <https://packages.gentoo.org/packages/sys-apps/pv>
* <https://cvsweb.openbsd.org/ports/sysutils/pv/>
* <https://packages.fedoraproject.org/pkgs/pv/pv/>
* Check for translation updates <https://translate.codeberg.org/projects/pv>
* Run "`make indent; make indent indentclean check`"
* Check that _po/POTFILES.in_ is up to date
* Run "`make -C po update-po`"
* Run "`make analyse`" and see whether remaining warnings can be addressed
* Version bump and documentation checks:
* Update the version in `configure.ac` and `docs/NEWS.md`
* Check that `docs/NEWS.md` is up to date
* Check that `docs/TODO.md` is up to date
* Check that the manual `docs/pv.1` is up to date
* Update the version in _configure.ac_ and _docs/NEWS.md_
* Check that _docs/NEWS.md_ is up to date
* Check that the manual _docs/pv.1_ is up to date
* Run "`make docs/pv.1.md`" and, if using VPATH, copy the result to the source directory
* Check that the year displayed by _src/main/version.c_ is correct
* Ensure everything has been committed to the repository
* Run "`autoreconf`" in the source directory
* Run "`autoreconf -is`" in the source directory
* Consistency and build checks:
* Wipe the build directory, and run "`configure`" there
* Wipe the build directory, and run _configure_ there
* Run "`make distcheck`"
* Run "`./configure && make check`" on all test systems including Cygwin, using the `tar.gz` that was just created
* Run a cross-compilation check
* Run "`make release MAINTAINER=<signing-user>`"
* Update the project web site:
* Copy the release `.tar.gz`, `.txt`, and `.asc` files to the web site
* Use "`pandoc --from markdown --to html`" to convert the TODO, news, and manual to HTML
* Update the TODO, news, and manual on the web site
* Copy the release _.tar.gz_, _.txt_, and _.asc_ files to the web site
* Use "`pandoc --from markdown --to html`" to convert the news and manual to HTML
* Update the news and manual on the web site
* Update the version numbers on the web site
* Update the package index on the web site
* Create a new release in the repository, and apply the associated tag
+320 -141
View File
@@ -1,59 +1,238 @@
### UNRELEASED
* *feature:* new **--format** string **%{progress-conemu}**, and option **--conemu**, to show progress in the terminal title tab on terminals with ConEmu OSC 9;4 support ([#202](https://codeberg.org/ivarch/pv/issues/202))
* *cleanup:* eliminate potential for closure of standard output under a combination of error conditions when using **--monitor** mode ([#201](https://codeberg.org/ivarch/pv/pulls/201))
* *i18n:* Italian translations added
* *i18n:* Russian translations updated
* *i18n:* empty Romanian message catalogue added, awaiting translations
### 1.11.0 - 11 June 2026
* *feature:* new **--monitor** option to run a command and watch its input, output, or both ([#67](https://codeberg.org/ivarch/pv/issues/67))
* *feature:* allow decimal values for **--rate-limit** ([#193](https://codeberg.org/ivarch/pv/issues/193))
* *feature:* extend the **--format** string **%T**/**%{buffer-percent}** to indicate the transfer method when the buffer isn't being used
* *performance:* insert an intermediate input pipe where it would allow `splice()` to be used in more circumstances ([#188](https://codeberg.org/ivarch/pv/issues/188))
* *performance:* use `copy_file_range`(2) when the input and output are both regular files ([#196](https://codeberg.org/ivarch/pv/issues/196))
* *performance:* improve **--discard** performance by splicing to /dev/null internally ([#191](https://codeberg.org/ivarch/pv/issues/191))
* *fix:* report signal interrupts on a new line, so that control-C doesn't write "^C" over the progress ([#187](https://codeberg.org/ivarch/pv/issues/187))
* *fix:* prevent an endless wait if there is unread data in the output pipe when its reader terminates ([#189](https://codeberg.org/ivarch/pv/issues/189))
* *fix:* prevent `splice()` from falling back to `read()` when using **--rate-limit**
* *fix:* stop spliced transfers requiring two EOFs when the input is a terminal
* *fix:* add timer interrupt to spliced transfers to avoid progress display lockup when the receiver stalls
* *fix:* exit with an error if the PID file given to **--pidfile** cannot be replaced
* *fix:* correct the **--help** word wrapping on very small terminals
* *i18n:* Polish translations updated
* *i18n:* Finnish translations updated
* *i18n:* German translations updated
* *i18n:* French translations updated
* *i18n:* partial draft of Georgian translations added
* *i18n:* removed empty unmaintained translation catalogue for Spanish
* *cleanup:* fix GCC warning when using glibc 2.43 ([#180](https://codeberg.org/ivarch/pv/pulls/180))
* *cleanup:* fix warning in pv_remote_check() stub on OpenBSD
* *cleanup:* use dynamic line buffers for **--watchfd** process lookups
* *cleanup:* replace the blanket 100,000-hour clamp on displayed times with a million days for timer and ETA, and 7,000 years for estimated finish time, on 64-bit systems
* *cleanup:* use rounding when calculating ETA, and avoid integer overflows, particularly on 32-bit systems
* *cleanup:* standardise the error reporting mechanism
* *cleanup:* improve code comments
### 1.10.5 - 22 March 2026
* *fix:* when using **--bits** with **--gauge**, don't incorrectly multiply the rate twice ([#182](https://codeberg.org/ivarch/pv/issues/182))
### 1.10.4 - 8 March 2026
* *fix:* when using **--size @PATH**, *PATH* can be a directory, and the total size of all files within it will be used ([#179](https://codeberg.org/ivarch/pv/issues/179))
### 1.10.3 - 15 December 2025
* *fix:* stop truncating the process title set by **--extra-display**
### 1.10.2 - 22 November 2025
* *i18n:* Finnish translations updated
* *cleanup:* adjust valgrind suppressions so memory safety tests work on LTO builds ([#174](https://codeberg.org/ivarch/pv/issues/174)/[Debian bug 1121157](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1121157))
### 1.10.1 - 12 November 2025
* *fix:* correct **--watchfd** memory allocation error when given multiple arguments ([#170](https://codeberg.org/ivarch/pv/issues/170))
### 1.10.0 - 7 November 2025
* *feature:* new **--query** option to show the transfer status of another running **pv** ([#101](https://codeberg.org/ivarch/pv/issues/101))
* *fix:* make the timers work consistently in **--watchfd** if paused and resumed ([#169](https://codeberg.org/ivarch/pv/issues/169))
### 1.9.44 - 18 October 2025
* *feature:* new **--sparse** option to write sparse output ([#45](https://codeberg.org/ivarch/pv/issues/45))
* *fix:* don't clear the **--watchfd** display when the watched process ends ([#81](https://codeberg.org/ivarch/pv/issues/81))
### 1.9.42 - 11 October 2025
* *feature:* permit multiple arguments to **--watchfd** ([#12](https://codeberg.org/ivarch/pv/issues/12))
* *feature:* new "**=NAME**" syntax for **--watchfd** to watch processes by name using **pgrep**(1) ([#95](https://codeberg.org/ivarch/pv/issues/95))
* *feature:* new "**@LISTFILE**" syntax for **--watchfd** to watch processes listed in a file
* *fix:* improve support for changing the format of a **--watchfd** process with **--remote**
* *fix:* don't read more than **--size** bytes when using **--stop-at-size** ([#166](https://codeberg.org/ivarch/pv/issues/166))
* *fix:* transfer nothing if **--stop-at-size** is given a **--size** of 0 ([#166](https://codeberg.org/ivarch/pv/issues/166))
* *i18n:* Finnish translation stub added
* *i18n:* Turkish translations updated
### 1.9.34 - 26 July 2025
* *fix:* prevent tight loop consuming CPU when waiting for a partially filled output pipe to be drained ([#164](https://codeberg.org/ivarch/pv/issues/164))
* *fix:* correct a memory handling fault when using **--bar-style** with **--watchfd** ([#163](https://codeberg.org/ivarch/pv/issues/163))
* *i18n:* French translations updated
### 1.9.31 - 28 January 2025
* *feature:* the **--format** option can now be used with **--numeric** for customised numeric output, such as JSON ([#127](https://codeberg.org/ivarch/pv/issues/127))
* *i18n:* German translations updated
* *i18n:* Polish translations updated
* *i18n:* Russian translations updated
### 1.9.27 - 12 January 2025
* *fix:* turn off IPC support if _sys/shm.h_ is not available, for compilation on Termux
* *fix:* bypass valgrind checks on ARM by default due to false positives
### 1.9.25 - 22 December 2024
* *fix:* test failure of **--watchfd** on macOS corrected ([#124](https://codeberg.org/ivarch/pv/issues/124))
### 1.9.24 - 19 December 2024
* *feature:* new **--format** sequences for graphical progress bars - "**%{bar-block}**", "**%{bar-granular}**", and "**%{bar-shaded}**" ([#15](https://codeberg.org/ivarch/pv/issues/15))
* *feature:* new **--format** sequence "**%{sgr:colour,...}**" to use ECMA-48 Select Graphic Rendition codes to add colours
* *feature:* new **--bar-style** option to change the default bar style ([#15](https://codeberg.org/ivarch/pv/issues/15))
* *feature:* allow decimal values such as "1.5G" with "**--size**", "**--rate-limit**", "**--buffer-size**", and "**error-skip-block**" ([#35](https://codeberg.org/ivarch/pv/issues/35))
* *cleanup:* improve progress bar granularity on wide displays by internally tracking the transfer percentage as a decimal number
* *cleanup:* correct detection of **--remote** usability on GNU Hurd
* *cleanup:* reduce likelihood of race conditions in tests when running on slow systems
* *cleanup:* reduce memory footprint
* *docs:* simplified the synopsis section of the manual
### 1.9.15 - 8 December 2024
* *feature:* new **--format** sequence "**%nL**", showing the most recent line written ([#121](https://codeberg.org/ivarch/pv/issues/121))
* *feature:* each **--format** sequence now has a more readable equivalent name, for example "**%r**" can be written as "**%{rate}**"
* *feature:* new **--format** sequences "**%{progress-bar-only}**" and "**%{progress-amount-only}**"
* *fix:* allow **--format** to include "%nA" more than once, with different "n" values ([#122](https://codeberg.org/ivarch/pv/issues/122))
* *fix:* allow **--format** to include "%p" more than once, with optional width prefix
* *fix:* calculate width correctly when wide characters are in **--format** strings
* *fix:* add _configure_ script fallback for **--remote** check when cross-compiling ([#120](https://codeberg.org/ivarch/pv/issues/120))
* *fix:* allow **extra-display** to be changed by **--remote** ([#123](https://codeberg.org/ivarch/pv/issues/123))
* *cleanup:* refactored display formatters into separate functions
* *cleanup:* improve format parser handling of dangling or invalid "%" sequences
### 1.9.7 - 2 December 2024
* *feature:* new **--extra-display** option to update window and process titles ([#3](https://codeberg.org/ivarch/pv/issues/3), [#4](https://codeberg.org/ivarch/pv/issues/4))
* *fix:* correct failure to report file positions in **--watchfd** ([#118](https://codeberg.org/ivarch/pv/issues/118))
* *i18n:* Russian translations added
* *cleanup:* tests added for **--watchfd** ([#10](https://codeberg.org/ivarch/pv/issues/10))
* *cleanup:* worked around file descriptor leak false positives in valgrind 3.23 ([#97](https://codeberg.org/ivarch/pv/issues/97))
* *cleanup:* cleared all *shellcheck* warnings in the test scripts
* *cleanup:* check at compile-time whether **--remote** is going to be usable ([#119](https://codeberg.org/ivarch/pv/issues/119))
### 1.9.0 - 15 October 2024
* *feature:* new **--store-and-forward** option to read input to a file first, then write it to the output ([#100](https://codeberg.org/ivarch/pv/issues/100))
* *feature:* new **--stats** option to show transfer stats at the end, like "`ping`" ([#49](https://codeberg.org/ivarch/pv/issues/49))
* *feature:* **--rate** can now be used with **--numeric** ([#17](https://codeberg.org/ivarch/pv/issues/17))
* *feature:* **--gauge** with **--progress** to show rate gauge when size is unknown ([#46](https://codeberg.org/ivarch/pv/issues/46))
* *i18n:* comprehensive German translations update
* *i18n:* comprehensive Polish translations update
* *i18n:* complete Turkish translations added
* *i18n:* complete Czech translations added
* *i18n:* updates to French translations
* *fix:* resume stopped pipelines when running in the background (part of [#56](https://codeberg.org/ivarch/pv/issues/56))
* *fix:* inspect the output pipe buffer to give a more accurate progress indicator of how much the next command has consumed
* *fix:* prefix completion time (**--fineta**) with *FIN* rather than *ETA* ([#43](https://codeberg.org/ivarch/pv/issues/43))
* *fix:* surround average rate (**--average-rate**) with brackets rather than square brackets
* *fix:* correct a memory leak in **--watchfd PID**
* *fix:* make **--direct-io** work correctly with **--output** instead of assuming stdout
* *fix:* call `posix_fadvise()` on every input, not just the first one
* *fix:* write UTC timestamps in debugging mode to avoid lockups in signal handlers
* *security:* added a signed *MANIFEST* file to releases
* *cleanup:* removed TODO.md, since it's just an outdated copy of the issue tracker
* *cleanup:* re-ordered structure members to reduce padding
* *cleanup:* improved readability of *SIGTTOU* handling code
* *cleanup:* refactored to separate display, transfer, and calculation more cleanly
* *cleanup:* instead of moving stderr when backgrounded, set a suspend-output flag
### 1.8.14 - 7 September 2024
* *fix:* correct double-free on exit when using **--watchfd** ([#96](https://codeberg.org/ivarch/pv/issues/96)) reported by [jettero](https://codeberg.org/jettero)
### 1.8.13 - 18 August 2024
* *feature:* when using **--size @FILE**, *FILE* can be a block device, and its size will be used (pull request [#94](https://codeberg.org/ivarch/pv/pulls/94)) supplied by [alexanderperlis](https://codeberg.org/alexanderperlis)
### 1.8.12 - 18 July 2024
* *fix:* correct the detection of output block device size that was broken in 1.8.10 ([#91](https://codeberg.org/ivarch/pv/issues/91))
* *fix:* do not treat a zero/interrupted write as an end of file (pull requests [#92](https://codeberg.org/ivarch/pv/pulls/92) and [#93](https://codeberg.org/ivarch/pv/pulls/93))
### 1.8.10 - 15 June 2024
* *feature:* new **--output** option to write to a file instead of standard output (pull request [#90](https://codeberg.org/ivarch/pv/pulls/90)) supplied by [xmort](https://codeberg.org/xmort)
### 1.8.9 - 21 April 2024
* feature: new "`--si`" option to display and interpret size suffixes in multiples of 1000 rather than 1024 (pull request [#85](https://codeberg.org/a-j-wood/pv/pulls/85)) supplied by [kevinruddy](https://codeberg.org/kevinruddy)
* fix: continue producing progress output when the output is blocking writes ([#34](https://codeberg.org/a-j-wood/pv/issues/34), [#86](https://codeberg.org/a-j-wood/pv/issues/86), [#87](https://codeberg.org/a-j-wood/pv/issues/87))
* fix: honour the _TMPDIR_ / _TMP_ environment variables again, rather than hard-coding "`/tmp`", when using a terminal lock file (originally removed in 1.8.0) ([#88](https://codeberg.org/a-j-wood/pv/issues/88))
* i18n: corrections and missing strings added to French translations (pull request [#83](https://codeberg.org/a-j-wood/pv/pulls/83)) supplied by [Thomas Bertels](https://codeberg.org/tbertels)
* *feature:* new **--si** option to display and interpret size suffixes in multiples of 1000 rather than 1024 (pull request [#85](https://codeberg.org/ivarch/pv/pulls/85)) supplied by [kevinruddy](https://codeberg.org/kevinruddy)
* *fix:* continue producing progress output when the output is blocking writes ([#34](https://codeberg.org/ivarch/pv/issues/34), [#86](https://codeberg.org/ivarch/pv/issues/86), [#87](https://codeberg.org/ivarch/pv/issues/87))
* *fix:* honour the *TMPDIR* / *TMP* environment variables again, rather than hard-coding "`/tmp`", when using a terminal lock file (originally removed in 1.8.0) ([#88](https://codeberg.org/ivarch/pv/issues/88))
* *i18n:* corrections and missing strings added to French translations (pull request [#83](https://codeberg.org/ivarch/pv/pulls/83)) supplied by [Thomas Bertels](https://codeberg.org/tbertels)
### 1.8.5 - 19 November 2023
* fix: corrected percentage formatting so it doesn't jump from 2 to 3 characters wide at 100% ([#80](https://codeberg.org/a-j-wood/pv/issues/80))
* fix: replaced "`--remote`" mechanism, using a temporary file instead of SysV IPC, so it can work reliably even when there are multiple PV instances
* fix: corrected compilation failure when without IPC support
* security: addressed all issues highlighted by the software auditing tools "`splint`" and "`flawfinder`" (see "`make analyse`") ([#77](https://codeberg.org/a-j-wood/pv/issues/77))
* cleanup: compilation warnings fixed on non-IPC and MacOS systems
* *fix:* corrected percentage formatting so it doesn't jump from 2 to 3 characters wide at 100% ([#80](https://codeberg.org/ivarch/pv/issues/80))
* *fix:* replaced **--remote** mechanism, using a temporary file instead of SysV IPC, so it can work reliably even when there are multiple PV instances
* *fix:* corrected compilation failure when without IPC support
* *security:* addressed all issues highlighted by the software auditing tools "`splint`" and "`flawfinder`" (see "`make analyse`") ([#77](https://codeberg.org/ivarch/pv/issues/77))
* *cleanup:* compilation warnings fixed on non-IPC and MacOS systems
### 1.8.0 - 24 September 2023
#### Features
* feature: new "`--discard`" option to discard input as if writing to */dev/null* ([#42](https://codeberg.org/a-j-wood/pv/issues/42))
* feature: new "`--error-skip-block`" option to make "`--skip-errors`" skip whole blocks ([#37](https://codeberg.org/a-j-wood/pv/issues/37))
* feature: use `posix_fadvise()` like `cat`(1) does, to improve efficiency ([#39](https://codeberg.org/a-j-wood/pv/issues/39))
* feature: new "`--enable-static`" option to "`configure`" for static builds ([#75](https://codeberg.org/a-j-wood/pv/pull/75))
* *feature:* new **--discard** option to discard input as if writing to */dev/null* ([#42](https://codeberg.org/ivarch/pv/issues/42))
* *feature:* new **--error-skip-block** option to make **--skip-errors** skip whole blocks ([#37](https://codeberg.org/ivarch/pv/issues/37))
* *feature:* use `posix_fadvise()` like `cat`(1) does, to improve efficiency ([#39](https://codeberg.org/ivarch/pv/issues/39))
* *feature:* new **--enable-static** option to "`configure`" for static builds ([#75](https://codeberg.org/ivarch/pv/pulls/75))
#### Security
* security: with "`--pidfile`", write to a temporary file and rename it into place, to improve security
* security: keep self-contained copies of name and format string in PV internal state for memory safety
* security: ignore _TMP_ / _TMPDIR_ environment variables when using a terminal lock file
* *security:* with **--pidfile**, write to a temporary file and rename it into place, to improve security
* *security:* keep self-contained copies of name and format string in PV internal state for memory safety
* *security:* ignore *TMP* / *TMPDIR* environment variables when using a terminal lock file
#### Fixes
* fix: only report errors about missing files when starting to transfer from them, not while calculating size, and behave more like `cat`(1) by skipping them and moving on
* fix: auto-calculate total line count with "`--line-mode`" when all inputs are regular files
* fix: use `clock_gettime()` in ETA calculation to cope with machine suspend/resume ([#13](https://codeberg.org/a-j-wood/pv/issues/13))
* fix: if "`--width`" or "`--height`" were provided, do not change them when the window size changes ([#36](https://codeberg.org/a-j-wood/pv/issues/36))
* fix: when a file descriptor position in "`--watchfd`" moves backwards, show the rate using the correct prefix ([#41](https://codeberg.org/a-j-wood/pv/issues/41))
* fix: rewrite terminal state save/restore so state is not intermittently garbled on exit when using "`--cursor`" ([#20](https://codeberg.org/a-j-wood/pv/issues/20)), ([#24](https://codeberg.org/a-j-wood/pv/issues/24))
* *fix:* only report errors about missing files when starting to transfer from them, not while calculating size, and behave more like `cat`(1) by skipping them and moving on
* *fix:* auto-calculate total line count with **--line-mode** when all inputs are regular files
* *fix:* use `clock_gettime()` in ETA calculation to cope with machine suspend/resume ([#13](https://codeberg.org/ivarch/pv/issues/13))
* *fix:* if **--width** or **--height** were provided, do not change them when the window size changes ([#36](https://codeberg.org/ivarch/pv/issues/36))
* *fix:* when a file descriptor position in **--watchfd** moves backwards, show the rate using the correct prefix ([#41](https://codeberg.org/ivarch/pv/issues/41))
* *fix:* rewrite terminal state save/restore so state is not intermittently garbled on exit when using **--cursor** ([#20](https://codeberg.org/ivarch/pv/issues/20)), ([#24](https://codeberg.org/ivarch/pv/issues/24))
#### Cleanups
* cleanup: addressed many potential issues highlighted by the software auditing tools "`splint`" and "`flawfinder`" (see new target "`make analyse`")
* cleanup: switched the build system to GNU Automake
* cleanup: replaced the test harness with the one native to GNU Automake
* cleanup: added a test for terminal width detection to "`make check`"
* cleanup: added a test to "`make check`" to ensure that "`make install`" installs everything expected
* cleanup: replaced *AC_HEADER_TIOCGWINSZ* with *AC_CHECK_HEADERS(sys/ioctl.h)* for better MacOS compatibility ([#74](https://codeberg.org/a-j-wood/pv/issues/74))
* cleanup: with "`--sync`", call `fsync()` instead of `fdatasync()` on incapable systems ([#73](https://codeberg.org/a-j-wood/pv/issues/73))
* cleanup: the manual is now a static file instead of needing to be built with "`configure`"
* *cleanup:* addressed many potential issues highlighted by the software auditing tools "`splint`" and "`flawfinder`" (see new target "`make analyse`")
* *cleanup:* switched the build system to GNU Automake
* *cleanup:* replaced the test harness with the one native to GNU Automake
* *cleanup:* added a test for terminal width detection to "`make check`"
* *cleanup:* added a test to "`make check`" to ensure that "`make install`" installs everything expected
* *cleanup:* replaced *AC_HEADER_TIOCGWINSZ* with *AC_CHECK_HEADERS(sys/ioctl.h)* for better MacOS compatibility ([#74](https://codeberg.org/ivarch/pv/issues/74))
* *cleanup:* with **--sync**, call `fsync()` instead of `fdatasync()` on incapable systems ([#73](https://codeberg.org/ivarch/pv/issues/73))
* *cleanup:* the manual is now a static file instead of needing to be built with "`configure`"
#### Dropped items
* dropped: dropped support for "`--enable-static-nls`"
* dropped: removed the Linux Software Map file, as the LSM project appears to be long dead
* dropped: will no longer publish to SourceForge as it has a chequered history and is unnecessary
* dropped: removed project from GitHub and moved to Codeberg - see "[Give Up GitHub](https://giveupgithub.org/)"
* *dropped:* dropped support for **--enable-static-nls**
* *dropped:* removed the Linux Software Map file, as the LSM project appears to be long dead
* *dropped:* will no longer publish to SourceForge as it has a chequered history and is unnecessary
* *dropped:* removed project from GitHub and moved to Codeberg - see "[Give Up GitHub](https://giveupgithub.org/)"
#### Other items
@@ -61,89 +240,89 @@
### 1.7.24 - 30 July 2023
* fix: correct terminal size detection, broken in 1.7.17 by the configuration script rewrite ([#72](https://codeberg.org/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
* *fix:* correct terminal size detection, broken in 1.7.17 by the configuration script rewrite ([#72](https://codeberg.org/ivarch/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
* *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 [#6](https://codeberg.org/a-j-wood/pv/issues/6), to improve accuracy when writing to slow disks)
* feature: new "`--direct-io`" option to bypass cache - implements [#29 "Option to enable *O_DIRECT*"](https://codeberg.org/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
* cleanup: rewrote `configure.in` as per suggestions in newer "`autoconf`" manuals
* cleanup: replaced `header.in` with one generated by "`autoheader`", moving custom logic to a separate header file "`config-aux.h`"
* cleanup: added copyright notice to all source files as per GNU standards
* cleanup: changed "`--version`" output to conform to GNU standards
* cleanup: replaced backticks with `$()` in all shell scripts that did not come from elsewhere, as backticks are deprecated and harder to read
* cleanup: improved the output formatting of "`make test`"
* cleanup: extended the "`make test`" mechanism to allow certain tests to be skipped on platforms that cannot support them
* cleanup: skip the "pipe" test (for *SIGPIPE*) if GNU "`head`" is not available, so that "`make test`" on stock OpenBSD 7.3 works
* cleanup: added a lot more tests to "`make test`"
* cleanup: replace all calls to `sprintf()` and `snprintf()` with a new wrapper function `pv_snprintf()` to improve security and compatibility
* cleanup: replace all calls to `strcat()` with a wrapper `pv_strlcat()` to improve security and compatibility
* cleanup: replace all `write()` calls to the terminal with a wrapper `pv_write_retry()` for consistency
* cleanup: tidy up and fix compilation warning in "`--watchfd`" code
* cleanup: rewrote all local shell scripts to pass analysis by [ShellCheck](https://www.shellcheck.net)
* *feature:* new **--sync** option to flush cache to disk after every write (related to [#6](https://codeberg.org/ivarch/pv/issues/6), to improve accuracy when writing to slow disks)
* *feature:* new **--direct-io** option to bypass cache - implements [#29 "Option to enable O_DIRECT"](https://codeberg.org/ivarch/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
* *cleanup:* rewrote `configure.in` as per suggestions in newer "`autoconf`" manuals
* *cleanup:* replaced `header.in` with one generated by "`autoheader`", moving custom logic to a separate header file "`config-aux.h`"
* *cleanup:* added copyright notice to all source files as per GNU standards
* *cleanup:* changed **--version** output to conform to GNU standards
* *cleanup:* replaced backticks with `$()` in all shell scripts that did not come from elsewhere, as backticks are deprecated and harder to read
* *cleanup:* improved the output formatting of "`make test`"
* *cleanup:* extended the "`make test`" mechanism to allow certain tests to be skipped on platforms that cannot support them
* *cleanup:* skip the "pipe" test (for *SIGPIPE*) if GNU "`head`" is not available, so that "`make test`" on stock OpenBSD 7.3 works
* *cleanup:* added a lot more tests to "`make test`"
* *cleanup:* replace all calls to `sprintf()` and `snprintf()` with a new wrapper function `pv_snprintf()` to improve security and compatibility
* *cleanup:* replace all calls to `strcat()` with a wrapper `pv_strlcat()` to improve security and compatibility
* *cleanup:* replace all `write()` calls to the terminal with a wrapper `pv_write_retry()` for consistency
* *cleanup:* tidy up and fix compilation warning in **--watchfd** code
* *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://codeberg.org/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://codeberg.org/a-j-wood/pv/pull/60) supplied by [christoph-zededa](https://github.com/christoph-zededa))
* feature: new "`--bits`" option to show bit count instead of byte count (adapted from pull request [#63](https://codeberg.org/a-j-wood/pv/pull/63) supplied by [Nick Black](https://nick-black.com))
* feature: new "`--average-rate-window`" option, to set the window over which the average rate is calculated, also used for ETA (modified from pull request [#65](https://codeberg.org/a-j-wood/pv/pull/65) supplied by [lemonsqueeze](https://github.com/lemonsqueeze))
* feature: the "`--watchfd`" option will now show relative filenames, if they are under the current directory (pull request [#66](https://codeberg.org/a-j-wood/pv/pull/66) supplied by [ikasty](https://github.com/ikasty))
* fix: correction to `pv_in_foreground()` to behave as its comment block says it should, when not on a terminal - corrects [#19 "No output in Arch Linux initcpio after 1.6.6"](https://codeberg.org/a-j-wood/pv/issues/19), [#31 "No output written from inside zsh <() construct"](https://codeberg.org/a-j-wood/pv/issues/31), [#55 "pv Stopped Working in the Background"](https://codeberg.org/a-j-wood/pv/issues/55) (pull request [#64](https://codeberg.org/a-j-wood/pv/pull/64) supplied by [Michael Weiß](https://github.com/quitschbo))
* fix: workaround for OS X 11 behaviour in configure script regarding stat64 at compile time (pull request [#57](https://codeberg.org/a-j-wood/pv/pull/57) supplied by [Dave Beckett](https://github.com/dajobe))
* fix: workaround for macOS equivalence of stat to stat64 - patches from [Filippo Valsorda](https://github.com/FiloSottile) and [Demitri Muna](https://github.com/demitri), correcting [#33 "Fix compilation problems due to `stat64()` on Apple Silicon"](https://codeberg.org/a-j-wood/pv/issues/33)
* fix: add burst rate limit to transfer, so rate limits are not broken by bursty traffic (pull request [#62](https://codeberg.org/a-j-wood/pv/pull/62) supplied by [Volodymyr Bychkovyak](https://github.com/vbychkoviak))
* fix: corrected "`--force`" option so it will still output progress when not in the same process group as the owner of the terminal - corrects [#23 "No output with "`-f`" when run in background after 1.6.6"](https://codeberg.org/a-j-wood/pv/issues/23) and helps to correct [#31 "No output written from inside zsh <() construct"](https://codeberg.org/a-j-wood/pv/issues/31)
* fix: corrected elapsed time display to show as D:HH:MM:SS after 1 day, like the ETA does - corrects [#16 "Show days in same format in ETA as in elapsed time"](https://codeberg.org/a-j-wood/pv/issues/16)
* fix: corrected bug where percentages went down after 100% when in "`--numeric`" mode with a "`--size`" that was too small - corrects [#26 "Correct "`-n`" behaviour when going past 100% of "`-s`" size"](https://codeberg.org/a-j-wood/pv/issues/26)
* i18n: recoded Polish translation file to UTF-8
* i18n: removed inaccurate fuzzy translation matches
* docs: moved all open issues into GitHub and updated the TODO list
* docs: renamed README to README.md and altered it to Markdown format
* docs: moved contributors from the README to docs/ACKNOWLEDGEMENTS.md
* docs: moved TODO to TODO.md and altered it to Markdown format
* docs: moved NEWS to NEWS.md, converted it to UTF-8, and altered it to Markdown format
* *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://codeberg.org/ivarch/pv/pulls/57) supplied by [Dave Beckett](https://github.com/dajobe))
* *feature:* the **--watchfd** option is now available on OS X (pull request [#60](https://codeberg.org/ivarch/pv/pulls/60) supplied by [christoph-zededa](https://github.com/christoph-zededa))
* *feature:* new **--bits** option to show bit count instead of byte count (adapted from pull request [#63](https://codeberg.org/ivarch/pv/pulls/63) supplied by [Nick Black](https://nick-black.com))
* *feature:* new **--average-rate-window** option, to set the window over which the average rate is calculated, also used for ETA (modified from pull request [#65](https://codeberg.org/ivarch/pv/pulls/65) supplied by [lemonsqueeze](https://github.com/lemonsqueeze))
* *feature:* the **--watchfd** option will now show relative filenames, if they are under the current directory (pull request [#66](https://codeberg.org/ivarch/pv/pulls/66) supplied by [ikasty](https://github.com/ikasty))
* *fix:* correction to `pv_in_foreground()` to behave as its comment block says it should, when not on a terminal - corrects [#19 "No output in Arch Linux initcpio after 1.6.6"](https://codeberg.org/ivarch/pv/issues/19), [#31 "No output written from inside zsh <() construct"](https://codeberg.org/ivarch/pv/issues/31), [#55 "pv Stopped Working in the Background"](https://codeberg.org/ivarch/pv/issues/55) (pull request [#64](https://codeberg.org/ivarch/pv/pulls/64) supplied by [Michael Weiß](https://github.com/quitschbo))
* *fix:* workaround for OS X 11 behaviour in configure script regarding stat64 at compile time (pull request [#57](https://codeberg.org/ivarch/pv/pulls/57) supplied by [Dave Beckett](https://github.com/dajobe))
* *fix:* workaround for macOS equivalence of stat to stat64 - patches from [Filippo Valsorda](https://github.com/FiloSottile) and [Demitri Muna](https://github.com/demitri), correcting [#33 "Fix compilation problems due to `stat64()` on Apple Silicon"](https://codeberg.org/ivarch/pv/issues/33)
* *fix:* add burst rate limit to transfer, so rate limits are not broken by bursty traffic (pull request [#62](https://codeberg.org/ivarch/pv/pulls/62) supplied by [Volodymyr Bychkovyak](https://github.com/vbychkoviak))
* *fix:* corrected **--force** option so it will still output progress when not in the same process group as the owner of the terminal - corrects [#23 "No output with "-f" when run in background after 1.6.6"](https://codeberg.org/ivarch/pv/issues/23) and helps to correct [#31 "No output written from inside zsh <() construct"](https://codeberg.org/ivarch/pv/issues/31)
* *fix:* corrected elapsed time display to show as D:HH:MM:SS after 1 day, like the ETA does - corrects [#16 "Show days in same format in ETA as in elapsed time"](https://codeberg.org/ivarch/pv/issues/16)
* *fix:* corrected bug where percentages went down after 100% when in **--numeric** mode with a **--size** that was too small - corrects [#26 "Correct "-n" behaviour when going past 100% of "-s" size"](https://codeberg.org/ivarch/pv/issues/26)
* *i18n:* recoded Polish translation file to UTF-8
* *i18n:* removed inaccurate fuzzy translation matches
* *docs:* moved all open issues into GitHub and updated the TODO list
* *docs:* renamed README to README.md and altered it to Markdown format
* *docs:* moved contributors from the README to docs/ACKNOWLEDGEMENTS.md
* *docs:* moved TODO to TODO.md and altered it to Markdown format
* *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)
* *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)
* i18n: updated German "`--help`" translations (Richard Fonfara)
* i18n: switched to UTF-8 encoding, added missing translations (de,fr,pt)
* docs: new "common switches" manual section (Jacek Wielemborek)
* docs: use placeholder instead of `/dev/sda` in the manual (Pranav Peshwe)
* docs: mention MacOS pipes and "`-B 1024`" in the manual (Jan Venekamp)
* docs: correct shell in `autoconf/scripts/index.sh` (Juan Picca)
* cleanup: various compiler warnings cleaned up
* *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)
* *i18n:* updated German **--help** translations (Richard Fonfara)
* *i18n:* switched to UTF-8 encoding, added missing translations (de,fr,pt)
* *docs:* new "common switches" manual section (Jacek Wielemborek)
* *docs:* use placeholder instead of `/dev/sda` in the manual (Pranav Peshwe)
* *docs:* mention MacOS pipes and **-B 1024** in the manual (Jan Venekamp)
* *docs:* correct shell in `autoconf/scripts/index.sh` (Juan Picca)
* *cleanup:* various compiler warnings cleaned up
Full changelog is below:
* (r181) added common switches section to manual (Jacek Wielemborek)
* (r184) use placeholder instead of /dev/sda in the manual (Pranav Peshwe)
* (r185) replace ash with sh in autoconf/scripts/index.sh (Juan Picca)
* (r185) added note to manual about "`-B 1024`" in MacOS pipes (Jan Venekamp)
* (r185) added note to manual about **-B 1024** in MacOS pipes (Jan Venekamp)
* (r185) fix AIX config check when the CWD contains "yes" (Peter Korsgaard)
* (r189) (#1556) updated German "`--help`" translations (Richard Fonfara)
* (r189) (#1556) updated German **--help** translations (Richard Fonfara)
* (r189) updated missing German translations and changed to UTF-8 encoding
* (r191) updated missing French translations and changed to UTF-8 encoding
* (r193) updated missing Portuguese translations, changed to UTF-8 encoding
* (r196) (#1563) using "`-B`", "`-A`", or "`-T`" now switches on "`-C`" implicitly (Johannes Gerer, André Stapf)
* (r196) (#1563) using **-B**, **-A**, or **-T** now switches on **-C** implicitly (Johannes Gerer, André Stapf)
* (r199) fixed numerous compiler warnings in newer GCC versions
* (r200,205) fixed bug where "`pv /dev/zero >/dev/null &`" stopped immediately (Jonathan Elchison, Andriy Gapon)
* (r203,205) marked unused arguments with GCC unused attribute, started using boolean data type for flags, corrected more compiler warnings
@@ -151,22 +330,22 @@ Full changelog is below:
### 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é)
* (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
* (r169) (#1477) use alternate form for transfer counter, such that 13GB is shown as 13.0GB so it's the same width as 13.1GB (André Stapf)
* (r171) cleanup: units corrections in man page, of the form kb -> KiB
* (r175) report error in "`-d`" if process fd directory is unreadable, or if process disappears before we start the main loop (Jacek Wielemborek)
* (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)
* (#1509) change ETA ("`--eta`" / "`-e`") so that days are given if the hours remaining are 24 or more (Jacek Wielemborek)
* (#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)
* (#1509) change ETA (**--eta** / **-e**) so that days are given if the hours remaining are 24 or more (Jacek Wielemborek)
* (#1499) repeat read and write attempts on partial buffer fill/empty to work around post-signal transfer rate drop reported by Ralf Ramsauer
* (#1507) do not try to calculate total size in line mode, due to bug reported by Jacek Wielemborek and Michiel Van Herwegen
* cleanup: removed defunct RATS comments and unnecessary copyright notices
* clean up displayed lines when using "`--watchfd PID`", when PID exits
* clean up displayed lines when using **--watchfd PID**, when PID exits
* output errors on a new line to avoid overwriting transfer bar
### 1.5.7 - 26 August 2014
@@ -182,25 +361,25 @@ Full changelog is below:
### 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)
* 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 package documentation and always will be)
### 1.5.1 - 23 January 2014
* new option "`--watchfd`" - suggested by Jacek Wielemborek and "fdwatch"
* new option **--watchfd** - suggested by Jacek Wielemborek and "fdwatch"
* use non-block flag with `splice()`
* new display option "`--buffer-percent`", suggested by Kim Krecht
* new display option "`--last-written`", suggested by Kim Krecht
* new transfer option "`--no-splice`"
* new display option **--buffer-percent**, suggested by Kim Krecht
* new display option **--last-written**, suggested by Kim Krecht
* new transfer option **--no-splice**
* fix for minor bug which dropped display elements after one empty one
* fix for single fd leak on exit (Cristian Ciupitu)
### 1.4.12 - 5 August 2013
* new option "`--null`" - patch supplied by Zing Shishak
* 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
* AIX **-c** fixes - with help from Pawel Piatek
* SCO build fix (`po2table.sh`) - reported by Wouter Pronk
* test scripts fix for older distributions - patch from Bryan Dongray
* fix for `splice()` not using stdin - patch from Zev Weiss
@@ -211,41 +390,41 @@ Full changelog is below:
### 1.4.5 - 10 January 2013
* updated manual page to show known problem with "`-R`" on Cygwin
* 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`"
* 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
* 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
* new option **--stop-at-size** to stop after **--size** bytes
* report correct filename on read errors
* fix use-after-free bug in remote PID cleanup code
* 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`"
* 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)
* 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
* new **--disable-splice** configure script option
* fixed line mode size count with multiple files (Moritz Barsnick)
* fixes for AIX core dumps (Pawel Piatek)
@@ -268,10 +447,10 @@ Full changelog is below:
### 1.2.0 - 14 December 2010
* integrated improved SI prefixes and "`--average-rate`" (Henry Gebhardt)
* 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
* fix i18n especially for "`--help`" (Sebastian Kayser)
* fix i18n especially for **--help** (Sebastian Kayser)
* refactored `pv_display`
* we now have a coherent, documented, exit status
* modified pipe test and new cksum test from Sebastian Kayser
@@ -285,13 +464,13 @@ Full changelog is below:
* 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)
* 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
* 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
* fix for input/output equivalence check on Mac OS X
* fix for size calculation in pipelines on Mac OS X
* fixed "`make uninstall`"
@@ -300,7 +479,7 @@ Full changelog is below:
### 1.0.1 - 4 August 2007
* licensing change from Artistic to Artistic 2.0
* removed the "`-l`" / "`--license`" option
* removed the **-l** / **--license** option
### 1.0.0 - 2 August 2007
@@ -310,7 +489,7 @@ Full changelog is below:
### 0.9.9 - 5 February 2007
* new option "`--buffer-size`" ("`-B`") suggested by Mark Tomich
* 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
* workaround: "`pv /dev/zero | dd bs=1M count=1k`" bug (reported by Gert Menke)
@@ -319,7 +498,7 @@ Full changelog is below:
### 0.9.6 - 27 February 2006
* bugfix: `key_t` incompatibility with Cygwin
* bugfix: interval ("`-i`") parameter parses numbers after decimal point
* 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
@@ -337,7 +516,7 @@ Full changelog is below:
### 0.8.9 - 6 November 2004
* decimal values now accepted for rate and size, eg "`-L 1.23M`"
* decimal values now accepted for rate and size, eg **-L 1.23M**
* code cleanup
* developers: "`make help`" now lists Makefile targets
@@ -347,9 +526,9 @@ Full changelog is below:
### 0.8.5 - 2 May 2004
* cursor positioning ("`-c`") reliability improved on systems with IPC
* cursor positioning (**-c**) reliability improved on systems with IPC
* minor fix: made test 005 more reliable
* new option "`--height`" ("`-H`")
* new option **--height** (**-H**)
### 0.8.2 - 24 April 2004
@@ -358,7 +537,7 @@ Full changelog is below:
### 0.8.1 - 19 April 2004
* bugfix in cursor positioning ("`-c`")
* bugfix in cursor positioning (**-c**)
### 0.8.0 - 12 February 2004
@@ -370,7 +549,7 @@ Full changelog is below:
### 0.7.0 - 8 February 2004
* display buffer management fixes (thanks Cédric Delfosse)
* replaced "`--enable-debug`" with "`--enable-debugging`" and "`--enable-profiling`"
* replaced **--enable-debug** with **--enable-debugging** and **--enable-profiling**
### 0.6.4 - 14 January 2004
@@ -434,11 +613,11 @@ Full changelog is below:
* 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
* bounds-check interval values ("`-i`") - max update interval now 10 minutes
* smoother throughput limiting (**--rate-limit**), now done in 0.1sec chunks
* bounds-check interval values (**-i**) - max update interval now 10 minutes
* more reliable non-blocking output to keep display updated
* no longer rely on `atoll()`
* don't output final blank line if "`--numeric`"
* don't output final blank line if **--numeric**
* use `fcntl()` instead of `flock()` for Solaris compatibility
### 0.3.0 - 25 November 2002
@@ -451,11 +630,11 @@ Full changelog is below:
* we now ignore *EINTR* on `select()`
* variable-size buffer (still need to add code to change size)
* added (tentative) support for internationalisation
* removed superfluous "`--no-progress`", etc options
* removed superfluous **--no-progress**, etc options
* optimised transfer by using bigger buffers, based on `st_blksize`
* added "`--wait`" option to wait until transfer begins before showing progress
* added "`--rate-limit`" option to limit rate to a maximum throughput
* added "`--quiet`" option (no output at all) to be used with "`--rate-limit`"
* added **--wait** option to wait until transfer begins before showing progress
* added **--rate-limit** option to limit rate to a maximum throughput
* added **--quiet** option (no output at all) to be used with **--rate-limit**
### 0.2.5 - 23 July 2002
-29
View File
@@ -1,29 +0,0 @@
Things still to do. (#n) indicates the issue tracker number.
* ([#3](https://codeberg.org/a-j-wood/pv/issues/3)) Option ("`-x`"?) to use xterm title line for status (Joachim Haga)
* ([#4](https://codeberg.org/a-j-wood/pv/issues/4)) Option for process title (Martin Sarsale) as "`pv - name:FooProcess -xyz - transferred: 1.3GB - 500KB/s - running: 10:15:30s`"
* ([#9](https://codeberg.org/a-j-wood/pv/issues/9)) Option to switch rate to per minute if really slow
* ([#10](https://codeberg.org/a-j-wood/pv/issues/10)) Add watchfd tests
* ([#11](https://codeberg.org/a-j-wood/pv/issues/11)) Option "`--progress-from FILE`", read last number and use it as bytes read (Jacek Wielemborek)
* ([#12](https://codeberg.org/a-j-wood/pv/issues/12)) Allow multiple "`-d`" options (Linus Heckemann for multiple PID:FD; Jacek Wielemborek)
* ([#15](https://codeberg.org/a-j-wood/pv/issues/15)) Use Unicode for more granular progress bar (Alexander Petrossian)
* ([#17](https://codeberg.org/a-j-wood/pv/issues/17)) Allow "`-r`" with "`-l`" and "`-n`" to output lines/sec (Roland Kletzing)
* ([#22](https://codeberg.org/a-j-wood/pv/issues/22)) Options to skip input and seek on output (Jason A. Pfeil, Feb 2022)
* ([#25](https://codeberg.org/a-j-wood/pv/issues/25)) Normalise progress to 100% on overrun (Andrej Gantvorg)
* ([#35](https://codeberg.org/a-j-wood/pv/issues/35)) Allow decimal values for "`-s`", "`-L`", "`-B`" (Thomas Watson - Aug 2020)
* ([#38](https://codeberg.org/a-j-wood/pv/issues/38)) Reset ETA on *SIGUSR1* (Jacek Wielemborek - Jan 2019)
* ([#40](https://codeberg.org/a-j-wood/pv/issues/40)) Permit "`-c`" with "`-d PID:FD`", reject "`-N`" with "`-d PID`" (Norman Rasmussen - Nov 2020)
* ([#43](https://codeberg.org/a-j-wood/pv/issues/43)) Differentiate between "`--eta`" and "`--fineta`" in display (André Stapf - Apr 2017)
* ([#45](https://codeberg.org/a-j-wood/pv/issues/45)) Option "`--sparse`" (with block size option) to write sparse output (Andriy Galetski - Apr 2019)
* ([#46](https://codeberg.org/a-j-wood/pv/issues/46)) Option to show speed gauge (% max speed) if progress not known (Ryan Cooley - Jun 2019)
* ([#47](https://codeberg.org/a-j-wood/pv/issues/47)) Analyse splice and buffer usage to improve performance
* ([#48](https://codeberg.org/a-j-wood/pv/issues/48)) Option to show multiple files with individual sizes and a cumulative total (Zach Riggle - Jul 2021)
* ([#49](https://codeberg.org/a-j-wood/pv/issues/49)) Option to provide stats for avg/min/max/stddev throughput (Venky.N.Iyer)
* ([#50](https://codeberg.org/a-j-wood/pv/issues/50)) Allow pv to report on a whole pipeline at once (Will Entriken - Feb 2011)
* ([#54](https://codeberg.org/a-j-wood/pv/issues/54)) Run command every n percent ([haarp](https://github.com/haarp))
* ([#56](https://codeberg.org/a-j-wood/pv/issues/56)) Support for backgrounding pv, and allowing it to be monitored separately ([jimbobmcgee](https://github.com/jimbobmcgee))
* ([#67](https://codeberg.org/a-j-wood/pv/issues/67)) Wrap another process to monitor its stdin & stdout ([Alex Mason](https://github.com/axman6))
* ([#76](https://codeberg.org/a-j-wood/pv/issues/76)) Provide a way to test translations without installing
* ([#81](https://codeberg.org/a-j-wood/pv/issues/81)) Keep last output on terminal when "pv -d" is done
Any assistance would be appreciated.
+701
View File
@@ -0,0 +1,701 @@
#!/bin/bash
#
# Benchmark transfer rates, and analyse benchmark results.
#
# Measures transfer rates and CPU usage with various different options,
# multiple times, then calculates the mean and standard deviation for each
# set of measurements.
#
# The results are written to stdout as tab-separated values, each line
# prefixed with an opaque system ID (based on "uname -a"), the PV version
# expressed as an integer, and a run ID based on the start date and time.
#
# In analysis mode, reads results from multiple benchmark runs on standard
# input, and for each type of measurement, show the differences between
# either the different PV versions or the different runs.
# Defaults.
pv='pv' # PV executable to run the measurements with
rounds='10' # how many rounds of measurements to take
testFileMB='256' # max size of each of the test files, in MiB
testZeroesMB='1024' # amount of /dev/zero data to use, in MiB
sourcesDir='' # directory containing sources to benchmark
compareWhat='auto' # what to compare in the analysis
finalLineOnly='false' # whether to only show the last measurement's analysis
terseFormat='false' # whether to use a terse report format
# Script information for --help and --version.
programName='benchmark-pv-transfers'
programVersion='1.0.0'
bugReportsTo='https://codeberg.org/ivarch/pv/issues'
copyrightYear='2026'
copyrightHolder='Andrew Wood'
# Constants.
fieldsPerRecord='4' # measurements taken: rate, time - real, user, sys.
# Hash function - write hex on stdout based on a hash of stdin.
runHash () {
command -v md5sum >/dev/null 2>&1 && exec md5sum
# OpenBSD has no "md5sum" but does have "cksum -a md5".
cksum -r -a md5 2>/dev/null || cksum
}
# Define the measurements. Each measurement definition contains:
# - The ID of the measurement
# - The name of the measurement
# - A space-separated list of single-letter options that PV must support
# - How many testFileMB multiples are transferred, or Z for testZeroesMB
# - The command to run
# In the command to run, {PV} is replaced with the path to PV, {FILE1} and
# {FILE2} are replaced by the random data filenames, {ZSIZE} is replaced by
# testZeroesMB, and {OUTPUT} is replaced by a temporary output filename.
# Each definition is stored as single line, with the above parts separated
# by "!".
measurementDefinitions=''
# Add a definition (name, options list, data size, command) to the
# definitions array.
addDefinition () {
measurementDefinitions="$(
printf '%s\n%s!%s!%s!%s!%s\n' \
"${measurementDefinitions}" \
"$(printf '%s\n' "$1" | runHash | cut -b1-7)" \
"$1" "$2" "$3" "$4" \
| grep .
)"
}
# Add a set of standard definitions for measurements, naming them with a
# prefix "$1: ", each with extra options "$2".
addStandardMeasurements () {
# From file via stdin to file via stdout.
addDefinition "$1: stdin file to file" "$2" 1 "{PV} $2 < {FILE1} > {OUTPUT}"
# From file to file via stdout.
addDefinition "$1: file to file" "$2" 1 "{PV} $2 {FILE1} > {OUTPUT}"
# From two files to file via stdout.
addDefinition "$1: two files to file" "$2" 2 "{PV} $2 {FILE1} {FILE2} > {OUTPUT}"
# From pipe to file via stdout.
addDefinition "$1: pipe to file" "$2" 1 "cat {FILE1} | {PV} $2 > {OUTPUT}"
# From file via stdin to pipe.
addDefinition "$1: stdin file to pipe" "$2" 1 "{PV} $2 < {FILE1} | cat > {OUTPUT}"
# From file to pipe.
addDefinition "$1: file to pipe" "$2" 1 "{PV} $2 {FILE1} | cat > {OUTPUT}"
# From two files to pipe.
addDefinition "$1: two files to pipe" "$2" 2 "{PV} $2 {FILE1} {FILE2} | cat > {OUTPUT}"
# From pipe to pipe.
addDefinition "$1: pipe to pipe" "$2" 1 "cat {FILE1} | {PV} $2 | cat > {OUTPUT}"
}
# Generate the measurement definitions, most of which are based on repeated
# blocks of the above standard measurements, with various different options.
defineMeasurements () {
addStandardMeasurements 'Default' ''
addStandardMeasurements 'No-splice' '-C'
addStandardMeasurements 'Pipe buffer 1M' '-J 1M'
addStandardMeasurements 'Transfer buffer 1M' '-B 1M'
addStandardMeasurements 'Discard' '-X'
addStandardMeasurements 'Discard with no-splice' '-X -C'
addStandardMeasurements 'Discard with pipe buffer 1M' '-X -J 1M'
addStandardMeasurements 'Discard with transfer buffer 1M' '-X -B 1M'
addDefinition "Zeroes: stdout to /dev/null" '-S -s' Z "{PV} -S -s {ZSIZE}M /dev/zero > /dev/null"
addDefinition "Zeroes: stdout to pipe" '-S -s' Z "{PV} -S -s {ZSIZE}M /dev/zero | cat > /dev/null"
addDefinition "Zeroes: discarded" '-X -S -s' Z "{PV} -X -S -s {ZSIZE}M /dev/zero"
addDefinition "Zeroes: stdout to /dev/null with no-splice" '-C -S -s' Z "{PV} -C -S -s {ZSIZE}M /dev/zero > /dev/null"
addDefinition "Zeroes: stdout to pipe with no-splice" '-C -S -s' Z "{PV} -C -S -s {ZSIZE}M /dev/zero | cat > /dev/null"
addDefinition "Zeroes: discarded with no-splice" '-C -X -S -s' Z "{PV} -C -X -S -s {ZSIZE}M /dev/zero"
}
# Write an error message $1 to standard error, prefixed with the program
# name.
error () {
printf '%s: %s\n' "${programName}" "$1" >&2
}
# Output an error message $1, and exit with a failure status.
die () {
error "$1"
exit 1
}
# Show all measurement definitions.
showMeasurementDefinitions () {
printf '%s\n%s\n' 'ID!Name!Opts!Size!Command' "${measurementDefinitions}" \
| awk -F '!' '{printf "%s\t%-60s\t%s\n", $1, $2, $5}'
}
# Sort a list of version numbers on stdin, in version order.
versionSort () {
# If sort has no -V, like on CentOS 5, fall back to a simplistic
# substitute.
sort -V 2>/dev/null \
|| perl -pe '$x=$_;$x=~s/(0*[0-9]+)/sprintf("%09d",$1)/ge;chomp $x;$_=$x." ".$_' | sort | awk '{print $2}'
}
# Write a line of results for the measurement with ID $1 and name $2, round
# ${thisRound}, reading the times from ${workDir}/times and deriving the
# rate from the elapsed time (the real time in the times file) and the size
# written in ${workDir}/size. Removes those two files in the process.
#
# The results are also spooled to ${workDir}/results for later analysis,
# prefixed with only the ID $1.
resultsLine () {
testTimeReal="$(awk '$1=="real" {print $2}' "${workDir}/times")"
testTimeUser="$(awk '$1=="user" {print $2}' "${workDir}/times")"
testTimeSystem="$(awk '$1=="sys" {print $2}' "${workDir}/times")"
testRate="$(awk -v t="${testTimeReal}" '{if (t>0) { printf "%.3f\n", $1/t } else { print "-" }}' < "${workDir}/size")"
test -n "${testRate}" || testRate='-'
rm -f "${workDir}/times" "${workDir}/size"
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' "${outputPrefix}" "${thisRound}" "$1" "${testRate}" "${testTimeReal}" "${testTimeUser}" "${testTimeSystem}" "$2"
printf '%s\t%s\t%s\t%s\t%s\n' "$1" "${testRate}" "${testTimeReal}" "${testTimeUser}" "${testTimeSystem}" >> "${workDir}/results"
}
# Run $2 in a shell under "time", writing $1 to ${workDir}/size and the
# times to ${workDir}/times.
captureTimes () {
printf '%s\n' "$1" > "${workDir}/size"
(
TIMEFORMAT="real %3R
user %3U
sys %3S"
time sh -c "{ $2; } 2>&3"
) 3>&2 2>"${workDir}/times"
}
# Run all defined measurements for which the required options are available.
#
# If "${workDir}/permitted-measurements" is not empty, only measurements
# with IDs listed in that file will be taken.
gatherMeasurements () {
printf '%s\n' "${measurementDefinitions}" \
| {
while read -r definitionLine; do
measurementId="${definitionLine%%!*}"
measurementName="${definitionLine#*!}"
measurementName="${measurementName%%!*}"
requiredOptions="${definitionLine#*!}"
requiredOptions="${requiredOptions#*!}"
requiredOptions="${requiredOptions%%!*}"
dataSize="${definitionLine#*!}"
dataSize="${dataSize#*!}"
dataSize="${dataSize#*!}"
dataSize="${dataSize%%!*}"
templateCommand="${definitionLine##*!}"
test -n "${templateCommand}" || continue
if test -s "${workDir}/permitted-measurements"; then
grep -Fqx "${measurementId}" "${workDir}/permitted-measurements" || continue
fi
if test -n "${requiredOptions}"; then
optionLetters="$(printf 'x%s\n' "${requiredOptions}" | tr -d '!' | sed 's/-/!-/g' | tr '!' '\n' | grep '^-' | cut -b 2)"
optionsPresent='true'
for pvOption in ${optionLetters}; do
grep -Fq " -${pvOption}" "${workDir}/help" || optionsPresent='false'
done
${optionsPresent} || continue
fi
# Add some display options to make more information visible
# on versions that support them.
pvExtraOptions=''
pvFormatString='%b %t %r %p %e %T'
if grep -Fq " -N" "${workDir}/help"; then
pvExtraOptions="${pvExtraOptions} -N '${measurementId}'"
pvFormatString="%N ${pvFormatString}"
fi
grep -Fq " -F" "${workDir}/help" && pvExtraOptions="${pvExtraOptions} -F '${pvFormatString}'"
activeCommand="$(
printf '%s\n' "${templateCommand}" | sed \
-e "s!{PV}!${pv}${pvExtraOptions}!g" \
-e "s!{FILE1}!${workDir}/file1!g" \
-e "s!{FILE2}!${workDir}/file2!g" \
-e "s!{ZSIZE}!${testZeroesMB}!g" \
-e "s!{OUTPUT}!${workDir}/output!g"
)"
if test "${dataSize}" = "Z"; then
dataSize="${testZeroesMB}"
else
dataSize=$((dataSize*testFileMB))
fi
rm -f "${workDir}/output1" "${workDir}/output2"
captureTimes "${dataSize}" "${activeCommand}"
resultsLine "${measurementId}" "${measurementName}"
done
}
}
# Run several rounds of benchmark measurements using $1 as the pv
# executable, producing tab-separated data, including a final section
# containing the means and standard deviations for each measurement type.
#
# If $2 is not blank, only run the measurements whose IDs are listed in it.
runBenchmarks () {
pv="$1"
restrictTo="$2"
# Check there's enough room for the test files, meaning that 2 test
# files + 1 output file + 2MB doesn't add up to more than 75% of the
# space on the filesystem holding TMPDIR - make the test files
# smaller, if not.
tmpSpaceMB="$(df -kP "${TMPDIR:-/tmp}" | awk 'FNR==2 {print int($4*3/4096)}')"
while test "${testFileMB}" -gt 4; do
test "${tmpSpaceMB}" -gt $((2+3*testFileMB)) && break
testFileMB=$((testFileMB/2))
done
# Capture the help text so that capabilities can be checked.
${pv} -h > "${workDir}/help"
# Write a list of permitted measurement IDs, one per line. An empty
# file means no restriction.
# shellcheck disable=SC2020 # silence the warning about "tr" here.
printf '%s\n' "${restrictTo}" \
| tr ',; \t' '\n\n\n\n' \
| sort -u \
| grep . \
> "${workDir}/permitted-measurements"
# Define identifiers for the system this is running on, the pv
# version being benchmarked, and this specific benchmark run.
sysId="$(uname -a | runHash | cut -b1-7)"
pvId="$(${pv} --version | awk 'FNR==1{print $2}' | awk -F . '{print 1000000*$1+1000*$2+$3}')"
runId="$(date '+%Y%m%d%H%M%S')"
outputPrefix="$(printf '%s\t%s\t%s\n' "${sysId}" "${pvId}" "${runId}")"
# Basic system information, and a header line for the test results.
printf '%s\t%s\t%s\n' "${outputPrefix}" 'System hostname' "$(uname -n)"
printf '%s\t%s\t%s\n' "${outputPrefix}" 'System load' "$(uptime | awk '{printf "%.2f\n",$(NF-2)}')"
printf '%s\t%s\t%s\n' "${outputPrefix}" 'System kernel type' "$(uname -s)"
printf '%s\t%s\t%s\n' "${outputPrefix}" 'System kernel release' "$(uname -r)"
printf '%s\t%s\t%s\n' "${outputPrefix}" 'System OS' "$(uname -o)"
printf '%s\t%s\t%s\n' "${outputPrefix}" 'PV path' "${pv}"
printf '%s\t%s\t%s\n' "${outputPrefix}" 'PV version' "$(${pv} -V | awk 'FNR==1 {print $2}')"
printf '%s\t%s\t%s\n' "${outputPrefix}" 'Test file size (MB)' "${testFileMB}"
# Generate two files of random data.
dd if='/dev/urandom' of="${workDir}/file1" bs=1048576 count="${testFileMB}" 2>/dev/null
dd if='/dev/urandom' of="${workDir}/file2" bs=1048576 count="${testFileMB}" 2>/dev/null
# Run several rounds of measurements.
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' "${outputPrefix}" '#' 'ID' 'MiB/sec' 'Real time' 'User CPU time' 'System CPU time' 'Raw measurement'
thisRound=0
while test ${thisRound} -lt "${rounds}"; do
thisRound=$((1+thisRound))
gatherMeasurements
done
# For each of the types of measurement, report the mean and standard
# deviation of each field.
awk -F "\t" '{print $1}' < "${workDir}/results" > "${workDir}/measurement-ids"
true > "${workDir}/measurement-ids-used"
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' "${outputPrefix}" 'μ/σ' 'ID' 'MiB/sec' 'Real time' 'User CPU time' 'System CPU time' 'Aggregated measurement'
{
while read -r measurementId; do
# Skip this type of measurement if already processed.
grep -Fqx "${measurementId}" "${workDir}/measurement-ids-used" && continue
printf '%s\n' "${measurementId}" >> "${workDir}/measurement-ids-used"
# Get the associated measurement name.
measurementName="$(printf '%s\n' "${measurementDefinitions}" | awk -F '!' -v "x=${measurementId}" '$1==x{print $2}')"
# Separate out this measurement type's results.
awk -F "\t" -v "mId=${measurementId}" '$1==mId {print}' < "${workDir}/results" \
> "${workDir}/measurements"
# Calculate the mean of each field.
awk -F "\t" -v "mId=${measurementId}" -v "mName=${measurementName}" -v "fieldcount=${fieldsPerRecord}" \
'BEGIN { samples=0 }
{ samples++; for (field=1; field<=fieldcount; field++) { total[field] += $(1+field) } }
END { printf "%s\t%s", "μ", mId; for (field=1; field<=fieldcount; field++) { printf "\t%.3f", total[field]/samples }; printf "\t%s\n", mName }' \
< "${workDir}/measurements" > "${workDir}/mean"
# Calculate the standard deviation of each field.
cat "${workDir}/mean" "${workDir}/measurements" \
| awk -F "\t" -v "mId=${measurementId}" -v "mName=${measurementName}" -v "fieldcount=${fieldsPerRecord}" \
'BEGIN { samples=0 }
FNR==1 { for (field=1; field<=fieldcount; field++) { mean[field] += $(2+field) } }
FNR>1 { samples++; for (field=1; field<=fieldcount; field++) { variance=$(1+field)-mean[field]; sum_variance_squared[field] += (variance*variance) } }
END { printf "%s\t%s", "σ", mId; for (field=1; field<=fieldcount; field++) { printf "\t%.3f", sqrt(sum_variance_squared[field]/samples) }; printf "\t%s\n", mName }' \
> "${workDir}/stddev"
sed "s,^,${outputPrefix}!," "${workDir}/mean" "${workDir}/stddev" | tr '!' '\t'
done
} < "${workDir}/measurement-ids"
rm -f "${workDir}/file1" "${workDir}/file2" "${workDir}/output1" "${workDir}/output2"
}
# Reformat data on stdin so that each (whitespace-separated) column is
# space-padded and right-aligned to a consistent width for all rows.
#
# Note that this can only handle ASCII, not UTF-8.
lineUpColumns () {
tee "${workDir}/lineup-temp" \
| awk 'BEGIN {cols=0}
/./ {
if (NF > cols)
cols=NF
for (col=1; col<=NF; col++) {
if (length($col) >= max[col])
max[col]=length($col)
}
}
END {
for (col=1; col<=cols; col++) {
printf "%d ", max[col]
}
printf "\n"
}
' > "${workDir}/lineup-colwidths"
cat "${workDir}/lineup-colwidths" "${workDir}/lineup-temp" \
| awk '
FNR==1 { cols=NF; for (col=1; col<=NF; col++) { max[col]=$col } }
FNR>1 {
for (col=1; col<=cols; col++) {
if (col>1)
printf " "
val=(col<=NF ? $col : "")
printf "%" max[col] "s", val
}
printf "\n"
}'
}
# Read a stream of benchmark data on stdin containing runs from a single
# system, and report how the measurements changed across $1 - either "runs"
# for benchmark runs, or "versions" for PV versions.
compareResults () {
comparisonSelector="$1"
cat > "${workDir}/raw-system-data"
# List the measurement IDs in the order they appear in the data.
awk -F "\t" '$4=="σ"{print $5}' < "${workDir}/raw-system-data" > "${workDir}/measurement-ids"
case "${comparisonSelector}" in
'versions')
# List all PV versions for which any data is available.
awk -F "\t" '$4=="PV version"{print $2,$5}' "${workDir}/raw-system-data" | sort -nu > "${workDir}/comparison-items"
itemHeading='Version'
itemField=2
;;
'runs')
# List all runs.
awk -F "\t" '$4=="σ"{print $3,$3}' "${workDir}/raw-system-data" | sort -nu > "${workDir}/comparison-items"
itemHeading='Run'
itemField=3
;;
esac
# Report on each measurement type in turn.
true > "${workDir}/measurement-ids-seen"
{
measurementsCounter=0
while read -r measurementId; do
# Skip if this measurement was already processed.
grep -Fqx "${measurementId}" "${workDir}/measurement-ids-seen" && continue
printf '%s\n' "${measurementId}" >> "${workDir}/measurement-ids-seen"
# Collect this measurement's mean and standard deviation
# records for each distinct item (version or run). If
# there's more than one for a single item, average them.
{
while read -r itemId itemName; do
awk -F "\t" \
-v "itemField=${itemField}" -v "itemId=${itemId}" -v "itemName=${itemName}" \
-v "mId=${measurementId}" \
-v "fieldcount=${fieldsPerRecord}" \
'BEGIN {samples=0}
$itemField==itemId && $5==mId && $4=="μ" { samples++; for (field=1; field<=fieldcount; field++) { mean[field] += $(5+field) } }
$itemField==itemId && $5==mId && $4=="σ" { for (field=1; field<=fieldcount; field++) { stddev[field] += $(5+field) } }
END {
if (samples > 0) {
printf "%s", itemName
for (field=1; field<=fieldcount; field++) {
printf "\t%.3f\t%.3f", mean[field]/samples, stddev[field]/samples
}
printf "\n"
}
}' \
< "${workDir}/raw-system-data"
done
} < "${workDir}/comparison-items" > "${workDir}/measurements-per-item"
# If there are not at least 2 items for which this
# measurement was available, report nothing as no comparison
# can be made.
test "$(grep -c . "${workDir}/measurements-per-item")" -lt 2 && continue
# Show the measurement name and associated command.
# Take the measurement name from the input data.
measurementName="$(awk -F "\t" -v "mId=${measurementId}" '$4=="σ" && $5==mId {print $NF;exit}' "${workDir}/raw-system-data")"
if ! ${terseFormat}; then
# Take the command from the definitions.
templateCommand="$(printf '%s\n' "${measurementDefinitions}" | awk -F '!' -v "mId=${measurementId}" '$1==mId {print $5}')"
printf '\n%s\n' "${measurementName}"
test -n "${templateCommand}" && printf ' (%s)\n' "${templateCommand}"
fi
# Report each item's measurements and how they compare to
# the previous item.
awk -F "\t" -v "fieldcount=${fieldsPerRecord}" \
'{
printf "%s", $1
for (field=0; field<fieldcount; field++) {
if (field > 0) {
printf "\t%s", "-";
}
mean=$(2+2*field)
stddev=$(3+2*field)
changescore=0
printf "\t%.3f\t%.3f", mean, stddev;
if (FNR>1) {
low=mean-stddev;
high=mean+stddev;
range=high-low;
prevlow=pmean[field]-pstddev[field];
prevhigh=pmean[field]+pstddev[field];
prevrange=prevhigh-prevlow;
if (prevrange < 1)
prevrange = 1;
if (high > prevhigh) {
changescore = (high - prevhigh) / prevrange;
} else if (low < prevlow) {
changescore = 0 - ((prevlow - low) / prevrange);
}
}
if (changescore < 0.01 && changescore > -0.01) {
printf "\t%d", 0
} else {
printf "\t%s%.2f", (changescore > 0.00 ? "+" : ""), changescore
}
pmean[field]=mean;
pstddev[field]=stddev;
}
printf "\n"
}' \
< "${workDir}/measurements-per-item" \
> "${workDir}/item-report"
# Leave only the last line if finalLineOnly is set.
${finalLineOnly} && sed -i -n '$p' "${workDir}/item-report"
# In terse mode, prefix each line with the measurement name,
# having replaced spaces in it with underscores.
if ${terseFormat}; then
showName="$(printf '%s\n' "${measurementName}" | tr ' ' '_')"
sed "s,^,${showName}!," < "${workDir}/item-report" | tr '!' '\t' > "${workDir}/item-report.prefixed"
mv -f "${workDir}/item-report.prefixed" "${workDir}/item-report"
fi
# Format the report.
# Since the column widths are set by an awk script which
# doesn't support UTF-8, ASCII headings are used initially,
# and adjusted after formatting.
measurementsCounter=$((1+measurementsCounter))
{
# In terse mode, only print one header per system.
if test ${measurementsCounter} -eq 1 || ! ${terseFormat}; then
printf '%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' \
"${itemHeading}" \
'M:Rate' 'S:Rate' 'C:Rate' \
'-' \
'M:tReal' 'S:tReal' 'C:tReal' \
'-' \
'M:tUser' 'S:tUser' 'C:tUser' \
'-' \
'M:tSys' 'S:tSys' 'C:tSys' \
| {
if ${terseFormat}; then
sed 's,^,Measurement!,' | tr '!' '\t'
else
cat
fi
}
fi
cat "${workDir}/item-report"
} \
> "${workDir}/item-report-with-heading"
if ${terseFormat}; then
cat "${workDir}/item-report-with-heading"
else
lineUpColumns < "${workDir}/item-report-with-heading" \
| sed '1{s,M:,μ:,g;s,S:,σ:,g;s,C:,±:,g;}'
fi
done
} < "${workDir}/measurement-ids" \
> "${workDir}/measurements-report"
if "${terseFormat}"; then
lineUpColumns < "${workDir}/measurements-report" \
| sed '1{s,M:,μ:,g;s,S:,σ:,g;s,C:,±:,g;}'
else
cat "${workDir}/measurements-report"
fi
}
# Read a stream of benchmark data from stdin containing one or more runs
# from one or more systems, and for each individual system, report how the
# measurements changed across either the different PV versions or between
# runs, depending on whether $1 is "versions" or "runs".
#
# If $1 is "auto", then it will be "versions" if data for more than one PV
# version is present, otherwise it will be "runs".
runAnalysis () {
analysisSelector="$1"
cat > "${workDir}/raw-data"
# Auto-detect what to analyse.
if test "${analysisSelector}" = 'auto'; then
if test "$(awk -F "\t" '$4=="σ"{print $2}' < "${workDir}/raw-data" | sort -u | grep -c .)" -gt 1; then
analysisSelector='versions'
else
analysisSelector='runs'
fi
fi
# List the system IDs in the order they appear in the data.
awk -F "\t" '{print $1}' < "${workDir}/raw-data" | uniq > "${workDir}/sysids"
# Report on each system in turn.
true > "${workDir}/sysids-seen"
{
while read -r sysId; do
# Skip if this system was already processed.
grep -Fqx "${sysId}" "${workDir}/sysids-seen" && continue
printf '%s\n' "${sysId}" >> "${workDir}/sysids-seen"
# Extract the data for just this system.
awk -F "\t" -v "s=${sysId}" '$1==s {print}' < "${workDir}/raw-data" > "${workDir}/system-data"
# Report preamble.
printf '%79s\n' '' | tr ' ' '-'
printf '%s: %s - %s - %s %s\n' \
'System' \
"$(awk -F "\t" '$4=="System hostname"{print $5;exit}' "${workDir}/system-data")" \
"$(awk -F "\t" '$4=="System OS"{print $5;exit}' "${workDir}/system-data")" \
"$(awk -F "\t" '$4=="System kernel type"{print $5;exit}' "${workDir}/system-data")" \
"$(awk -F "\t" '$4=="System kernel release"{print $5;exit}' "${workDir}/system-data")"
${terseFormat} || cat <<EOF
For each measurement type, each of its aggregate benchmark results are
shown. Each field's mean and standard deviation are displayed along with a
change indicator showing how different this line's value is from the
previous line.
EOF
compareResults "${analysisSelector}" < "${workDir}/system-data"
done
} < "${workDir}/sysids"
}
##############################################################################
# Main entry point.
# Process any command-line options.
action='benchmark'
restrictMeasurementIdList=''
while test -n "$1"; do
arg="$1"
shift
case "${arg}" in
'measurements'|'benchmark'|'analyse') action="${arg}" ;;
'-h'|'--help')
cat - <<EOF
Usage: ${programName} [OPTIONS] [ACTION]
Benchmark pv transfers - take measurements of transfer rate and CPU usage
when calling pv in various different ways, and analyse results from multiple
benchmark runs to show how each measurement changes between runs or versions.
Actions:
benchmark - take several rounds of measurements (default action)
analyse - analyse benchmark data on stdin from multiple runs
measurements - list all benchmark measurement definitions
Benchmark options:
-p, --program FILE benchmark using FILE as the pv executable (${pv})
-r, --rounds ROUNDS run ROUNDS sets of measurements (${rounds})
-m, --measurement ID only run this specific measurement
-s, --size SIZE attempt to use a test file of SIZE MiB (${testFileMB})
-z, --zeroes SIZE stop at SIZE MiB for /dev/zero measurements (${testZeroesMB})
-d, --dir DIR compile and benchmark each of the tar.gz files in DIR
Analysis options:
-c, --compare WHAT analyse differences in runs, versions, or auto (${compareWhat})
-f, --final show only the final item's line in each measurement analysis
-t, --terse produce a terser report
Other options:
-h, --help show this help
-V, --version show script version
Default values are shown in brackets.
Please report any bugs to: ${bugReportsTo}
EOF
exit 0
;;
'-V'|'--version')
cat - <<EOF
${programName} (pv) ${programVersion}
Copyright ${copyrightYear} ${copyrightHolder}
License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
EOF
exit 0
;;
'-p'|'--program'|'--pv') pv="$1"; test $# -gt 0 && shift ;;
'--program='*|'--pv='*) pv="${arg#*=}" ;;
'-r'|'--rounds') rounds="$1"; test $# -gt 0 && shift ;;
'--rounds='*) rounds="${arg#*=}" ;;
'-m'|'--measurement') restrictMeasurementIdList="${restrictMeasurementIdList} $1"; test $# -gt 0 && shift ;;
'--measurement='*) restrictMeasurementIdList="${restrictMeasurementIdList} ${arg#*=}" ;;
'-s'|'--size') testFileMB="$1"; test $# -gt 0 && shift ;;
'--size='*) testFileMB="${arg#*=}" ;;
'-z'|'--zeroes') testZeroesMB="$1"; test $# -gt 0 && shift ;;
'--zeroes='*) testZeroesMB="${arg#*=}" ;;
'-d'|'--dir') sourcesDir="$1"; test $# -gt 0 && shift ;;
'--dir='*) sourcesDir="${arg#*=}" ;;
'-c'|'--compare') compareWhat="$1"; test $# -gt 0 && shift ;;
'--compare='*) compareWhat="${arg#*=}" ;;
'-f'|'--final') finalLineOnly='true' ;;
'-t'|'--terse') terseFormat='true' ;;
'-'*) die "${arg}: unknown option - try \`--help'" ;;
*) die "${arg}: unexpected argument - try \`--help'" ;;
esac
done
# Check validity of compareWhat, and normalise it.
case "${compareWhat}" in
'runs'|'run') compareWhat='runs' ;;
'versions'|'version') compareWhat='versions' ;;
'auto') ;;
*) die "--compare: ${compareWhat}: invalid value" ;;
esac
# Use /dev/shm for workspace if possible, to eliminate disk I/O as a factor.
if test -z "${TMPDIR}" && test -d '/dev/shm' && mountpoint -q '/dev/shm'; then
TMPDIR='/dev/shm'
export TMPDIR
fi
# Temporary working area, cleaned up on exit.
workDir="$(mktemp -d)" || exit 1
trap 'rm -rf "${workDir}"' EXIT
# Set everything to the "C" locale.
LANG=C
LC_ALL=C
export LANG LC_ALL
# Define the measurements.
defineMeasurements
# Run the selected action.
case "${action}" in
'measurements') showMeasurementDefinitions ;;
'benchmark')
if test -z "${sourcesDir}"; then
runBenchmarks "${pv}" "${restrictMeasurementIdList}"
else
find "${sourcesDir}" -type f -name "*.tar.gz" \
| versionSort \
| while read -r sourcesFile; do
buildDir="$(mktemp -d "${sourcesFile}.build.XXXXXX")" || continue
trap 'rm -rf "${workDir}" "${buildDir}"' EXIT
tar xzf "${sourcesFile}" -C "${buildDir}" \
&& (
cd "${buildDir}"/* \
&& sh ./configure 1>&2 \
&& make 1>&2 \
&& mv pv ..
) \
&& runBenchmarks "${buildDir}/pv" "${restrictMeasurementIdList}"
rm -rf "${buildDir}"
trap 'rm -rf "${workDir}"' EXIT
done
fi
;;
'analyse') runAnalysis "${compareWhat}" ;;
esac
@@ -35,5 +35,3 @@ for ((buffer=100; buffer<=1000; buffer+=100)); do
echo -e "${buffer}\t${rate}\t${rdata}\t${wdata}"
done
done
# EOF
+817 -626
View File
File diff suppressed because it is too large Load Diff
+629 -297
View File
File diff suppressed because it is too large Load Diff
+51
View File
@@ -0,0 +1,51 @@
# Configuration for the foss-release.sh script.
# The script is here: https://codeberg.org/ivarch/scripts
set maintainer andrew.wood@ivarch.com
set mainprogram auto
set version auto
set mandir docs
set newsdir docs
export SKIP_VALGRIND_TESTS=1
section Initial checks
action check_po
action check_version_news
action check_version_autoconf
action check_version_man
section Initial build
action configure
action make
action check_analyse
action check_version_program
action check_version_year
section Documentation and source reformatting
action man_md
action man_html
action news_html
action make_indent
section Update po files
action make_update_po
section Run autoreconf
action autoreconf
section Commit check
action check_git_status
section Release archive
action check_make_distcheck
action make_dist
section Lab tests
action labtest
section Sign release
action sign_tarball
section Build OS packages
action parmo_build
+1
View File
@@ -7,3 +7,4 @@ Makevars.template
Rules-quot
stamp-po
*~
Makefile.in.in
+7
View File
@@ -1,4 +1,11 @@
cs
de
fi
fr
it
ka
pl
pt
ro
ru
tr
-510
View File
@@ -1,510 +0,0 @@
# Makefile for PO directory in any package using GNU gettext.
# Copyright (C) 1995-2000 Ulrich Drepper <drepper@gnu.ai.mit.edu>
# Copyright (C) 2000-2020 Free Software Foundation, Inc.
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
#
# Origin: gettext-0.21
GETTEXT_MACRO_VERSION = 0.20
PACKAGE = @PACKAGE@
VERSION = @VERSION@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
SED = @SED@
SHELL = /bin/sh
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
datadir = @datadir@
localedir = @localedir@
gettextsrcdir = $(datadir)/gettext/po
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
# We use $(mkdir_p).
# In automake <= 1.9.x, $(mkdir_p) is defined either as "mkdir -p --" or as
# "$(mkinstalldirs)" or as "$(install_sh) -d". For these automake versions,
# @install_sh@ does not start with $(SHELL), so we add it.
# In automake >= 1.10, @mkdir_p@ is derived from ${MKDIR_P}, which is defined
# either as "/path/to/mkdir -p" or ".../install-sh -c -d". For these automake
# versions, $(mkinstalldirs) and $(install_sh) are unused.
mkinstalldirs = $(SHELL) @install_sh@ -d
install_sh = $(SHELL) @install_sh@
MKDIR_P = @MKDIR_P@
mkdir_p = @mkdir_p@
# When building gettext-tools, we prefer to use the built programs
# rather than installed programs. However, we can't do that when we
# are cross compiling.
CROSS_COMPILING = @CROSS_COMPILING@
GMSGFMT_ = @GMSGFMT@
GMSGFMT_no = @GMSGFMT@
GMSGFMT_yes = @GMSGFMT_015@
GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
XGETTEXT_ = @XGETTEXT@
XGETTEXT_no = @XGETTEXT@
XGETTEXT_yes = @XGETTEXT_015@
XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
MSGMERGE = @MSGMERGE@
MSGMERGE_UPDATE = @MSGMERGE@ --update
MSGMERGE_FOR_MSGFMT_OPTION = @MSGMERGE_FOR_MSGFMT_OPTION@
MSGINIT = msginit
MSGCONV = msgconv
MSGFILTER = msgfilter
POFILES = @POFILES@
GMOFILES = @GMOFILES@
UPDATEPOFILES = @UPDATEPOFILES@
DUMMYPOFILES = @DUMMYPOFILES@
DISTFILES.common = Makefile.in.in remove-potcdate.sin \
$(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
$(POFILES) $(GMOFILES) \
$(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
POTFILES = \
CATALOGS = @CATALOGS@
POFILESDEPS_ = $(srcdir)/$(DOMAIN).pot
POFILESDEPS_yes = $(POFILESDEPS_)
POFILESDEPS_no =
POFILESDEPS = $(POFILESDEPS_$(PO_DEPENDS_ON_POT))
DISTFILESDEPS_ = update-po
DISTFILESDEPS_yes = $(DISTFILESDEPS_)
DISTFILESDEPS_no =
DISTFILESDEPS = $(DISTFILESDEPS_$(DIST_DEPENDS_ON_UPDATE_PO))
# Makevars gets inserted here. (Don't remove this line!)
all: all-@USE_NLS@
.SUFFIXES:
.SUFFIXES: .po .gmo .sed .sin .nop .po-create .po-update
# The .pot file, stamp-po, .po files, and .gmo files appear in release tarballs.
# The GNU Coding Standards say in
# <https://www.gnu.org/prep/standards/html_node/Makefile-Basics.html>:
# "GNU distributions usually contain some files which are not source files
# ... . Since these files normally appear in the source directory, they
# should always appear in the source directory, not in the build directory.
# So Makefile rules to update them should put the updated files in the
# source directory."
# Therefore we put these files in the source directory, not the build directory.
# During .po -> .gmo conversion, take into account the most recent changes to
# the .pot file. This eliminates the need to update the .po files when the
# .pot file has changed, which would be troublesome if the .po files are put
# under version control.
$(GMOFILES): $(srcdir)/$(DOMAIN).pot
.po.gmo:
@lang=`echo $* | sed -e 's,.*/,,'`; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}rm -f $${lang}.gmo && $(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) -o $${lang}.1po $${lang}.po $(DOMAIN).pot && $(GMSGFMT) -c --statistics --verbose -o $${lang}.gmo $${lang}.1po && rm -f $${lang}.1po"; \
cd $(srcdir) && \
rm -f $${lang}.gmo && \
$(MSGMERGE) $(MSGMERGE_FOR_MSGFMT_OPTION) -o $${lang}.1po $${lang}.po $(DOMAIN).pot && \
$(GMSGFMT) -c --statistics --verbose -o t-$${lang}.gmo $${lang}.1po && \
mv t-$${lang}.gmo $${lang}.gmo && \
rm -f $${lang}.1po
.sin.sed:
sed -e '/^#/d' $< > t-$@
mv t-$@ $@
all-yes: $(srcdir)/stamp-po
all-no:
# Ensure that the gettext macros and this Makefile.in.in are in sync.
CHECK_MACRO_VERSION = \
test "$(GETTEXT_MACRO_VERSION)" = "@GETTEXT_MACRO_VERSION@" \
|| { echo "*** error: gettext infrastructure mismatch: using a Makefile.in.in from gettext version $(GETTEXT_MACRO_VERSION) but the autoconf macros are from gettext version @GETTEXT_MACRO_VERSION@" 1>&2; \
exit 1; \
}
# $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
# internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
# we don't want to bother translators with empty POT files). We assume that
# LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
# In this case, $(srcdir)/stamp-po is a nop (i.e. a phony target).
# $(srcdir)/stamp-po is a timestamp denoting the last time at which the CATALOGS
# have been loosely updated. Its purpose is that when a developer or translator
# checks out the package from a version control system, and the $(DOMAIN).pot
# file is not under version control, "make" will update the $(DOMAIN).pot and
# the $(CATALOGS), but subsequent invocations of "make" will do nothing. This
# timestamp would not be necessary if updating the $(CATALOGS) would always
# touch them; however, the rule for $(POFILES) has been designed to not touch
# files that don't need to be changed.
$(srcdir)/stamp-po: $(srcdir)/$(DOMAIN).pot
@$(CHECK_MACRO_VERSION)
test ! -f $(srcdir)/$(DOMAIN).pot || \
test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
@test ! -f $(srcdir)/$(DOMAIN).pot || { \
echo "touch $(srcdir)/stamp-po" && \
echo timestamp > $(srcdir)/stamp-poT && \
mv $(srcdir)/stamp-poT $(srcdir)/stamp-po; \
}
# Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
# otherwise packages like GCC can not be built if only parts of the source
# have been downloaded.
# This target rebuilds $(DOMAIN).pot; it is an expensive operation.
# Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
# The determination of whether the package xyz is a GNU one is based on the
# heuristic whether some file in the top level directory mentions "GNU xyz".
# If GNU 'find' is available, we avoid grepping through monster files.
$(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
package_gnu="$(PACKAGE_GNU)"; \
test -n "$$package_gnu" || { \
if { if (LC_ALL=C find --version) 2>/dev/null | grep GNU >/dev/null; then \
LC_ALL=C find -L $(top_srcdir) -maxdepth 1 -type f -size -10000000c -exec grep -i 'GNU @PACKAGE@' /dev/null '{}' ';' 2>/dev/null; \
else \
LC_ALL=C grep -i 'GNU @PACKAGE@' $(top_srcdir)/* 2>/dev/null; \
fi; \
} | grep -v 'libtool:' >/dev/null; then \
package_gnu=yes; \
else \
package_gnu=no; \
fi; \
}; \
if test "$$package_gnu" = "yes"; then \
package_prefix='GNU '; \
else \
package_prefix=''; \
fi; \
if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
else \
msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
fi; \
case `$(XGETTEXT) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].* | 0.16 | 0.16.[0-1]*) \
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
--add-comments=TRANSLATORS: \
--files-from=$(srcdir)/POTFILES.in \
--copyright-holder='$(COPYRIGHT_HOLDER)' \
--msgid-bugs-address="$$msgid_bugs_address" \
$(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
;; \
*) \
$(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
--add-comments=TRANSLATORS: \
--files-from=$(srcdir)/POTFILES.in \
--copyright-holder='$(COPYRIGHT_HOLDER)' \
--package-name="$${package_prefix}@PACKAGE@" \
--package-version='@VERSION@' \
--msgid-bugs-address="$$msgid_bugs_address" \
$(XGETTEXT_OPTIONS) @XGETTEXT_EXTRA_OPTIONS@ \
;; \
esac
test ! -f $(DOMAIN).po || { \
if test -f $(srcdir)/$(DOMAIN).pot-header; then \
sed -e '1,/^#$$/d' < $(DOMAIN).po > $(DOMAIN).1po && \
cat $(srcdir)/$(DOMAIN).pot-header $(DOMAIN).1po > $(DOMAIN).po && \
rm -f $(DOMAIN).1po \
|| exit 1; \
fi; \
if test -f $(srcdir)/$(DOMAIN).pot; then \
sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
else \
rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
fi; \
else \
mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
fi; \
}
# This rule has no dependencies: we don't need to update $(DOMAIN).pot at
# every "make" invocation, only create it when it is missing.
# Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
$(srcdir)/$(DOMAIN).pot:
$(MAKE) $(DOMAIN).pot-update
# This target rebuilds a PO file if $(DOMAIN).pot has changed.
# Note that a PO file is not touched if it doesn't need to be changed.
$(POFILES): $(POFILESDEPS)
@test -f $(srcdir)/$(DOMAIN).pot || $(MAKE) $(srcdir)/$(DOMAIN).pot
@lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
if test -f "$(srcdir)/$${lang}.po"; then \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} --previous $${lang}.po $(DOMAIN).pot"; \
cd $(srcdir) \
&& { case `$(MSGMERGE_UPDATE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].*) \
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) $${lang}.po $(DOMAIN).pot;; \
0.1[6-7] | 0.1[6-7].*) \
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --previous $${lang}.po $(DOMAIN).pot;; \
*) \
$(MSGMERGE_UPDATE) $(MSGMERGE_OPTIONS) --lang=$${lang} --previous $${lang}.po $(DOMAIN).pot;; \
esac; \
}; \
else \
$(MAKE) $${lang}.po-create; \
fi
install: install-exec install-data
install-exec:
install-data: install-data-@USE_NLS@
if test "$(PACKAGE)" = "gettext-tools"; then \
$(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
for file in $(DISTFILES.common) Makevars.template; do \
$(INSTALL_DATA) $(srcdir)/$$file \
$(DESTDIR)$(gettextsrcdir)/$$file; \
done; \
for file in Makevars; do \
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
done; \
else \
: ; \
fi
install-data-no: all
install-data-yes: all
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
dir=$(localedir)/$$lang/LC_MESSAGES; \
$(mkdir_p) $(DESTDIR)$$dir; \
if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
$(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
if test -n "$$lc"; then \
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
for file in *; do \
if test -f $$file; then \
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
fi; \
done); \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
else \
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
:; \
else \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
fi; \
fi; \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
fi; \
done; \
done
install-strip: install
installdirs: installdirs-exec installdirs-data
installdirs-exec:
installdirs-data: installdirs-data-@USE_NLS@
if test "$(PACKAGE)" = "gettext-tools"; then \
$(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
else \
: ; \
fi
installdirs-data-no:
installdirs-data-yes:
@catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
dir=$(localedir)/$$lang/LC_MESSAGES; \
$(mkdir_p) $(DESTDIR)$$dir; \
for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
if test -n "$$lc"; then \
if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
(cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
for file in *; do \
if test -f $$file; then \
ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
fi; \
done); \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
else \
if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
:; \
else \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
fi; \
fi; \
fi; \
done; \
done
# Define this as empty until I found a useful application.
installcheck:
uninstall: uninstall-exec uninstall-data
uninstall-exec:
uninstall-data: uninstall-data-@USE_NLS@
if test "$(PACKAGE)" = "gettext-tools"; then \
for file in $(DISTFILES.common) Makevars.template; do \
rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
done; \
else \
: ; \
fi
uninstall-data-no:
uninstall-data-yes:
catalogs='$(CATALOGS)'; \
for cat in $$catalogs; do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
done; \
done
check: all
info dvi ps pdf html tags TAGS ctags CTAGS ID:
install-dvi install-ps install-pdf install-html:
mostlyclean:
rm -f remove-potcdate.sed
rm -f $(srcdir)/stamp-poT
rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
rm -fr *.o
clean: mostlyclean
distclean: clean
rm -f Makefile Makefile.in POTFILES
maintainer-clean: distclean
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
rm -f $(srcdir)/$(DOMAIN).pot $(srcdir)/stamp-po $(GMOFILES)
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
dist distdir:
test -z "$(DISTFILESDEPS)" || $(MAKE) $(DISTFILESDEPS)
@$(MAKE) dist2
# This is a separate target because 'update-po' must be executed before.
dist2: $(srcdir)/stamp-po $(DISTFILES)
@dists="$(DISTFILES)"; \
if test "$(PACKAGE)" = "gettext-tools"; then \
dists="$$dists Makevars.template"; \
fi; \
if test -f $(srcdir)/$(DOMAIN).pot; then \
dists="$$dists $(DOMAIN).pot stamp-po"; \
else \
case $(XGETTEXT) in \
:) echo "Warning: Creating a tarball without '$(DOMAIN).pot', because a suitable 'xgettext' program was not found in PATH." 1>&2;; \
*) echo "Warning: Creating a tarball without '$(DOMAIN).pot', because 'xgettext' found no strings to extract. Check the contents of the POTFILES.in file and the XGETTEXT_OPTIONS in the Makevars file." 1>&2;; \
esac; \
fi; \
if test -f $(srcdir)/ChangeLog; then \
dists="$$dists ChangeLog"; \
fi; \
for i in 0 1 2 3 4 5 6 7 8 9; do \
if test -f $(srcdir)/ChangeLog.$$i; then \
dists="$$dists ChangeLog.$$i"; \
fi; \
done; \
if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
for file in $$dists; do \
if test -f $$file; then \
cp -p $$file $(distdir) || exit 1; \
else \
cp -p $(srcdir)/$$file $(distdir) || exit 1; \
fi; \
done
update-po: Makefile
$(MAKE) $(DOMAIN).pot-update
test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
$(MAKE) update-gmo
# General rule for creating PO files.
.nop.po-create:
@lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
exit 1
# General rule for updating PO files.
.nop.po-update:
@lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
if test "$(PACKAGE)" = "gettext-tools" && test "$(CROSS_COMPILING)" != "yes"; then PATH=`pwd`/../src:$$PATH; fi; \
tmpdir=`pwd`; \
echo "$$lang:"; \
test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
echo "$${cdcmd}$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang --previous $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
cd $(srcdir); \
if { case `$(MSGMERGE) --version | sed 1q | sed -e 's,^[^0-9]*,,'` in \
'' | 0.[0-9] | 0.[0-9].* | 0.1[0-5] | 0.1[0-5].*) \
$(MSGMERGE) $(MSGMERGE_OPTIONS) -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
0.1[6-7] | 0.1[6-7].*) \
$(MSGMERGE) $(MSGMERGE_OPTIONS) --previous -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
*) \
$(MSGMERGE) $(MSGMERGE_OPTIONS) --lang=$$lang --previous -o $$tmpdir/$$lang.new.po $$lang.po $(DOMAIN).pot;; \
esac; \
}; then \
if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
rm -f $$tmpdir/$$lang.new.po; \
else \
if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
:; \
else \
echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
exit 1; \
fi; \
fi; \
else \
echo "msgmerge for $$lang.po failed!" 1>&2; \
rm -f $$tmpdir/$$lang.new.po; \
fi
$(DUMMYPOFILES):
update-gmo: Makefile $(GMOFILES)
@:
# Recreate Makefile by invoking config.status. Explicitly invoke the shell,
# because execution permission bits may not work on the current file system.
# Use @SHELL@, which is the shell determined by autoconf for the use by its
# scripts, not $(SHELL) which is hardwired to /bin/sh and may be deficient.
Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
cd $(top_builddir) \
&& @SHELL@ ./config.status $(subdir)/$@.in po-directories
force:
# Tell versions [3.59,3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
+18 -1
View File
@@ -2,13 +2,30 @@ src/main/debug.c
src/main/help.c
src/main/main.c
src/main/options.c
src/main/remote.c
src/main/version.c
src/pv/calc.c
src/pv/cursor.c
src/pv/display.c
src/pv/elapsedtime.c
src/pv/file.c
src/pv/format/averagerate.c
src/pv/format/barstyle.c
src/pv/format/bufferpercent.c
src/pv/format/bytes.c
src/pv/format/eta.c
src/pv/format/fineta.c
src/pv/format/lastwritten.c
src/pv/format/name.c
src/pv/format/previousline.c
src/pv/format/progressbar.c
src/pv/format/rate.c
src/pv/format/ratio.c
src/pv/format/sgr.c
src/pv/format/timer.c
src/pv/loop.c
src/pv/number.c
src/pv/proctitle.c
src/pv/remote.c
src/pv/signal.c
src/pv/state.c
src/pv/string.c
+613
View File
@@ -0,0 +1,613 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2026-08-01 14:53+0100\n"
"PO-Revision-Date: 2024-10-13 20:43+0000\n"
"Last-Translator: mmatous <mmatous@users.noreply.translate.codeberg.org>\n"
"Language-Team: Czech <https://translate.codeberg.org/projects/pv/pv/cs/>\n"
"Language: cs\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
"X-Generator: Weblate 5.7.2\n"
#: src/main/help.c:300
msgid "show progress bar"
msgstr "ukaž indikátor průběhu"
#: src/main/help.c:303
msgid "show elapsed time"
msgstr "ukaž uběhlý čas"
#: src/main/help.c:306
msgid "show estimated time of arrival (completion)"
msgstr "ukaž přibližný zbývající čas"
#: src/main/help.c:309
msgid "show absolute estimated time of arrival (completion)"
msgstr "ukaž přibližný čas dokončení"
#: src/main/help.c:312
msgid "show data transfer rate counter"
msgstr "ukaž okamžitou rychlost přenosu dat"
#: src/main/help.c:315
msgid "show data transfer average rate counter"
msgstr "ukaž průměrnou rychlost přenosu dat"
#: src/main/help.c:318
msgid "show number of bytes transferred"
msgstr "ukaž počet přenesených bajtů"
#: src/main/help.c:321
msgid "show percentage of transfer buffer in use"
msgstr "ukaž procento využité vyrovnávací paměti"
#: src/main/help.c:323
msgid "NUM"
msgstr "ČÍS"
#: src/main/help.c:324
msgid "show NUM bytes last written"
msgstr "zobraz ČÍS posledních zapsaných bajtů"
#: src/main/help.c:326
msgid "FORMAT"
msgstr "FORMÁT"
#: src/main/help.c:327
msgid "set output format to FORMAT"
msgstr "nastav formát výstupu na FORMÁT"
#: src/main/help.c:330
msgid "output percentages, not visual information"
msgstr "vypisuj procenta, ne vizuální informace"
#: src/main/help.c:333
msgid "do not output any transfer information at all"
msgstr "nevypisuj žádné informace o přenosu"
#: src/main/help.c:337
msgid "show number of bits transferred"
msgstr "ukaž počet přenesených bitů"
#: src/main/help.c:340
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr "zacházej se suffixy jako s násobky 1000 namísto 1024"
#: src/main/help.c:343
msgid "display nothing until first byte transferred"
msgstr "nic nevypisuj, dokud není přenesen první byte"
#: src/main/help.c:345 src/main/help.c:360 src/main/help.c:363
msgid "SEC"
msgstr "SEK"
#: src/main/help.c:346
msgid "display nothing until SEC seconds have passed"
msgstr "nic nevypisuj, dokud neuplyne SEK sekund"
#: src/main/help.c:348
msgid "SIZE"
msgstr "VEL"
#: src/main/help.c:349
msgid "set estimated data size to SIZE bytes"
msgstr "nastav očekávanou velikost dat na VEL bajtů"
#: src/main/help.c:352
msgid "if size unknown, show rate vs max rate"
msgstr "pokud je velikost neznámá, ukaž rychlost vs maximální rychlost"
#: src/main/help.c:355
msgid "count lines instead of bytes"
msgstr "počítej řádky místo bajtů"
#: src/main/help.c:358
msgid "lines are null-terminated"
msgstr "řádky jsou zakončené nulovým znakem"
#: src/main/help.c:361
msgid "update every SEC seconds"
msgstr "aktualizuj každých SEK sekund"
#: src/main/help.c:364
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr "počítej průměrnou rychlost za posledních SEK sekund (výchozí: 30)"
#: src/main/help.c:366
msgid "WIDTH"
msgstr "ŠÍŘ"
#: src/main/help.c:367
msgid "assume terminal is WIDTH characters wide"
msgstr "předpokládej šířku terminálu ŠÍŘ znaků"
#: src/main/help.c:369
msgid "HEIGHT"
msgstr "VÝŠ"
#: src/main/help.c:370
msgid "assume terminal is HEIGHT rows high"
msgstr "předpokládej výšku terminálu VÝŠ znaků"
#: src/main/help.c:372
msgid "NAME"
msgstr "JMÉNO"
#: src/main/help.c:373
msgid "prefix visual information with NAME"
msgstr "přidej JMÉNO před vizuální informace"
#: src/main/help.c:375
msgid "STYLE"
msgstr ""
#: src/main/help.c:376
msgid "set default bar style to STYLE"
msgstr ""
#: src/main/help.c:378
msgid "SPEC"
msgstr ""
#: src/main/help.c:379
msgid "also send progress to SPEC"
msgstr ""
#: src/main/help.c:382
msgid "set terminal progress state with OSC 9;4 (ConEmu)"
msgstr ""
#: src/main/help.c:385
msgid "output transfer statistics at the end"
msgstr "po dokončení vypiš údaje o přenosu"
#: src/main/help.c:388
msgid "output even if standard error is not a terminal"
msgstr "vypisuj výstup i pokud standardní chybový výstup není terminál"
#: src/main/help.c:391
msgid "use cursor positioning escape sequences"
msgstr "pozicuj kurzor pomocí řídících znaků"
#: src/main/help.c:394 src/main/help.c:430 src/main/help.c:449
#: src/main/help.c:459
msgid "FILE"
msgstr "SOUBOR"
#: src/main/help.c:395
msgid "write output to FILE instead of stdout"
msgstr "zapiš výstup do SOUBORu namísto standardního výstupu"
#: src/main/help.c:397
msgid "RATE"
msgstr "RYCH"
#: src/main/help.c:398
msgid "limit transfer to RATE bytes per second"
msgstr "omez přenosovou rychlost na RYCH bajtů za sekundu"
#: src/main/help.c:400 src/main/help.c:406 src/main/help.c:412
msgid "BYTES"
msgstr "BAJT"
#: src/main/help.c:401
msgid "use a buffer size of BYTES"
msgstr "použij vyrovnávací pamět BAJT bajtů"
#: src/main/help.c:404
msgid "never use splice(), always use read/write"
msgstr "nepoužívej splice(), vždy použij read/write"
#: src/main/help.c:407
msgid "set the pipe buffer size to BYTES"
msgstr ""
#: src/main/help.c:410
msgid "skip read errors in input"
msgstr "ignoruj chyby při čtení vstupu"
#: src/main/help.c:413
msgid "skip errors in BYTES blocks at a time"
msgstr "přeskakuj chyby v blocích BAJTů naráz"
#: src/main/help.c:416
msgid "stop after --size bytes have been transferred"
msgstr "zastav po přenosu --size bajtů"
#: src/main/help.c:419
msgid "flush cache to disk after every write"
msgstr "po každém zápisu vyprázdni cache na disk"
#: src/main/help.c:422
msgid "use direct I/O to bypass cache"
msgstr "použij přímý V/V k obejítí cache"
#: src/main/help.c:425
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:428
msgid "discard input instead of writing to output"
msgstr "zahoď vstup namísto zápisu na výstup"
#: src/main/help.c:431
msgid "write all input to FILE before writing to output"
msgstr "zapiš veškerý vstup do SOUBORu před výpisem na výstup"
#: src/main/help.c:434
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:435
msgid "watch file FD opened by process PID"
msgstr "sleduj soubor DS otevřený procesem PID"
#: src/main/help.c:438 src/main/help.c:441
msgid "PID"
msgstr "PID"
#: src/main/help.c:439
msgid "update settings of process PID"
msgstr "aktualizuj nastavení procesu PID"
#: src/main/help.c:442
msgid "show progress of process PID"
msgstr ""
#: src/main/help.c:446
msgid "run a command and monitor its standard input, output, or both"
msgstr ""
#: src/main/help.c:450
msgid "save process ID in FILE"
msgstr "ulož id procesu do SOUBORu"
#: src/main/help.c:453
msgid "show this help and exit"
msgstr "ukaž pomoc a skonči"
#: src/main/help.c:456
msgid "show version information and exit"
msgstr "ukaž informace o verzi a skonči"
#: src/main/help.c:460
msgid "write debug logs to FILE"
msgstr "zapiš ladící záznamy do SOUBORu"
#: src/main/help.c:486
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Použití: %s [VOLBY] [SOUBOR]..."
#: src/main/help.c:497
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Spoj SOUBOR(y) nebo standardní vstup na standardního výstup, s monitoringem."
#: src/main/help.c:639
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:653
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Prosím, hlašte veškeré chyby na: %s"
#: src/main/main.c:225
msgid "(input)"
msgstr "(vstup)"
#: src/main/main.c:381 src/main/options.c:1359
msgid "a command to run must be specified"
msgstr ""
#: src/main/main.c:704 src/main/options.c:757 src/main/options.c:777
#: src/pv/display.c:1086 src/pv/state.c:45 src/pv/state.c:902
#: src/pv/state.c:914 src/pv/state.c:950 src/pv/transfer.c:1335
#: src/pv/transfer.c:1451 src/pv/transfer.c:1778
msgid "memory allocation failure"
msgstr "chyba přidělování paměti"
#: src/main/options.c:418
msgid "list files may not contain @ lines"
msgstr ""
#: src/main/options.c:438 src/main/options.c:440 src/main/options.c:901
msgid "process ID or pid:fd pair expected"
msgstr "očekáváno ID procesu nebo dvojice PID:DS"
#: src/main/options.c:449 src/main/options.c:451 src/main/options.c:908
msgid "invalid process ID"
msgstr "neplatné ID procesu"
#: src/main/options.c:829
msgid "numeric value not understood"
msgstr ""
#: src/main/options.c:843
msgid "integer argument expected"
msgstr "očekáván celočíselný argument"
#: src/main/options.c:853
msgid "numeric argument expected"
msgstr "očekáván číselný argument"
#: src/main/options.c:864
msgid "missing filename"
msgstr ""
#: src/main/options.c:890
msgid "missing process name"
msgstr ""
#: src/main/options.c:1182
msgid "invalid side specification"
msgstr ""
#: src/main/options.c:1197
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Zkuste `%s --help' pro více informací."
#: src/main/options.c:1199
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Zkuste `%s --h' pro více informací."
#: src/main/options.c:1231
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
"při sledování deskriptorů souborů nelze použít řádkový mód nebo volby pro "
"modifikaci přenosu"
#: src/main/options.c:1239
msgid "cannot use cursor positioning when watching file descriptors"
msgstr "při sledování deskriptorů souborů nelze pozicování kurzoru použít"
#: src/main/options.c:1247
msgid "cannot use remote control when watching file descriptors"
msgstr "při sledování deskriptorů souborů nelze použít vzdálené ovládání"
#: src/main/options.c:1255
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1263
msgid "cannot transfer files when watching file descriptors"
msgstr "při sledování deskriptorů souborů nelze použít přenos souborů"
#: src/main/options.c:1287
msgid "not available on systems without /proc/self/fdinfo"
msgstr "není dostupné na systémech bez /proc/self/fdinfo"
#: src/main/options.c:1298
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/options.c:1325
msgid "monitor mode cannot be specified with this option"
msgstr ""
#: src/main/options.c:1337
msgid "monitor mode cannot be used with store-and-forward"
msgstr ""
#: src/main/options.c:1348
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
msgstr "Licence: GPLv3+ <https://jxself.org/translations/gpl-3.cz.shtml>"
#: src/main/version.c:29
msgid "This is free software: you are free to change and redistribute it."
msgstr "Toto je svobodný software; můžete ho volně měnit a šířit."
#: src/main/version.c:30
msgid "There is NO WARRANTY, to the extent permitted by law."
msgstr "Na program se nevztahuje ŽÁDNÁ ZÁRUKA, v míře povolené zákonem."
#: src/main/version.c:32
msgid "Project web site"
msgstr "Stránka projektu"
#: src/pv/cursor.c:108 src/pv/cursor.c:135
msgid "failed to open lock file"
msgstr "selhalo otevření zámkového souboru"
#: src/pv/cursor.c:790 src/pv/cursor.c:792
msgid "interrupted by a signal"
msgstr "přerušeno signálem"
#: src/pv/display.c:311
msgid "yzafpnum kMGTPEZY"
msgstr "yzafpnum kMGTPEZY"
#: src/pv/display.c:329
msgid "yzafpnum KMGTPEZY"
msgstr "yzafpnum KMGTPEZY"
#: src/pv/file.c:81
msgid "/dev/null is not usable"
msgstr ""
#: src/pv/file.c:371
msgid "error closing file"
msgstr "chyba při zavírání souboru"
#: src/pv/file.c:438
msgid "input file is also the output"
msgstr "vstupní soubor je rovněž výstupem"
#: src/pv/file.c:596
msgid "(none)"
msgstr "(žádný)"
#: src/pv/file.c:598
msgid "(stdin)"
msgstr "(stdin)"
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:181
msgid "b/s"
msgstr "b/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr "/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:181
msgid "B/s"
msgstr "B/s"
#: src/pv/format/bytes.c:35
msgid "b"
msgstr "b"
#: src/pv/format/bytes.c:39 src/pv/transfer.c:1284
msgid "B"
msgstr "B"
#: src/pv/format/eta.c:63 src/pv/format/eta.c:67
msgid "ETA"
msgstr "ETA"
#: src/pv/format/fineta.c:93
msgid "FIN"
msgstr "FIN"
#: src/pv/loop.c:180
msgid "rate min/avg/max/mdev"
msgstr "rychlost min/avg/max/std"
#: src/pv/loop.c:192
msgid "rate not measured"
msgstr "rychlost neměřena"
#: src/pv/loop.c:1098 src/pv/loop.c:1114 src/pv/loop.c:1132 src/pv/remote.c:93
#: src/pv/remote.c:188 src/pv/remote.c:536 src/pv/remote.c:582
#: src/pv/watchpid.c:123 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:158 src/pv/watchpid.c:194
#: src/pv/watchpid.c:206 src/pv/watchpid.c:218 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:286 src/pv/watchpid.c:401
#: src/pv/watchpid.c:409 src/pv/watchpid.c:556 src/pv/watchpid.c:565
#: src/pv/watchpid.c:586
msgid "pid"
msgstr "pid"
#: src/pv/loop.c:1132 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:160 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:288
msgid "fd"
msgstr "ds"
#: src/pv/remote.c:242 src/pv/remote.c:636
msgid "message not received"
msgstr "zpráva nepřijata"
#: src/pv/remote.c:659 src/pv/remote.c:677
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO není na tomto systému podporováno"
#: src/pv/transfer.c:1173
msgid "warning: read errors detected"
msgstr "varování: detekovány chyby při čtení"
#: src/pv/transfer.c:1283
msgid "skipped past read error"
msgstr "chyba přeskočena"
#: src/pv/transfer.c:1642
msgid "write error"
msgstr "chyba při zápisu"
#: src/pv/watchpid.c:160 src/pv/watchpid.c:288
msgid "not a regular file or block device"
msgstr "není obyčejný soubor nebo blokové zařízení"
#~ msgid "state allocation failed"
#~ msgstr "selhala alokace stavu"
#~ msgid "failed to stat file"
#~ msgstr "nebylo možné zjistit informace o souboru"
#~ msgid "is a directory"
#~ msgstr "je adresář"
#~ msgid "failed to generate sysfs filename"
#~ msgstr "selhalo vytváření jména pro soubor v sysfs"
#~ msgid "failed to read sysfs size file"
#~ msgstr "selhalo čtení velikosti souboru v sysfs"
#~ msgid "failed to open block device"
#~ msgstr "selhalo otevření blokového zařízení"
#~ msgid "failed to determine size of block device"
#~ msgstr "selhalo zjištění velikosti blokového zařízení"
#~ msgid "option structure allocation failed"
#~ msgstr "selhala alokace struktury pro volby"
#~ msgid "option structure argv allocation failed"
#~ msgstr "selhala alokace struktury pro argv"
#~ msgid "failed to get terminal name"
#~ msgstr "selhalo zjištění názvu terminálu"
#~ msgid "lock attempt failed"
#~ msgstr "selhal pokus o uzamčení"
#~ msgid "failed to open terminal"
#~ msgstr "selhalo otevření terminálu"
#~ msgid "failed to seek to start of output"
#~ msgstr "selhalo posunutí za začátek výstupu"
#~ msgid "failed to read file"
#~ msgstr "selhalo čtení ze souboru"
#~ msgid "failed to stat output file"
#~ msgstr "selhalo zjištění informací o výstupním souboru"
#~ msgid "history structure allocation failed"
#~ msgstr "selhala alokace struktury historie"
#~ msgid "file list allocation failed"
#~ msgstr "selhala alokace seznamu souborů"
#~ msgid "read failed"
#~ msgstr "čtení selhalo"
#~ msgid "file is not seekable"
#~ msgstr "souborem nelze procházet"
#~ msgid "failed to seek past error"
#~ msgstr "selhal skok za chybu"
#~ msgid "no transfer buffer allocated"
#~ msgstr "vyrovnávací paměť není alokována"
#~ msgid "failed to set interval timer"
#~ msgstr "selhalo nastavení intervalového časovače"
#~ msgid "failed to clear interval timer"
#~ msgstr "selhalo vynulování intervalového časovače"
#~ msgid "line position buffer allocation failed"
#~ msgstr "selhala alokace vyrovnávací paměti pro pozici v řádcích"
#~ msgid "select call failed"
#~ msgstr "selhalo volání select"
#~ msgid "PID[:FD]"
#~ msgstr "PID[:DS]"
+417 -265
View File
@@ -1,16 +1,22 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-04-21 14:15+0100\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2026-08-01 14:53+0100\n"
"PO-Revision-Date: 2026-08-01 18:32+0000\n"
"Last-Translator: a-j-wood <a-j-wood@noreply.codeberg.org>\n"
"Language-Team: German <https://translate.codeberg.org/projects/pv/pv/de/>\n"
"Language: de\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 2026.7.1\n"
"Date: 1999-06-01 15:18:29+0100\n"
"From: Andrew Wood <ivarch@ubik>\n"
"Xgettext-Options: --default-domain=pkgbuild --directory=./.pkgdir --add-"
"comments --keyword=_ --keyword=N_\n"
"Files: src/getopt/getopt.c src/getopt/getopt1.c src/version.c src/main/init."
"c src/main/help.c src/main/xpmptr.c src/guts/load.c src/guts/stop.c src/guts/"
"configure.c src/guts/make.c src/guts/install.c src/guts/prefs.c src/ui/"
"Files: src/getopt/getopt.c src/getopt/getopt1.c src/version.c src/main/"
"init.c src/main/help.c src/main/xpmptr.c src/guts/load.c src/guts/stop.c src/"
"guts/configure.c src/guts/make.c src/guts/install.c src/guts/prefs.c src/ui/"
"generate.c src/ui/main.c src/ui/xpm.c src/ui/status.c src/ui/activate.c src/"
"ui/handlers/main.c src/ui/handlers/package.c src/ui/handlers/prefs.c src/ui/"
"handlers/dirsel.c src/ui/handlers/popup.c src/ui/handlers/help.c src/ui/"
@@ -20,471 +26,617 @@ msgstr ""
"nls/intl/textdomain.c src/nls/intl-cat/cat-compat.c src/nls/intl-gett/intl-"
"compat.c\n"
#: src/main/help.c:284
#: src/main/help.c:300
msgid "show progress bar"
msgstr "Fortschritts-Anzeige"
#: src/main/help.c:287
#: src/main/help.c:303
msgid "show elapsed time"
msgstr "zeige die verstrichene Zeit an"
#: src/main/help.c:290
#: src/main/help.c:306
msgid "show estimated time of arrival (completion)"
msgstr "zeige die erwartete Zeit bis zum Ende an"
#: src/main/help.c:293
#: src/main/help.c:309
msgid "show absolute estimated time of arrival (completion)"
msgstr "zeige die absolute geschätzte Zeit bis zur Fertigstellung"
#: src/main/help.c:296
#: src/main/help.c:312
msgid "show data transfer rate counter"
msgstr "zeige die Datentransferrate an"
#: src/main/help.c:299
#: src/main/help.c:315
msgid "show data transfer average rate counter"
msgstr ""
msgstr "zeige die durchschnittliche Übertragungsrate"
#: src/main/help.c:301 src/main/help.c:332 src/main/help.c:344
msgid "SEC"
msgstr ""
#: src/main/help.c:302
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
#: src/main/help.c:305
#: src/main/help.c:318
msgid "show number of bytes transferred"
msgstr "zeige die Anzahl von Bytes, die transferiert worden sind"
msgstr "zeige die Anzahl der übertragenen Bytes"
#: src/main/help.c:308
msgid "show number of bits transferred"
msgstr ""
#: src/main/help.c:311
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr ""
#: src/main/help.c:314
#: src/main/help.c:321
msgid "show percentage of transfer buffer in use"
msgstr "zeige, wie viel Prozent des Übertragungsbuffers in Benutzung sind"
#: src/main/help.c:316
#: src/main/help.c:323
msgid "NUM"
msgstr ""
msgstr "NUM"
#: src/main/help.c:317
#: src/main/help.c:324
msgid "show NUM bytes last written"
msgstr "NUM zeige die zuletzt geschriebenen NUM Bytes"
#: src/main/help.c:319
#: src/main/help.c:326
msgid "FORMAT"
msgstr ""
msgstr "FORMAT"
#: src/main/help.c:320
#: src/main/help.c:327
msgid "set output format to FORMAT"
msgstr "setze das Ausgabeformat auf FORMAT"
#: src/main/help.c:323
#: src/main/help.c:330
msgid "output percentages, not visual information"
msgstr "Ausgabe von Prozent-Angaben statt visueller Darstellung"
#: src/main/help.c:326
#: src/main/help.c:333
msgid "do not output any transfer information at all"
msgstr "sämtliche Transferinformationen unterdrücken"
#: src/main/help.c:330
#: src/main/help.c:337
msgid "show number of bits transferred"
msgstr "zeige die Anzahl der übertragenen Bits"
#: src/main/help.c:340
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr "behandle Endungen als Vielfache von 1000 statt von 1024"
#: src/main/help.c:343
msgid "display nothing until first byte transferred"
msgstr "keine Ausgabe bevor das erste Byte übertragen wurde"
#: src/main/help.c:333
#: src/main/help.c:345 src/main/help.c:360 src/main/help.c:363
msgid "SEC"
msgstr "SEK"
#: src/main/help.c:346
msgid "display nothing until SEC seconds have passed"
msgstr "SEC nichts anzeigen, bis SEC Sekunden vergangen sind"
msgstr "nichts anzeigen ehe SEK Sekunden vergangen sind"
#: src/main/help.c:335
#: src/main/help.c:348
msgid "SIZE"
msgstr ""
msgstr "GRÖẞE"
#: src/main/help.c:336
#: src/main/help.c:349
msgid "set estimated data size to SIZE bytes"
msgstr "setze erwartete Datenlänge auf SIZE Byte"
#: src/main/help.c:339
#: src/main/help.c:352
msgid "if size unknown, show rate vs max rate"
msgstr "zeige Rate vs maximale Rate, falls die größe unbekannt ist"
#: src/main/help.c:355
msgid "count lines instead of bytes"
msgstr "zähle Zeilen anstelle von Bytes"
#: src/main/help.c:342
#: src/main/help.c:358
msgid "lines are null-terminated"
msgstr "Zeilen sind nullterminiert"
#: src/main/help.c:345
#: src/main/help.c:361
msgid "update every SEC seconds"
msgstr "aktualisiere Ausgabe nach SEC Sekunden Intervall"
msgstr "aktualisiere Ausgabe nach SEK Sekunden Intervall"
#: src/main/help.c:347
#: src/main/help.c:364
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
"berechne die durchschnittliche Übertragungsrate über die letzten SEK "
"Sekunden (Standard 30s)"
#: src/main/help.c:366
msgid "WIDTH"
msgstr ""
msgstr "BREITE"
#: src/main/help.c:348
#: src/main/help.c:367
msgid "assume terminal is WIDTH characters wide"
msgstr "setze Terminal-Breite auf WIDTH Zeichen"
msgstr "setze Terminal-Breite auf BREITE Zeichen"
#: src/main/help.c:350
#: src/main/help.c:369
msgid "HEIGHT"
msgstr ""
msgstr "HÖHE"
#: src/main/help.c:351
#: src/main/help.c:370
msgid "assume terminal is HEIGHT rows high"
msgstr "setze Terminal-Höhe auf HEIGHT Zeichen"
msgstr "setze Terminal-Höhe auf HÖHE Zeichen"
#: src/main/help.c:353
#: src/main/help.c:372
msgid "NAME"
msgstr ""
msgstr "NAME"
#: src/main/help.c:354
#: src/main/help.c:373
msgid "prefix visual information with NAME"
msgstr "setze den NAMEn für visuelle Darstellung"
#: src/main/help.c:357
#: src/main/help.c:375
msgid "STYLE"
msgstr "STIL"
#: src/main/help.c:376
msgid "set default bar style to STYLE"
msgstr "setze die voreingestellte Darstellung auf STIL"
#: src/main/help.c:378
msgid "SPEC"
msgstr "SPEC"
#: src/main/help.c:379
msgid "also send progress to SPEC"
msgstr "Fortschritt auch an SPEC senden"
#: src/main/help.c:382
msgid "set terminal progress state with OSC 9;4 (ConEmu)"
msgstr "aktualisieren Sie den Terminal-Fortschrittszustand mit OSC 9;4 (ConEmu)"
#: src/main/help.c:385
msgid "output transfer statistics at the end"
msgstr "Übertragungsstatistiken am Ende ausgeben"
#: src/main/help.c:388
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:360
#: src/main/help.c:391
msgid "use cursor positioning escape sequences"
msgstr "benutze Escape-Sequenzen zur Cursor-Positionierung"
#: src/main/help.c:363
msgid "RATE"
msgstr ""
#: src/main/help.c:394 src/main/help.c:430 src/main/help.c:449
#: src/main/help.c:459
msgid "FILE"
msgstr "DATEI"
#: src/main/help.c:364
#: src/main/help.c:395
msgid "write output to FILE instead of stdout"
msgstr "schreibe die Ausgabe in DATEI statt in die Standardausgabe"
#: src/main/help.c:397
msgid "RATE"
msgstr "RATE"
#: src/main/help.c:398
msgid "limit transfer to RATE bytes per second"
msgstr "beschränke die Transferrate auf RATE Byte pro Sekunde"
#: src/main/help.c:366 src/main/help.c:375
#: src/main/help.c:400 src/main/help.c:406 src/main/help.c:412
msgid "BYTES"
msgstr ""
msgstr "BYTES"
#: src/main/help.c:367
#: src/main/help.c:401
msgid "use a buffer size of BYTES"
msgstr "BYTES benutze einen Puffer in der Größe von BYTES"
msgstr "benutze einen Puffer in der Größe von BYTES"
#: src/main/help.c:370
#: src/main/help.c:404
msgid "never use splice(), always use read/write"
msgstr "anstelle von splice() immer read/write benutzen"
#: src/main/help.c:373
#: src/main/help.c:407
msgid "set the pipe buffer size to BYTES"
msgstr "benutze einen Pipe-Puffer in der Größe von BYTES"
#: src/main/help.c:410
msgid "skip read errors in input"
msgstr "Lesefehler in der Eingabe nicht beachten"
#: src/main/help.c:376
#: src/main/help.c:413
msgid "skip errors in BYTES blocks at a time"
msgstr ""
msgstr "bei Fehlern BYTES am Stück überspringen"
#: src/main/help.c:379
#: src/main/help.c:416
msgid "stop after --size bytes have been transferred"
msgstr "anhalten, nachdem --size Bytes übertragen wurden"
#: src/main/help.c:382
#: src/main/help.c:419
msgid "flush cache to disk after every write"
msgstr ""
msgstr "schreibe den Cache nach jedem Schreibvorgang auf die Festplatte"
#: src/main/help.c:385
#: src/main/help.c:422
msgid "use direct I/O to bypass cache"
msgstr ""
msgstr "verwende direkte E/A, um den Cache zu umgehen"
#: src/main/help.c:388
#: src/main/help.c:425
msgid "try to seek instead of writing null bytes"
msgstr "ausgabelöcher anstelle von Nullbytes"
#: src/main/help.c:428
msgid "discard input instead of writing to output"
msgstr ""
msgstr "verwirf die Eingabe anstatt in die Ausgabe zu schreiben"
#: src/main/help.c:391
msgid "PID"
msgstr ""
#: src/main/help.c:431
msgid "write all input to FILE before writing to output"
msgstr "Ausgabe nach FILE schrieben bevor sie ausgegeben wird"
#: src/main/help.c:392
msgid "update settings of process PID"
msgstr "Einstellungen der Prozess-PID updaten"
#: src/main/help.c:434
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr "PID[:FD]|=NAME|@LISTENDATEI"
#: src/main/help.c:396 src/main/help.c:411
msgid "FILE"
msgstr ""
#: src/main/help.c:397
msgid "save process ID in FILE"
msgstr "Prozess-ID in FILE speichern"
#: src/main/help.c:400
msgid "PID[:FD]"
msgstr ""
#: src/main/help.c:401
#: src/main/help.c:435
msgid "watch file FD opened by process PID"
msgstr "die vom Prozess PID geöffnete Datei FD beobachten"
#: src/main/help.c:405
#: src/main/help.c:438 src/main/help.c:441
msgid "PID"
msgstr "PID"
#: src/main/help.c:439
msgid "update settings of process PID"
msgstr "Einstellungen der Prozess-PID updaten"
#: src/main/help.c:442
msgid "show progress of process PID"
msgstr "den Fortschritt des PID-Prozesses darstellen"
#: src/main/help.c:446
msgid "run a command and monitor its standard input, output, or both"
msgstr ""
"Ein Programm ausführen und dessen Standardeingabe, -ausgabe oder beides "
"überwachen"
#: src/main/help.c:450
msgid "save process ID in FILE"
msgstr "Prozess-ID in DATEI speichern"
#: src/main/help.c:453
msgid "show this help and exit"
msgstr "zeige diese Hilfe und beende"
#: src/main/help.c:408
#: src/main/help.c:456
msgid "show version information and exit"
msgstr "zeige Versionsinformationen und beende"
#: src/main/help.c:412
#: src/main/help.c:460
msgid "write debug logs to FILE"
msgstr ""
msgstr "schreibe Debug-Protokolle in DATEI"
#: src/main/help.c:437
#: src/main/help.c:486
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Syntax: %s [OPTION] [DATEI]..."
msgstr "Aufruf: %s [OPTION] [DATEI]..."
#: src/main/help.c:448
#: src/main/help.c:497
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Verbindet DATEI(en) oder den Standard-Eingabe-Kanal mit dem Standard-Ausgabe-"
"Kanal und misst den Datenstrom."
#: src/main/help.c:585
#: src/main/help.c:639
msgid "Supported format sequences:"
msgstr "unterstützte Formate:"
#: src/main/help.c:653
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Bitte senden Sie Fehlerberichte an %s"
#: src/main/main.c:74
msgid "state allocation failed"
msgstr "Zustandszuweisung fehlgeschlagen"
#: src/main/main.c:225
msgid "(input)"
msgstr "(eingabe)"
#: src/main/options.c:174
msgid "option structure allocation failed"
msgstr "`option' konnte nicht allokiert werden"
#: src/main/main.c:381 src/main/options.c:1359
msgid "a command to run must be specified"
msgstr "es muss ein auszuführendes Programm angegeben werden"
#: src/main/options.c:193
msgid "option structure argv allocation failed"
msgstr "`option' (argv) konnte nicht allokiert werden"
#: src/main/main.c:704 src/main/options.c:757 src/main/options.c:777
#: src/pv/display.c:1086 src/pv/state.c:45 src/pv/state.c:902
#: src/pv/state.c:914 src/pv/state.c:950 src/pv/transfer.c:1335
#: src/pv/transfer.c:1451 src/pv/transfer.c:1778
msgid "memory allocation failure"
msgstr "Fehler bei der Speicheranforderung"
#: src/main/options.c:255
msgid "integer argument expected"
msgstr "Ganzzahliges Argument erwartet"
#: src/main/options.c:418
msgid "list files may not contain @ lines"
msgstr "Listendateien dürfen keine „@“-Zeilen enthalten"
#: src/main/options.c:266
msgid "numeric argument expected"
msgstr "numerisches Argument erwartet"
#: src/main/options.c:277
#: src/main/options.c:438 src/main/options.c:440 src/main/options.c:901
msgid "process ID or pid:fd pair expected"
msgstr "Prozess-ID oder PID:FD-Paar erwartet"
#: src/main/options.c:284
#: src/main/options.c:449 src/main/options.c:451 src/main/options.c:908
msgid "invalid process ID"
msgstr "ungültige Prozess-ID"
#: src/main/options.c:388 src/pv/file.c:323
msgid "failed to stat file"
msgstr "Dateiinformationen konnten nicht gelesen werden"
#: src/main/options.c:829
msgid "numeric value not understood"
msgstr "numerischen Wert nicht verstanden"
#: src/main/options.c:491
#: src/main/options.c:843
msgid "integer argument expected"
msgstr "Ganzzahliges Argument erwartet"
#: src/main/options.c:853
msgid "numeric argument expected"
msgstr "numerisches Argument erwartet"
#: src/main/options.c:864
msgid "missing filename"
msgstr "fehlender Dateiname"
#: src/main/options.c:890
msgid "missing process name"
msgstr "fehlender Prozessname"
#: src/main/options.c:1182
msgid "invalid side specification"
msgstr "ungültige Seitenspezifikation"
#: src/main/options.c:1197
#, c-format
msgid "Try `%s --help' for more information."
msgstr "`%s --help' zeigt weitere Informationen an."
msgstr "%s --help zeigt weitere Informationen an."
#: src/main/options.c:493
#: src/main/options.c:1199
#, c-format
msgid "Try `%s -h' for more information."
msgstr "`%s -h' zeigt weitere Informationen an."
msgstr "%s -h zeigt weitere Informationen an."
#: src/main/options.c:524
#: src/main/options.c:1231
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
"Beim Anzeigen von Dateideskriptoren können keine Optionen für den "
"Beim Beobachten von Dateideskriptoren können keine Optionen für den "
"Zeilenmodus oder den Übertragungsmodifikator verwendet werden"
#: src/main/options.c:533
#: src/main/options.c:1239
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
"Beim Anzeigen von Dateideskriptoren können keine Zeilenmodus- oder "
"Übertragungsmodifikatoroptionen verwendet werden."
"Beim Beobachten von Dateideskriptoren kann Cursor-Positionierung nicht "
"verwendet werden"
#: src/main/options.c:542
#: src/main/options.c:1247
msgid "cannot use remote control when watching file descriptors"
msgstr ""
"kann keine Fernbedienung verwenden, wenn Dateideskriptoren angezeigt werden"
"Beim Beobachten von Dateideskriptoren kann die Fernbedienung nicht verwenden "
"werden"
#: src/main/options.c:551
#: src/main/options.c:1255
msgid "cannot use remote query when watching file descriptors"
msgstr ""
"Remote-Abfragen können beim Überwachen von Dateideskriptoren nicht verwendet "
"werden"
#: src/main/options.c:1263
msgid "cannot transfer files when watching file descriptors"
msgstr ""
"Dateien können beim Betrachten von Dateideskriptoren nicht übertragen werden"
"Beim Beobachten von Dateideskriptoren können Dateien nicht übertragen werden"
#: src/main/options.c:566
#: src/main/options.c:1287
msgid "not available on systems without /proc/self/fdinfo"
msgstr "Nicht verfügbar auf Systemen ohne /proc/self/fdinfo"
#: src/main/remote.c:302
msgid "message not received"
msgstr "Nachricht nicht empfangen"
#: src/main/options.c:1298
msgid "cannot use remote control and remote query together"
msgstr ""
"Fernsteuerung und Fernabfrage können nicht gleichzeitig verwendet werden"
#: src/main/remote.c:429
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO wird auf diesem System nicht unterstützt"
#: src/main/options.c:1325
msgid "monitor mode cannot be specified with this option"
msgstr "Der Monitormodus kann mit dieser Option nicht angegeben werden"
#: src/main/options.c:1337
msgid "monitor mode cannot be used with store-and-forward"
msgstr ""
"Der Monitormodus kann nicht mit Speichern-und-Weiterleiten verwendet werden"
#: src/main/options.c:1348
msgid "files cannot be specified with this option"
msgstr "mit dieser Option können keine Dateien angegeben werden"
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
msgstr ""
msgstr "Lizenz: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
#: src/main/version.c:29
msgid "This is free software: you are free to change and redistribute it."
msgstr ""
msgstr "Dies ist freie Software: Sie dürfen sie verändern und weiterverteilen."
#: src/main/version.c:30
msgid "There is NO WARRANTY, to the extent permitted by law."
msgstr ""
msgstr "Es besteht KEINE GARANTIE, soweit dies gesetzlich zulässig ist."
#: src/main/version.c:32
msgid "Project web site"
msgstr ""
msgstr "Projekt-Website"
#: src/pv/cursor.c:87
msgid "failed to get terminal name"
msgstr "Terminalname konnte nicht gelesen werden"
#: src/pv/cursor.c:132
#: src/pv/cursor.c:108 src/pv/cursor.c:135
msgid "failed to open lock file"
msgstr "Sperrdatei konnte nicht geöffnet werden"
msgstr "konnte Sperrdatei nicht öffnen"
#: src/pv/cursor.c:165
msgid "lock attempt failed"
msgstr "Sperrversuch fehlgeschlagen"
#: src/pv/cursor.c:790 src/pv/cursor.c:792
msgid "interrupted by a signal"
msgstr "von einem Signal unterbrochen"
#: src/pv/cursor.c:426
msgid "failed to open terminal"
msgstr "Terminal konnte nicht geöffnet werden"
#: src/pv/display.c:193
#: src/pv/display.c:311
msgid "yzafpnum kMGTPEZY"
msgstr ""
msgstr "yzafpnµm kMGTPEZY"
#: src/pv/display.c:211
#: src/pv/display.c:329
msgid "yzafpnum KMGTPEZY"
msgstr ""
msgstr "yzafpnµm KMGTPEZY"
#: src/pv/display.c:750 src/pv/transfer.c:954
msgid "buffer allocation failed"
msgstr "Puffer konnte nicht allokiert werden"
#: src/pv/file.c:81
msgid "/dev/null is not usable"
msgstr "/dev/null ist nicht verwendbar"
#: src/pv/display.c:856
#: src/pv/file.c:371
msgid "error closing file"
msgstr "Fehler beim Schließen der Datei"
#: src/pv/file.c:438
msgid "input file is also the output"
msgstr "die Eingabedatei ist auch die Ausgabedatei"
#: src/pv/file.c:596
msgid "(none)"
msgstr "(keine)"
#: src/pv/file.c:598
msgid "(stdin)"
msgstr "(stdin)"
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:181
msgid "b/s"
msgstr "b/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr "/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:181
msgid "B/s"
msgstr "B/s"
#: src/pv/format/bytes.c:35
msgid "b"
msgstr ""
msgstr "b"
#: src/pv/display.c:859 src/pv/transfer.c:596
#: src/pv/format/bytes.c:39 src/pv/transfer.c:1284
msgid "B"
msgstr "B"
#: src/pv/display.c:900 src/pv/display.c:916
msgid "b/s"
msgstr ""
#: src/pv/display.c:905 src/pv/display.c:920
msgid "/s"
msgstr ""
#: src/pv/display.c:905 src/pv/display.c:920
msgid "B/s"
msgstr ""
#: src/pv/display.c:947 src/pv/display.c:951 src/pv/display.c:1017
#: src/pv/format/eta.c:63 src/pv/format/eta.c:67
msgid "ETA"
msgstr "ETA"
#: src/pv/file.c:148
msgid "failed to seek to start of output"
msgstr "Konnte nicht versuchen, die Ausgabe zu starten"
#: src/pv/format/fineta.c:93
msgid "FIN"
msgstr "Endzeit"
#: src/pv/file.c:293
msgid "failed to close file"
msgstr "Datei konnte nicht geschlossen werden"
#: src/pv/loop.c:180
msgid "rate min/avg/max/mdev"
msgstr "Rate min/mittel/max/abweichung"
#: src/pv/file.c:316
msgid "failed to read file"
msgstr "Datei konnte nicht gelesen werden"
#: src/pv/loop.c:192
msgid "rate not measured"
msgstr "Übertragungsrate nicht gemessen"
#: src/pv/file.c:331
msgid "failed to stat output file"
msgstr "Dateiinformationen für Ausgabe-Datei konnten nicht gelesen werden"
#: src/pv/file.c:353
msgid "input file is output file"
msgstr "Eingabe-Datei ist Ausgabe-Datei"
#: src/pv/file.c:411
msgid "(none)"
msgstr ""
#: src/pv/file.c:413
msgid "(stdin)"
msgstr ""
#: src/pv/loop.c:570 src/pv/loop.c:621 src/pv/loop.c:662 src/pv/watchpid.c:99
#: src/pv/watchpid.c:109 src/pv/watchpid.c:120 src/pv/watchpid.c:128
#: src/pv/watchpid.c:165 src/pv/watchpid.c:184 src/pv/watchpid.c:192
#: src/pv/watchpid.c:202 src/pv/watchpid.c:293 src/pv/watchpid.c:301
#: src/pv/watchpid.c:377 src/pv/watchpid.c:398
#: src/pv/loop.c:1098 src/pv/loop.c:1114 src/pv/loop.c:1132 src/pv/remote.c:93
#: src/pv/remote.c:188 src/pv/remote.c:536 src/pv/remote.c:582
#: src/pv/watchpid.c:123 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:158 src/pv/watchpid.c:194
#: src/pv/watchpid.c:206 src/pv/watchpid.c:218 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:286 src/pv/watchpid.c:401
#: src/pv/watchpid.c:409 src/pv/watchpid.c:556 src/pv/watchpid.c:565
#: src/pv/watchpid.c:586
msgid "pid"
msgstr ""
msgstr "pid"
#: src/pv/state.c:36
msgid "history structure allocation failed"
msgstr ""
#: src/pv/loop.c:1132 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:160 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:288
msgid "fd"
msgstr "fd"
#: src/pv/state.c:391 src/pv/state.c:402
msgid "file list allocation failed"
msgstr ""
#: src/pv/remote.c:242 src/pv/remote.c:636
msgid "message not received"
msgstr "Nachricht nicht empfangen"
#: src/pv/transfer.c:458
msgid "read failed"
msgstr "read-Aufruf fehlgeschlagen"
#: src/pv/remote.c:659 src/pv/remote.c:677
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO wird auf diesem System nicht unterstützt"
#: src/pv/transfer.c:481
#: src/pv/transfer.c:1173
msgid "warning: read errors detected"
msgstr "warnung: lesefehler erkannt"
#: src/pv/transfer.c:497
msgid "file is not seekable"
msgstr "datei ist nicht durchsuchbar"
#: src/pv/transfer.c:575
msgid "failed to seek past error"
msgstr "konnte den Fehler nicht überwinden"
#: src/pv/transfer.c:595
#: src/pv/transfer.c:1283
msgid "skipped past read error"
msgstr "über den Lesefehler hinaus verschoben"
#: src/pv/transfer.c:635
msgid "no transfer buffer allocated"
msgstr ""
#: src/pv/transfer.c:1642
msgid "write error"
msgstr "Schreibfehler"
#: src/pv/transfer.c:676
msgid "failed to set interval timer"
msgstr ""
#: src/pv/transfer.c:694
msgid "failed to clear interval timer"
msgstr ""
#: src/pv/transfer.c:818
msgid "write failed"
msgstr "write-Aufruf fehlgeschlagen"
#: src/pv/transfer.c:1051
msgid "select call failed"
msgstr "select-Aufruf fehlgeschlagen"
#: src/pv/watchpid.c:109 src/pv/watchpid.c:121 src/pv/watchpid.c:130
#: src/pv/watchpid.c:184 src/pv/watchpid.c:193 src/pv/watchpid.c:204
msgid "fd"
msgstr ""
#: src/pv/watchpid.c:130 src/pv/watchpid.c:204
#: src/pv/watchpid.c:160 src/pv/watchpid.c:288
msgid "not a regular file or block device"
msgstr "keine normale Datei oder Blockgerät"
msgstr "ist weder eine normale Datei noch ein Blockgerät"
#~ msgid "state allocation failed"
#~ msgstr "Speicherzuweisung für `state' fehlgeschlagen"
#~ msgid "failed to stat file"
#~ msgstr "konnte Dateiinformationen nicht lesen"
#~ msgid "is a directory"
#~ msgstr "ist ein Verzeichnis"
#~ msgid "failed to generate sysfs filename"
#~ msgstr "konnte Sysfs-Dateinamen nicht erzeugen"
#~ msgid "failed to read sysfs size file"
#~ msgstr "konnte Größe der Sysfs-Datei nicht lesen"
#~ msgid "failed to open block device"
#~ msgstr "konnte Blockgerät nicht öffnen"
#~ msgid "failed to determine size of block device"
#~ msgstr "konnte Größe des Blockgeräts nicht ermitteln"
#~ msgid "option structure allocation failed"
#~ msgstr "Speicherzuweisung für `option' fehlgeschlagen"
#~ msgid "option structure argv allocation failed"
#~ msgstr "Speicherzuweisung für `argv' der Option fehlgeschlagen"
#~ msgid "failed to get terminal name"
#~ msgstr "konnte Terminalname nicht lesen"
#~ msgid "lock attempt failed"
#~ msgstr "Sperrversuch fehlgeschlagen"
#~ msgid "failed to open terminal"
#~ msgstr "konnte Terminal nicht öffnen"
#~ msgid "failed to seek to start of output"
#~ msgstr "Konnte nicht zum Anfang der Ausgabe springen"
#~ msgid "failed to read file"
#~ msgstr "konnte Datei nicht lesen"
#~ msgid "failed to stat output file"
#~ msgstr "konnte Dateiinformationen für Ausgabe-Datei nicht lesen"
#~ msgid "history structure allocation failed"
#~ msgstr "Speicherzuweisung für `history' fehlgeschlagen"
#~ msgid "file list allocation failed"
#~ msgstr "Speicherzuweisung für die Dateiliste fehlgeschlagen"
#~ msgid "read failed"
#~ msgstr "read-Aufruf fehlgeschlagen"
#~ msgid "file is not seekable"
#~ msgstr "Datei ist nicht durchsuchbar"
#~ msgid "failed to seek past error"
#~ msgstr "konnte den Fehler nicht überwinden"
#~ msgid "no transfer buffer allocated"
#~ msgstr "Speicherzuweisung für den Transferpuffer fehlgeschlagen"
#~ msgid "failed to set interval timer"
#~ msgstr "konnte Intervall-Timer nicht setzen"
#~ msgid "failed to clear interval timer"
#~ msgstr "konnte Intervall-Timer nicht löschen"
#~ msgid "line position buffer allocation failed"
#~ msgstr "Zuweisung des Zeilenpuffers fehlgeschlagen"
#~ msgid "select call failed"
#~ msgstr "select-Aufruf fehlgeschlagen"
#~ msgid "PID[:FD]"
#~ msgstr "PID[:FD]"
+615
View File
@@ -0,0 +1,615 @@
msgid ""
msgstr ""
"Project-Id-Version: pv 1.9.34\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2026-08-01 14:53+0100\n"
"PO-Revision-Date: 2026-03-24 23:25+0000\n"
"Last-Translator: Ricky-Tigg <ricky-tigg@noreply.codeberg.org>\n"
"Language-Team: Finnish <https://translate.codeberg.org/projects/pv/pv/fi/>\n"
"Language: fi\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.16.2\n"
#: src/main/help.c:300
msgid "show progress bar"
msgstr "näytä edistymispalkki"
#: src/main/help.c:303
msgid "show elapsed time"
msgstr "näytä kulunut aika"
#: src/main/help.c:306
msgid "show estimated time of arrival (completion)"
msgstr "näytä arvioitu valmistumisaika"
#: src/main/help.c:309
msgid "show absolute estimated time of arrival (completion)"
msgstr "näytä absoluuttinen arvioitu valmistumisaika"
#: src/main/help.c:312
msgid "show data transfer rate counter"
msgstr "näytä datan siirtonopeuden laskuri"
#: src/main/help.c:315
msgid "show data transfer average rate counter"
msgstr "näytä datan keskimääräisen siirtonopeuden laskuri"
#: src/main/help.c:318
msgid "show number of bytes transferred"
msgstr "näytä siirrettyjen tavujen määrä"
#: src/main/help.c:321
msgid "show percentage of transfer buffer in use"
msgstr "näytä käytössä olevan siirtopuskurin prosenttiosuus"
#: src/main/help.c:323
msgid "NUM"
msgstr "NUM"
#: src/main/help.c:324
msgid "show NUM bytes last written"
msgstr "näytä NUM viimeksi kirjoitettua tavua"
#: src/main/help.c:326
msgid "FORMAT"
msgstr "MUOTO"
#: src/main/help.c:327
msgid "set output format to FORMAT"
msgstr "aseta tulostemuodoksi MUOTO"
#: src/main/help.c:330
msgid "output percentages, not visual information"
msgstr "tulosta prosentit, ei visuaalista tietoa"
#: src/main/help.c:333
msgid "do not output any transfer information at all"
msgstr "älä tulosta minkäänlaista siirtotietoa"
#: src/main/help.c:337
msgid "show number of bits transferred"
msgstr "näytä siirrettyjen bittien määrä"
#: src/main/help.c:340
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr "käsittele päätteitä 1000:n kertoimina 1024:n sijaan"
#: src/main/help.c:343
msgid "display nothing until first byte transferred"
msgstr "älä näytä mitään, ennen kuin ensimmäinen tavu on siirretty"
#: src/main/help.c:345 src/main/help.c:360 src/main/help.c:363
msgid "SEC"
msgstr "SEK"
#: src/main/help.c:346
msgid "display nothing until SEC seconds have passed"
msgstr "älä näytä mitään, ennen kuin SEC sekuntia on kulunut"
#: src/main/help.c:348
msgid "SIZE"
msgstr "KOKO"
#: src/main/help.c:349
msgid "set estimated data size to SIZE bytes"
msgstr "aseta arvioiduksi datan kooksi KOKO tavua"
#: src/main/help.c:352
msgid "if size unknown, show rate vs max rate"
msgstr "Jos kokoa ei tiedetä, näytä nopeus vs. maksiminopeus"
#: src/main/help.c:355
msgid "count lines instead of bytes"
msgstr "laske rivit tavujen sijaan"
#: src/main/help.c:358
msgid "lines are null-terminated"
msgstr "rivit päättyvät nullilla"
#: src/main/help.c:361
msgid "update every SEC seconds"
msgstr "päivitä SEC sekunnin välein"
#: src/main/help.c:364
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr "laske keskimääräinen siirtonopeus SEC sekunnin ajalta (oletus 30 s)"
#: src/main/help.c:366
msgid "WIDTH"
msgstr "LEVEYS"
#: src/main/help.c:367
msgid "assume terminal is WIDTH characters wide"
msgstr "oleta, että päätteen LEVEYS on merkkiä leveä"
#: src/main/help.c:369
msgid "HEIGHT"
msgstr "KORKEUS"
#: src/main/help.c:370
msgid "assume terminal is HEIGHT rows high"
msgstr "oleta, että päätteen KORKEUS on merkkiä korkea"
#: src/main/help.c:372
msgid "NAME"
msgstr "NIMI"
#: src/main/help.c:373
msgid "prefix visual information with NAME"
msgstr "lisää visuaalisiin tietoihin NIMI-etuliite"
#: src/main/help.c:375
msgid "STYLE"
msgstr "TYYLI"
#: src/main/help.c:376
msgid "set default bar style to STYLE"
msgstr "aseta oletuspalkkityyli TYYLI:lle"
#: src/main/help.c:378
msgid "SPEC"
msgstr ""
#: src/main/help.c:379
msgid "also send progress to SPEC"
msgstr "lähetä edistyminen myös SPECille"
#: src/main/help.c:382
msgid "set terminal progress state with OSC 9;4 (ConEmu)"
msgstr ""
#: src/main/help.c:385
msgid "output transfer statistics at the end"
msgstr "tulosta siirtotilastot lopussa"
#: src/main/help.c:388
msgid "output even if standard error is not a terminal"
msgstr "tuloste, vaikka vakiovirhe ei olisikaan päätelaite"
#: src/main/help.c:391
msgid "use cursor positioning escape sequences"
msgstr "käytä kohdistimen sijoittelun esc-sekvenssiä"
#: src/main/help.c:394 src/main/help.c:430 src/main/help.c:449
#: src/main/help.c:459
msgid "FILE"
msgstr "TIEDOSTO"
#: src/main/help.c:395
msgid "write output to FILE instead of stdout"
msgstr "kirjoita tuloste tiedostoon TIEDOSTO oletustulosteen (stdout) sijaan"
#: src/main/help.c:397
msgid "RATE"
msgstr "NOPEUS"
#: src/main/help.c:398
msgid "limit transfer to RATE bytes per second"
msgstr "rajoita siirron nopeudeksi NOPEUS tavua per sekunti"
#: src/main/help.c:400 src/main/help.c:406 src/main/help.c:412
msgid "BYTES"
msgstr "TAVUT"
#: src/main/help.c:401
msgid "use a buffer size of BYTES"
msgstr "käytä puskuria, jonka koko on TAVUT"
#: src/main/help.c:404
msgid "never use splice(), always use read/write"
msgstr "Älä koskaan käytä splice():tta, käytä aina luku-/kirjoitustoimintoa"
#: src/main/help.c:407
msgid "set the pipe buffer size to BYTES"
msgstr ""
#: src/main/help.c:410
msgid "skip read errors in input"
msgstr "ohita lukuvirheet syötteessä"
#: src/main/help.c:413
msgid "skip errors in BYTES blocks at a time"
msgstr "ohita virheet TAVUT:ssa lohkoissa kerrallaan"
#: src/main/help.c:416
msgid "stop after --size bytes have been transferred"
msgstr "lopeta kun --size tavua on siirretty"
#: src/main/help.c:419
msgid "flush cache to disk after every write"
msgstr "tyhjennä välimuisti levylle jokaisen kirjoituksen jälkeen"
#: src/main/help.c:422
msgid "use direct I/O to bypass cache"
msgstr "käytä suoraa syötettä/lähtöä välimuistin ohittamiseen"
#: src/main/help.c:425
msgid "try to seek instead of writing null bytes"
msgstr "yritä etsiä tyhjätavujen kirjoittamisen sijaan"
#: src/main/help.c:428
msgid "discard input instead of writing to output"
msgstr "hylkää syöte tulosteeseen kirjoittamisen sijaan"
#: src/main/help.c:431
msgid "write all input to FILE before writing to output"
msgstr ""
"kirjoita kaikki syöte tiedostoon TIEDOSTO ennen tulosteeseen kirjoittamista"
#: src/main/help.c:434
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr "PID[:FD]|=NIMI|@LISTATIEDOSTO"
#: src/main/help.c:435
msgid "watch file FD opened by process PID"
msgstr "tarkkaile tiedostoa FD, jonka prosessi PID avasi"
#: src/main/help.c:438 src/main/help.c:441
msgid "PID"
msgstr ""
#: src/main/help.c:439
msgid "update settings of process PID"
msgstr "päivitä prosessin PID-asetukset"
#: src/main/help.c:442
msgid "show progress of process PID"
msgstr "näytä prosessin PID:n edistyminen"
#: src/main/help.c:446
msgid "run a command and monitor its standard input, output, or both"
msgstr ""
#: src/main/help.c:450
msgid "save process ID in FILE"
msgstr "tallenna prosessitunnus TIEDOSTO:on"
#: src/main/help.c:453
msgid "show this help and exit"
msgstr "näytä tämä ohje ja lopeta"
#: src/main/help.c:456
msgid "show version information and exit"
msgstr "näytä versiotiedot ja lopeta"
#: src/main/help.c:460
msgid "write debug logs to FILE"
msgstr "kirjoita vianjäljityslokit tiedostoon TIEDOSTO"
#: src/main/help.c:486
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Käyttö: %s [VALINTA] [TIEDOSTO]..."
#: src/main/help.c:497
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Putkita TIEDOSTO(t), tai vakiosyöte, vakiotulosteeseen, monitoroinnin kanssa."
#: src/main/help.c:639
msgid "Supported format sequences:"
msgstr "Tuetut muotosekvenssit:"
#: src/main/help.c:653
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Ilmoita ongelmista: %s"
#: src/main/main.c:225
msgid "(input)"
msgstr "(syöte)"
#: src/main/main.c:381 src/main/options.c:1359
msgid "a command to run must be specified"
msgstr ""
#: src/main/main.c:704 src/main/options.c:757 src/main/options.c:777
#: src/pv/display.c:1086 src/pv/state.c:45 src/pv/state.c:902
#: src/pv/state.c:914 src/pv/state.c:950 src/pv/transfer.c:1335
#: src/pv/transfer.c:1451 src/pv/transfer.c:1778
msgid "memory allocation failure"
msgstr "muistinvarausvirhe"
#: src/main/options.c:418
msgid "list files may not contain @ lines"
msgstr "Listatiedostot eivät saa sisältää @-rivejä"
#: src/main/options.c:438 src/main/options.c:440 src/main/options.c:901
msgid "process ID or pid:fd pair expected"
msgstr "prosessitunnusta tai pid:fd-paria odotetaan"
#: src/main/options.c:449 src/main/options.c:451 src/main/options.c:908
msgid "invalid process ID"
msgstr "virheellinen prosessin ID"
#: src/main/options.c:829
msgid "numeric value not understood"
msgstr "numeerista arvoa ei ymmärretty"
#: src/main/options.c:843
msgid "integer argument expected"
msgstr "kokonaislukuargumenttia odotetaan"
#: src/main/options.c:853
msgid "numeric argument expected"
msgstr "numeerista argumenttia odotetaan"
#: src/main/options.c:864
msgid "missing filename"
msgstr "puuttuva tiedostonimi"
#: src/main/options.c:890
msgid "missing process name"
msgstr "puuttuva prosessinimi"
#: src/main/options.c:1182
msgid "invalid side specification"
msgstr ""
#: src/main/options.c:1197
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Suorita `%s --help' saadaksesi lisätietoja."
#: src/main/options.c:1199
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Suorita `%s -h' saadaksesi lisätietoja."
#: src/main/options.c:1231
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
"rivitilaa tai siirtomuokkausvaihtoehtoja ei voi käyttää tiedostokuvauksia "
"tarkasteltaessa"
#: src/main/options.c:1239
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
"kohdistimen sijoittelua ei voi käyttää tiedostokuvauksia tarkasteltaessa"
#: src/main/options.c:1247
msgid "cannot use remote control when watching file descriptors"
msgstr "etäohjausta ei voi käyttää tiedostokuvauksia tarkasteltaessa"
#: src/main/options.c:1255
msgid "cannot use remote query when watching file descriptors"
msgstr "etäkyselyä ei voi käyttää tiedostokuvauksia tarkasteltaessa"
#: src/main/options.c:1263
msgid "cannot transfer files when watching file descriptors"
msgstr "tiedostoja ei voi siirtää tiedostokuvauksia tarkasteltaessa"
#: src/main/options.c:1287
msgid "not available on systems without /proc/self/fdinfo"
msgstr "ei saatavilla järjestelmissä, joissa ei ole /proc/self/fdinfo"
#: src/main/options.c:1298
msgid "cannot use remote control and remote query together"
msgstr "etäohjausta ja etäkyselyä ei voi käyttää yhdessä"
#: src/main/options.c:1325
msgid "monitor mode cannot be specified with this option"
msgstr ""
#: src/main/options.c:1337
msgid "monitor mode cannot be used with store-and-forward"
msgstr ""
#: src/main/options.c:1348
msgid "files cannot be specified with this option"
msgstr "tiedostoja ei voi määrittää tämän vaihtoehdon kanssa"
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
msgstr "Lisenssi: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
#: src/main/version.c:29
msgid "This is free software: you are free to change and redistribute it."
msgstr ""
"Tämä on ilmaista ohjelmistoa: voit vapaasti muokata sitä ja levittää sitä "
"uudelleen."
#: src/main/version.c:30
msgid "There is NO WARRANTY, to the extent permitted by law."
msgstr "TAKUUTA EI OLE, lain sallimissa rajoissa."
#: src/main/version.c:32
msgid "Project web site"
msgstr "Projektin verkkosivu"
#: src/pv/cursor.c:108 src/pv/cursor.c:135
msgid "failed to open lock file"
msgstr "lukitustiedoston avaaminen epäonnistui"
#: src/pv/cursor.c:790 src/pv/cursor.c:792
msgid "interrupted by a signal"
msgstr "signaalin keskeyttämä"
#: src/pv/display.c:311
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:329
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/file.c:81
msgid "/dev/null is not usable"
msgstr ""
#: src/pv/file.c:371
msgid "error closing file"
msgstr "virhe tiedoston sulkemisessa"
#: src/pv/file.c:438
msgid "input file is also the output"
msgstr "syötetiedosto on myös tuotostiedosto"
#: src/pv/file.c:596
msgid "(none)"
msgstr "(ei mitään)"
#: src/pv/file.c:598
msgid "(stdin)"
msgstr ""
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:181
msgid "b/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:181
msgid "B/s"
msgstr "T/s"
#: src/pv/format/bytes.c:35
msgid "b"
msgstr ""
#: src/pv/format/bytes.c:39 src/pv/transfer.c:1284
msgid "B"
msgstr "T"
#: src/pv/format/eta.c:63 src/pv/format/eta.c:67
msgid "ETA"
msgstr ""
#: src/pv/format/fineta.c:93
msgid "FIN"
msgstr ""
#: src/pv/loop.c:180
msgid "rate min/avg/max/mdev"
msgstr ""
#: src/pv/loop.c:192
msgid "rate not measured"
msgstr "nopeutta ei mitattu"
#: src/pv/loop.c:1098 src/pv/loop.c:1114 src/pv/loop.c:1132 src/pv/remote.c:93
#: src/pv/remote.c:188 src/pv/remote.c:536 src/pv/remote.c:582
#: src/pv/watchpid.c:123 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:158 src/pv/watchpid.c:194
#: src/pv/watchpid.c:206 src/pv/watchpid.c:218 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:286 src/pv/watchpid.c:401
#: src/pv/watchpid.c:409 src/pv/watchpid.c:556 src/pv/watchpid.c:565
#: src/pv/watchpid.c:586
msgid "pid"
msgstr ""
#: src/pv/loop.c:1132 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:160 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:288
msgid "fd"
msgstr ""
#: src/pv/remote.c:242 src/pv/remote.c:636
msgid "message not received"
msgstr "viestiä ei vastaanotettu"
#: src/pv/remote.c:659 src/pv/remote.c:677
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO ei ole tuettu tässä järjestelmässä"
#: src/pv/transfer.c:1173
msgid "warning: read errors detected"
msgstr "varoitus: lukuvirheitä havaittu"
#: src/pv/transfer.c:1283
msgid "skipped past read error"
msgstr "aiempi lukuvirhe ohitettu"
#: src/pv/transfer.c:1642
msgid "write error"
msgstr "kirjoitusvirhe"
#: src/pv/watchpid.c:160 src/pv/watchpid.c:288
msgid "not a regular file or block device"
msgstr "ei tavallinen tiedosto tai lohkolaite"
#~ msgid "state allocation failed"
#~ msgstr "tilan allokointi epäonnistui"
#~ msgid "failed to stat file"
#~ msgstr "tiedoston tilastointi epäonnistui"
#~ msgid "is a directory"
#~ msgstr "on hakemisto"
#~ msgid "failed to generate sysfs filename"
#~ msgstr "sysfs-tiedostonimen luominen epäonnistui"
#~ msgid "failed to read sysfs size file"
#~ msgstr "sysfs-kokotiedoston lukeminen epäonnistui"
#~ msgid "failed to open block device"
#~ msgstr "lohkolaitteen avaaminen epäonnistui"
#~ msgid "failed to determine size of block device"
#~ msgstr "lohkolaitteen koon päättely epäonnistui"
#~ msgid "option structure allocation failed"
#~ msgstr "vaihtoehtorakenteen allokointi epäonnistui"
#~ msgid "option structure argv allocation failed"
#~ msgstr "vaihtoehtorakenteen argv:n allokointi epäonnistui"
#~ msgid "failed to get terminal name"
#~ msgstr "päätelaitteen nimen hakeminen epäonnistui"
#~ msgid "lock attempt failed"
#~ msgstr "lukitusyritys epäonnistui"
#~ msgid "failed to open terminal"
#~ msgstr "päätelaitteen avaaminen epäonnistui"
#~ msgid "failed to seek to start of output"
#~ msgstr "tulosteen käynnistyksen hakeminen epäonnistui"
#~ msgid "failed to read file"
#~ msgstr "tiedoston lukeminen epäonnistui"
#~ msgid "failed to stat output file"
#~ msgstr "tulostiedoston tilastointi epäonnistui"
#~ msgid "history structure allocation failed"
#~ msgstr "historiarakenteen allokointi epäonnistui"
#~ msgid "file list allocation failed"
#~ msgstr "tiedostolistan allokointi epäonnistui"
#~ msgid "read failed"
#~ msgstr "luku epäonnistui"
#~ msgid "file is not seekable"
#~ msgstr "tiedosto ei ole haettavissa"
#~ msgid "failed to seek past error"
#~ msgstr "menneen virheen hakeminen epäonnistui"
#~ msgid "no transfer buffer allocated"
#~ msgstr "siirtopuskuria ei ole allokoitu"
#~ msgid "failed to set interval timer"
#~ msgstr "aikaväliajastimen asettaminen epäonnistui"
#~ msgid "failed to clear interval timer"
#~ msgstr "aikaväliajastimen tyhjennys epäonnistui"
#~ msgid "line position buffer allocation failed"
#~ msgstr "rivin sijaintipuskurin allokointi epäonnistui"
#~ msgid "select call failed"
#~ msgstr "valintakutsu epäonnistui"
+456 -303
View File
@@ -1,16 +1,22 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-04-21 14:15+0100\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2026-08-01 14:53+0100\n"
"PO-Revision-Date: 2026-08-01 18:32+0000\n"
"Last-Translator: a-j-wood <a-j-wood@noreply.codeberg.org>\n"
"Language-Team: French <https://translate.codeberg.org/projects/pv/pv/fr/>\n"
"Language: fr\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 2026.7.1\n"
"Date: 1999-06-01 15:18:29+0100\n"
"From: Andrew Wood <ivarch@ubik>\n"
"Xgettext-Options: --default-domain=pkgbuild --directory=./.pkgdir --add-"
"comments --keyword=_ --keyword=N_\n"
"Files: src/getopt/getopt.c src/getopt/getopt1.c src/version.c src/main/init."
"c src/main/help.c src/main/xpmptr.c src/guts/load.c src/guts/stop.c src/guts/"
"configure.c src/guts/make.c src/guts/install.c src/guts/prefs.c src/ui/"
"Files: src/getopt/getopt.c src/getopt/getopt1.c src/version.c src/main/"
"init.c src/main/help.c src/main/xpmptr.c src/guts/load.c src/guts/stop.c src/"
"guts/configure.c src/guts/make.c src/guts/install.c src/guts/prefs.c src/ui/"
"generate.c src/ui/main.c src/ui/xpm.c src/ui/status.c src/ui/activate.c src/"
"ui/handlers/main.c src/ui/handlers/package.c src/ui/handlers/prefs.c src/ui/"
"handlers/dirsel.c src/ui/handlers/popup.c src/ui/handlers/help.c src/ui/"
@@ -20,280 +26,360 @@ msgstr ""
"nls/intl/textdomain.c src/nls/intl-cat/cat-compat.c src/nls/intl-gett/intl-"
"compat.c\n"
#: src/main/help.c:284
#: src/main/help.c:300
msgid "show progress bar"
msgstr "afficher la barre de progression"
#: src/main/help.c:287
#: src/main/help.c:303
msgid "show elapsed time"
msgstr "afficher le temps écoulé"
#: src/main/help.c:290
#: src/main/help.c:306
msgid "show estimated time of arrival (completion)"
msgstr "afficher l'heure approximative de l'achèvement de la tâche"
#: src/main/help.c:293
#: src/main/help.c:309
msgid "show absolute estimated time of arrival (completion)"
msgstr "afficher l'heure absolute de l'achèvement de la tâche"
#: src/main/help.c:296
#: src/main/help.c:312
msgid "show data transfer rate counter"
msgstr "afficher le taux de tranfert des données"
#: src/main/help.c:299
#: src/main/help.c:315
msgid "show data transfer average rate counter"
msgstr "afficher le compteur de taux moyen de transfert de données"
#: src/main/help.c:301 src/main/help.c:332 src/main/help.c:344
#: src/main/help.c:318
msgid "show number of bytes transferred"
msgstr "afficher le nombre d'octets transférés"
#: src/main/help.c:321
msgid "show percentage of transfer buffer in use"
msgstr "afficher le pourcentage de tampon de transfert utilisé"
#: src/main/help.c:323
msgid "NUM"
msgstr "NUM"
#: src/main/help.c:324
msgid "show NUM bytes last written"
msgstr "afficher les derniers NUM octets écrits"
#: src/main/help.c:326
msgid "FORMAT"
msgstr "FORMAT"
#: src/main/help.c:327
msgid "set output format to FORMAT"
msgstr "définir le format de sortie sur FORMAT"
#: src/main/help.c:330
msgid "output percentages, not visual information"
msgstr "imprimer en pourcentage plutôt que des informations visuelles"
#: src/main/help.c:333
msgid "do not output any transfer information at all"
msgstr "n'afficher aucune information de transfert"
#: src/main/help.c:337
msgid "show number of bits transferred"
msgstr "afficher le nombre de bits transférés"
#: src/main/help.c:340
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr "traiter les suffixes comme des multiples de 1000 au lieu de 1024"
#: src/main/help.c:343
msgid "display nothing until first byte transferred"
msgstr "ne rien afficher avant qu'au moins un octet soit tranféré"
#: src/main/help.c:345 src/main/help.c:360 src/main/help.c:363
msgid "SEC"
msgstr "SEC"
#: src/main/help.c:302
#: src/main/help.c:346
msgid "display nothing until SEC seconds have passed"
msgstr "ne rien afficher jusqu'à ce que SEC secondes se soient écoulées"
#: src/main/help.c:348
msgid "SIZE"
msgstr "TAILLE"
#: src/main/help.c:349
msgid "set estimated data size to SIZE bytes"
msgstr "ajuster la taille estimée des données à TAILLE octets"
#: src/main/help.c:352
msgid "if size unknown, show rate vs max rate"
msgstr ""
"si la taille est inconnue, afficher le taux de transfert par rapport au taux "
"de transfert max"
#: src/main/help.c:355
msgid "count lines instead of bytes"
msgstr "compter les lignes au lieu des octets"
#: src/main/help.c:358
msgid "lines are null-terminated"
msgstr "les lignes sont terminées par un caractère nul"
#: src/main/help.c:361
msgid "update every SEC seconds"
msgstr "mettre à jour toutes les SEC secondes"
#: src/main/help.c:364
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
"calculer le taux moyen d'après les SEC dernières secondes (30s par défaut)"
#: src/main/help.c:305
msgid "show number of bytes transferred"
msgstr "afficher le nombre d'octets transférés"
#: src/main/help.c:308
msgid "show number of bits transferred"
msgstr "afficher le nombre de bits transférés"
#: src/main/help.c:311
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr ""
#: src/main/help.c:314
msgid "show percentage of transfer buffer in use"
msgstr "afficher le pourcentage de tampon de transfert utilisé"
#: src/main/help.c:316
msgid "NUM"
msgstr "NUM"
#: src/main/help.c:317
msgid "show NUM bytes last written"
msgstr "afficher les derniers NUM octets écrits"
#: src/main/help.c:319
msgid "FORMAT"
msgstr "FORMAT"
#: src/main/help.c:320
msgid "set output format to FORMAT"
msgstr "définir le format de sortie sur FORMAT"
#: src/main/help.c:323
msgid "output percentages, not visual information"
msgstr "imprimer en pourcentage plutôt que des informations visuelles"
#: src/main/help.c:326
msgid "do not output any transfer information at all"
msgstr "n'afficher aucune information de transfert"
#: src/main/help.c:330
msgid "display nothing until first byte transferred"
msgstr "ne rien afficher avant qu'au moins un octet soit tranféré"
#: src/main/help.c:333
msgid "display nothing until SEC seconds have passed"
msgstr "ne rien afficher jusqu'à ce que SEC secondes se soient écoulées"
#: src/main/help.c:335
msgid "SIZE"
msgstr "TAILLE"
#: src/main/help.c:336
msgid "set estimated data size to SIZE bytes"
msgstr "ajuster la taille estimée des données à TAILLE octets"
#: src/main/help.c:339
msgid "count lines instead of bytes"
msgstr "compter les lignes au lieu des octets"
#: src/main/help.c:342
msgid "lines are null-terminated"
msgstr "les lignes sont terminées par un caractère nul"
#: src/main/help.c:345
msgid "update every SEC seconds"
msgstr "mettre à jour toutes les SEC secondes"
#: src/main/help.c:347
#: src/main/help.c:366
msgid "WIDTH"
msgstr "LARGEUR"
#: src/main/help.c:348
#: src/main/help.c:367
msgid "assume terminal is WIDTH characters wide"
msgstr "présumer la largeur du terminal à LARGEUR caractères"
#: src/main/help.c:350
#: src/main/help.c:369
msgid "HEIGHT"
msgstr "HAUTEUR"
#: src/main/help.c:351
#: src/main/help.c:370
msgid "assume terminal is HEIGHT rows high"
msgstr "présumer la hauteur du terminal à HAUTEUR lignes"
#: src/main/help.c:353
#: src/main/help.c:372
msgid "NAME"
msgstr "NOM"
#: src/main/help.c:354
#: src/main/help.c:373
msgid "prefix visual information with NAME"
msgstr "préfixer les informations visuelles avec NOM"
#: src/main/help.c:357
#: src/main/help.c:375
msgid "STYLE"
msgstr "STYLE"
#: src/main/help.c:376
msgid "set default bar style to STYLE"
msgstr "définir le style de barre par défaut à STYLE"
#: src/main/help.c:378
msgid "SPEC"
msgstr "SPÉCIFICATION"
#: src/main/help.c:379
msgid "also send progress to SPEC"
msgstr "aussi envoyer la progression à SPÉCIFICATION"
#: src/main/help.c:382
msgid "set terminal progress state with OSC 9;4 (ConEmu)"
msgstr "mettre à jour l'état de progression du terminal avec OSC 9;4 (ConEmu)"
#: src/main/help.c:385
msgid "output transfer statistics at the end"
msgstr "afficher les statistiques de transfert à la fin"
#: src/main/help.c:388
msgid "output even if standard error is not a terminal"
msgstr ""
"imprimer vers la sortie d'erreur standard même si ce n'est pas un terminal"
#: src/main/help.c:360
#: src/main/help.c:391
msgid "use cursor positioning escape sequences"
msgstr "utiliser les séquences d'échappements de positionnement de curseur"
#: src/main/help.c:363
msgid "RATE"
msgstr "TAUX"
#: src/main/help.c:364
msgid "limit transfer to RATE bytes per second"
msgstr "limite le taux de transfert à TAUX octets par seconde"
#: src/main/help.c:366 src/main/help.c:375
msgid "BYTES"
msgstr "OCTETS"
#: src/main/help.c:367
msgid "use a buffer size of BYTES"
msgstr "Utiliser une mémoire tampon de OCTETS octets"
#: src/main/help.c:370
msgid "never use splice(), always use read/write"
msgstr "ne jamais utiliser splice(), toujours utiliser read/write"
#: src/main/help.c:373
msgid "skip read errors in input"
msgstr "ignorer les erreurs de lecture dans l'entrée"
#: src/main/help.c:376
msgid "skip errors in BYTES blocks at a time"
msgstr "ignorer les erreurs dans OCTETS blocs à la fois"
#: src/main/help.c:379
msgid "stop after --size bytes have been transferred"
msgstr "arrêter après le transfert de --size octets"
#: src/main/help.c:382
msgid "flush cache to disk after every write"
msgstr "vider le cache sur le disque après chaque écriture"
#: src/main/help.c:385
msgid "use direct I/O to bypass cache"
msgstr "utiliser les E/S directes pour contourner le cache"
#: src/main/help.c:388
msgid "discard input instead of writing to output"
msgstr "rejeter l'entrée au lieu de l'écrire vers la sortie"
#: src/main/help.c:391
msgid "PID"
msgstr "PID"
#: src/main/help.c:392
msgid "update settings of process PID"
msgstr "mettre à jour la configuration du processus PID"
#: src/main/help.c:396 src/main/help.c:411
#: src/main/help.c:394 src/main/help.c:430 src/main/help.c:449
#: src/main/help.c:459
msgid "FILE"
msgstr "FICHIER"
#: src/main/help.c:397
msgid "save process ID in FILE"
msgstr "enregistrer l'ID de processus dans FICHIER"
#: src/main/help.c:395
msgid "write output to FILE instead of stdout"
msgstr "écrire la sortie dans FICHIER au lieu de la sortie standard"
#: src/main/help.c:400
msgid "PID[:FD]"
msgstr "PID[:FD]"
#: src/main/help.c:397
msgid "RATE"
msgstr "TAUX"
#: src/main/help.c:398
msgid "limit transfer to RATE bytes per second"
msgstr "limite le taux de transfert à TAUX octets par seconde"
#: src/main/help.c:400 src/main/help.c:406 src/main/help.c:412
msgid "BYTES"
msgstr "OCTETS"
#: src/main/help.c:401
msgid "use a buffer size of BYTES"
msgstr "utiliser une mémoire tampon de OCTETS octets"
#: src/main/help.c:404
msgid "never use splice(), always use read/write"
msgstr "ne jamais utiliser splice(), toujours utiliser read/write"
#: src/main/help.c:407
msgid "set the pipe buffer size to BYTES"
msgstr "définir la taille du tampon de mémoire du tube à OCTETS octets"
#: src/main/help.c:410
msgid "skip read errors in input"
msgstr "ignorer les erreurs de lecture dans l'entrée"
#: src/main/help.c:413
msgid "skip errors in BYTES blocks at a time"
msgstr "ignorer les erreurs dans OCTETS blocs à la fois"
#: src/main/help.c:416
msgid "stop after --size bytes have been transferred"
msgstr "arrêter après le transfert de --size octets"
#: src/main/help.c:419
msgid "flush cache to disk after every write"
msgstr "vider le cache sur le disque après chaque écriture"
#: src/main/help.c:422
msgid "use direct I/O to bypass cache"
msgstr "utiliser les E/S directes pour contourner le cache"
#: src/main/help.c:425
msgid "try to seek instead of writing null bytes"
msgstr "écrire des trous dans le fichier au lieu d'octets nuls"
#: src/main/help.c:428
msgid "discard input instead of writing to output"
msgstr "rejeter l'entrée au lieu de l'écrire vers la sortie"
#: src/main/help.c:431
msgid "write all input to FILE before writing to output"
msgstr "écrire toute l'entrée vers FICHIER avant de l'écrire vers la sortie"
#: src/main/help.c:434
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr "PID[:FD]|=NOM|@FICHIER"
#: src/main/help.c:435
msgid "watch file FD opened by process PID"
msgstr "surveiller le fichier FD ouvert par le processus PID"
#: src/main/help.c:405
#: src/main/help.c:438 src/main/help.c:441
msgid "PID"
msgstr "PID"
#: src/main/help.c:439
msgid "update settings of process PID"
msgstr "mettre à jour la configuration du processus PID"
#: src/main/help.c:442
msgid "show progress of process PID"
msgstr "afficher la progression du processus PID"
#: src/main/help.c:446
msgid "run a command and monitor its standard input, output, or both"
msgstr ""
"exécuter une commande et surveiller son entrée standard, sa sortie ou les "
"deux"
#: src/main/help.c:450
msgid "save process ID in FILE"
msgstr "enregistrer l'ID de processus dans FICHIER"
#: src/main/help.c:453
msgid "show this help and exit"
msgstr "afficher cette aide puis quitter"
#: src/main/help.c:408
#: src/main/help.c:456
msgid "show version information and exit"
msgstr "afficher la version puis quitter"
#: src/main/help.c:412
#: src/main/help.c:460
msgid "write debug logs to FILE"
msgstr "écrire les journaux de déboggage vers FICHIER"
#: src/main/help.c:437
#: src/main/help.c:486
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Utilisation : %s [OPTIONS] [FICHIER]..."
#: src/main/help.c:448
#: src/main/help.c:497
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Concaténer FICHIER(s), ou l'entrée standard, sur la sortie standard avec "
"monitorage."
#: src/main/help.c:585
#: src/main/help.c:639
msgid "Supported format sequences:"
msgstr "Séquences de formatage supportées :"
#: src/main/help.c:653
#, c-format
msgid "Please report any bugs to: %s"
msgstr "SVP rapporter tous bogues à %s"
#: src/main/main.c:74
msgid "state allocation failed"
msgstr "échec de l'allocation de mémoire de condition"
#: src/main/main.c:225
msgid "(input)"
msgstr "(entrée)"
#: src/main/options.c:174
msgid "option structure allocation failed"
msgstr "l'allocation pour la structure d'une option a échoué"
#: src/main/main.c:381 src/main/options.c:1359
msgid "a command to run must be specified"
msgstr "une commande à exécuter doit être spécifiée"
#: src/main/options.c:193
msgid "option structure argv allocation failed"
msgstr "l'allocation pour la structure de l'option argv a échoué"
#: src/main/main.c:704 src/main/options.c:757 src/main/options.c:777
#: src/pv/display.c:1086 src/pv/state.c:45 src/pv/state.c:902
#: src/pv/state.c:914 src/pv/state.c:950 src/pv/transfer.c:1335
#: src/pv/transfer.c:1451 src/pv/transfer.c:1778
msgid "memory allocation failure"
msgstr "échec d'allocation mémoire"
#: src/main/options.c:255
msgid "integer argument expected"
msgstr "Valeur entière attendue"
#: src/main/options.c:418
msgid "list files may not contain @ lines"
msgstr "les fichiers de liste ne peuvent pas contenir de lignes « @ »"
#: src/main/options.c:266
msgid "numeric argument expected"
msgstr "Valeur numérique attendue"
#: src/main/options.c:277
#: src/main/options.c:438 src/main/options.c:440 src/main/options.c:901
msgid "process ID or pid:fd pair expected"
msgstr "ID de processus ou paire pid:fd attendue"
#: src/main/options.c:284
#: src/main/options.c:449 src/main/options.c:451 src/main/options.c:908
msgid "invalid process ID"
msgstr "ID de processus non valide"
#: src/main/options.c:388 src/pv/file.c:323
msgid "failed to stat file"
msgstr "échec à statuer sur le fichier"
#: src/main/options.c:829
msgid "numeric value not understood"
msgstr "valeur numérique non comprise"
#: src/main/options.c:491
#: src/main/options.c:843
msgid "integer argument expected"
msgstr "valeur entière attendue"
#: src/main/options.c:853
msgid "numeric argument expected"
msgstr "valeur numérique attendue"
#: src/main/options.c:864
msgid "missing filename"
msgstr "nom de fichier manquant"
#: src/main/options.c:890
msgid "missing process name"
msgstr "nom de processus manquant"
#: src/main/options.c:1182
msgid "invalid side specification"
msgstr "côté inacceptable"
#: src/main/options.c:1197
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Essayez `%s --help' pour plus d'informations."
#: src/main/options.c:493
#: src/main/options.c:1199
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Essayez `%s -h' pour plus d'informations."
#: src/main/options.c:524
#: src/main/options.c:1231
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
@@ -301,39 +387,56 @@ 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:533
#: src/main/options.c:1239
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:542
#: src/main/options.c:1247
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:551
#: src/main/options.c:1255
msgid "cannot use remote query when watching file descriptors"
msgstr ""
"impossible d'utiliser une requête distante lorsque vous regardez des "
"descripteurs de fichiers"
#: src/main/options.c:1263
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:566
#: src/main/options.c:1287
msgid "not available on systems without /proc/self/fdinfo"
msgstr "non disponible sur les systèmes sans /proc/self/fdinfo"
#: src/main/remote.c:302
msgid "message not received"
msgstr "message non reçu"
#: src/main/options.c:1298
msgid "cannot use remote control and remote query together"
msgstr ""
"impossible d'utiliser simultanément le contrôle à distance et "
"l'interrogation à distance"
#: src/main/remote.c:429
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO non pris en charge sur ce système"
#: src/main/options.c:1325
msgid "monitor mode cannot be specified with this option"
msgstr "impossible d'utiliser mode moniteur avec cette option"
#: src/main/options.c:1337
msgid "monitor mode cannot be used with store-and-forward"
msgstr ""
"impossible d'utiliser mode moniteur avec le stockage et la retransmission"
#: src/main/options.c:1348
msgid "files cannot be specified with this option"
msgstr "les fichiers ne peuvent pas être spécifiés avec cette option"
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
msgstr "License : GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
msgstr "License : GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
#: src/main/version.c:29
msgid "This is free software: you are free to change and redistribute it."
@@ -349,150 +452,200 @@ msgstr "Il n'y a AUCUNE GARANTIE, dans la mesure permise par la loi."
msgid "Project web site"
msgstr "Site web du projet"
#: src/pv/cursor.c:87
msgid "failed to get terminal name"
msgstr "échec de lecture du nom du terminal"
#: src/pv/cursor.c:132
#: src/pv/cursor.c:108 src/pv/cursor.c:135
msgid "failed to open lock file"
msgstr "échec de l'ouverture du fichier de verrouillage"
#: src/pv/cursor.c:165
msgid "lock attempt failed"
msgstr "échec de la tentative de verrouillage"
#: src/pv/cursor.c:790 src/pv/cursor.c:792
msgid "interrupted by a signal"
msgstr "interrompu par un signal"
#: src/pv/cursor.c:426
msgid "failed to open terminal"
msgstr "échec de l'ouverture du terminal"
#: src/pv/display.c:193
#: src/pv/display.c:311
msgid "yzafpnum kMGTPEZY"
msgstr ""
msgstr "yzafpnum kMGTPEZY"
#: src/pv/display.c:211
#: src/pv/display.c:329
msgid "yzafpnum KMGTPEZY"
msgstr ""
msgstr "yzafpnum KMGTPEZY"
#: src/pv/display.c:750 src/pv/transfer.c:954
msgid "buffer allocation failed"
msgstr "échec de l'allocation de mémoire tampon"
#: src/pv/file.c:81
msgid "/dev/null is not usable"
msgstr "/dev/null n'est pas utilisable"
#: src/pv/display.c:856
msgid "b"
msgstr ""
#: src/pv/file.c:371
msgid "error closing file"
msgstr "erreur à la fermeture du fichier"
#: src/pv/display.c:859 src/pv/transfer.c:596
msgid "B"
msgstr "O"
#: src/pv/file.c:438
msgid "input file is also the output"
msgstr "le fichier d'entrée est aussi le fichier de sortie"
#: src/pv/display.c:900 src/pv/display.c:916
msgid "b/s"
msgstr ""
#: src/pv/display.c:905 src/pv/display.c:920
msgid "/s"
msgstr "/s"
#: src/pv/display.c:905 src/pv/display.c:920
msgid "B/s"
msgstr "O/s"
#: src/pv/display.c:947 src/pv/display.c:951 src/pv/display.c:1017
msgid "ETA"
msgstr "ETA"
#: src/pv/file.c:148
msgid "failed to seek to start of output"
msgstr "ne peut pas passer au début de la sortie"
#: src/pv/file.c:293
msgid "failed to close file"
msgstr "la fermeture du fichier a échoué"
#: src/pv/file.c:316
msgid "failed to read file"
msgstr "la lecture du fichier a échoué"
#: src/pv/file.c:331
msgid "failed to stat output file"
msgstr "échec à statuer sur le fichier de sortie"
#: src/pv/file.c:353
msgid "input file is output file"
msgstr "fichiers d'entré et de sortie sont les mêmes"
#: src/pv/file.c:411
#: src/pv/file.c:596
msgid "(none)"
msgstr "(aucun)"
#: src/pv/file.c:413
#: src/pv/file.c:598
msgid "(stdin)"
msgstr ""
msgstr "(stdin)"
#: src/pv/loop.c:570 src/pv/loop.c:621 src/pv/loop.c:662 src/pv/watchpid.c:99
#: src/pv/watchpid.c:109 src/pv/watchpid.c:120 src/pv/watchpid.c:128
#: src/pv/watchpid.c:165 src/pv/watchpid.c:184 src/pv/watchpid.c:192
#: src/pv/watchpid.c:202 src/pv/watchpid.c:293 src/pv/watchpid.c:301
#: src/pv/watchpid.c:377 src/pv/watchpid.c:398
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:181
msgid "b/s"
msgstr "b/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr "/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:181
msgid "B/s"
msgstr "O/s"
#: src/pv/format/bytes.c:35
msgid "b"
msgstr "b"
#: src/pv/format/bytes.c:39 src/pv/transfer.c:1284
msgid "B"
msgstr "O"
#: src/pv/format/eta.c:63 src/pv/format/eta.c:67
msgid "ETA"
msgstr "ETA"
#: src/pv/format/fineta.c:93
msgid "FIN"
msgstr "FIN"
#: src/pv/loop.c:180
msgid "rate min/avg/max/mdev"
msgstr "taux min/moy/max/écart-type"
#: src/pv/loop.c:192
msgid "rate not measured"
msgstr "taux non mesuré"
#: src/pv/loop.c:1098 src/pv/loop.c:1114 src/pv/loop.c:1132 src/pv/remote.c:93
#: src/pv/remote.c:188 src/pv/remote.c:536 src/pv/remote.c:582
#: src/pv/watchpid.c:123 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:158 src/pv/watchpid.c:194
#: src/pv/watchpid.c:206 src/pv/watchpid.c:218 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:286 src/pv/watchpid.c:401
#: src/pv/watchpid.c:409 src/pv/watchpid.c:556 src/pv/watchpid.c:565
#: src/pv/watchpid.c:586
msgid "pid"
msgstr ""
msgstr "pid"
#: src/pv/state.c:36
msgid "history structure allocation failed"
msgstr "l'allocation de la structure de l'historique a échoué"
#: src/pv/loop.c:1132 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:160 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:288
msgid "fd"
msgstr "fd"
#: src/pv/state.c:391 src/pv/state.c:402
msgid "file list allocation failed"
msgstr "échec de l'allocation de la liste de fichiers"
#: src/pv/remote.c:242 src/pv/remote.c:636
msgid "message not received"
msgstr "message non reçu"
#: src/pv/transfer.c:458
msgid "read failed"
msgstr "la lecture a échoué"
#: src/pv/remote.c:659 src/pv/remote.c:677
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO non pris en charge sur ce système"
#: src/pv/transfer.c:481
#: src/pv/transfer.c:1173
msgid "warning: read errors detected"
msgstr "avertissement : erreurs de lecture détectées"
#: src/pv/transfer.c:497
msgid "file is not seekable"
msgstr "ne peut pas se déplacer dans le fichier"
#: src/pv/transfer.c:575
msgid "failed to seek past error"
msgstr "n'a pas réussi à dépasser l'erreur"
#: src/pv/transfer.c:595
#: src/pv/transfer.c:1283
msgid "skipped past read error"
msgstr "erreur de lecture dépassée"
#: src/pv/transfer.c:635
msgid "no transfer buffer allocated"
msgstr "aucun tampon de transfert alloué"
#: src/pv/transfer.c:1642
msgid "write error"
msgstr "erreur d'écriture"
#: src/pv/transfer.c:676
msgid "failed to set interval timer"
msgstr ""
#: src/pv/transfer.c:694
msgid "failed to clear interval timer"
msgstr ""
#: src/pv/transfer.c:818
msgid "write failed"
msgstr "l'écriture a échoué"
#: src/pv/transfer.c:1051
msgid "select call failed"
msgstr "l'appel de sélection a échoué"
#: src/pv/watchpid.c:109 src/pv/watchpid.c:121 src/pv/watchpid.c:130
#: src/pv/watchpid.c:184 src/pv/watchpid.c:193 src/pv/watchpid.c:204
msgid "fd"
msgstr ""
#: src/pv/watchpid.c:130 src/pv/watchpid.c:204
#: src/pv/watchpid.c:160 src/pv/watchpid.c:288
msgid "not a regular file or block device"
msgstr "pas un fichier ordinaire ou un périphérique de bloc"
#~ msgid "state allocation failed"
#~ msgstr "échec de l'allocation de mémoire de condition"
#~ msgid "failed to stat file"
#~ msgstr "échec à statuer sur le fichier"
#~ msgid "is a directory"
#~ msgstr "est un répertoire"
#~ msgid "failed to generate sysfs filename"
#~ msgstr "échec de génération du nom de fichier sysfs"
#~ msgid "failed to read sysfs size file"
#~ msgstr "échec de la lecture de la taille du fichier sysfs"
#~ msgid "failed to open block device"
#~ msgstr "échec de l'ouverture du périphérique de bloc"
#~ msgid "failed to determine size of block device"
#~ msgstr "échec de l'évaluation de la taille du périphérique de bloc"
#~ msgid "option structure allocation failed"
#~ msgstr "l'allocation pour la structure d'une option a échoué"
#~ msgid "option structure argv allocation failed"
#~ msgstr "l'allocation pour la structure de l'option argv a échoué"
#~ msgid "failed to get terminal name"
#~ msgstr "échec de lecture du nom du terminal"
#~ msgid "lock attempt failed"
#~ msgstr "échec de la tentative de verrouillage"
#~ msgid "failed to open terminal"
#~ msgstr "échec de l'ouverture du terminal"
#~ msgid "failed to seek to start of output"
#~ msgstr "ne peut pas passer au début de la sortie"
#~ msgid "failed to read file"
#~ msgstr "la lecture du fichier a échoué"
#~ msgid "failed to stat output file"
#~ msgstr "échec à statuer sur le fichier de sortie"
#~ msgid "history structure allocation failed"
#~ msgstr "l'allocation de la structure de l'historique a échoué"
#~ msgid "file list allocation failed"
#~ msgstr "échec de l'allocation de la liste de fichiers"
#~ msgid "read failed"
#~ msgstr "la lecture a échoué"
#~ msgid "file is not seekable"
#~ msgstr "ne peut pas se déplacer dans le fichier"
#~ msgid "failed to seek past error"
#~ msgstr "n'a pas réussi à dépasser l'erreur"
#~ msgid "no transfer buffer allocated"
#~ msgstr "aucun tampon de transfert alloué"
#~ msgid "failed to set interval timer"
#~ msgstr "La définition de l'intervalle du minuteur a échoué"
#~ msgid "failed to clear interval timer"
#~ msgstr "La réinitialisation des intervalles du minuteur a échoué"
#~ msgid "line position buffer allocation failed"
#~ msgstr ""
#~ "L'allocation de la position de la ligne de la mémoire tampon a échoué"
#~ msgid "select call failed"
#~ msgstr "l'appel de sélection a échoué"
#~ msgid "PID[:FD]"
#~ msgstr "PID[:FD]"
#~ msgid "failed to set alarm signal handler"
#~ msgstr "échec de la définition du gestionnaire de signal d'alarme"
+541
View File
@@ -0,0 +1,541 @@
msgid ""
msgstr ""
"Project-Id-Version: pv 1.11.0\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2026-08-01 14:53+0100\n"
"PO-Revision-Date: 2026-08-07 19:25+0000\n"
"Last-Translator: ldm <ldm@noreply.codeberg.org>\n"
"Language-Team: Italian <https://translate.codeberg.org/projects/pv/pv/it/>\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 2026.7.1\n"
#: src/main/help.c:300
msgid "show progress bar"
msgstr "mostra la barra dei progressi"
#: src/main/help.c:303
msgid "show elapsed time"
msgstr "mostra tempo trascorso"
#: src/main/help.c:306
msgid "show estimated time of arrival (completion)"
msgstr "mostra tempo stimato di completamento"
#: src/main/help.c:309
msgid "show absolute estimated time of arrival (completion)"
msgstr "mostra l'orario di tempo stimato di completamento"
#: src/main/help.c:312
msgid "show data transfer rate counter"
msgstr "mostrare il contatore della velocità di trasferimento dati"
#: src/main/help.c:315
msgid "show data transfer average rate counter"
msgstr "mostrare la velocità media di trasferimento dati"
#: src/main/help.c:318
msgid "show number of bytes transferred"
msgstr "mostra numero di byte trasferiti"
#: src/main/help.c:321
msgid "show percentage of transfer buffer in use"
msgstr "mostra la percentuale del buffer di trasferimento in uso"
#: src/main/help.c:323
msgid "NUM"
msgstr "NUM"
#: src/main/help.c:324
msgid "show NUM bytes last written"
msgstr "mostra NUM bytes ultimo scritto"
#: src/main/help.c:326
msgid "FORMAT"
msgstr "FORMAT"
#: src/main/help.c:327
msgid "set output format to FORMAT"
msgstr "impostare il formato output in FORMAT"
#: src/main/help.c:330
msgid "output percentages, not visual information"
msgstr "percentuali di output, non informazioni visive"
#: src/main/help.c:333
msgid "do not output any transfer information at all"
msgstr "non mostrare alcuna informazione di trasferimento"
#: src/main/help.c:337
msgid "show number of bits transferred"
msgstr "mostra numero di bit trasferiti"
#: src/main/help.c:340
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr "trattare i suffissi come multipli di 1000 piuttosto che 1024"
#: src/main/help.c:343
msgid "display nothing until first byte transferred"
msgstr "non mostrare nulla fino al primo byte trasferito"
#: src/main/help.c:345 src/main/help.c:360 src/main/help.c:363
msgid "SEC"
msgstr "SEC"
#: src/main/help.c:346
msgid "display nothing until SEC seconds have passed"
msgstr "non mostrare nulla fino a quando non sono passati SEC secondi"
#: src/main/help.c:348
msgid "SIZE"
msgstr "DIM"
#: src/main/help.c:349
msgid "set estimated data size to SIZE bytes"
msgstr "imposta la dimensione stimata dei dati per DIM bytes"
#: src/main/help.c:352
msgid "if size unknown, show rate vs max rate"
msgstr "se dimensioni sconosciute, mostrare tasso di trasferimento vs tasso massimo"
#: src/main/help.c:355
msgid "count lines instead of bytes"
msgstr "contare le linee invece dei bytes"
#: src/main/help.c:358
msgid "lines are null-terminated"
msgstr "le righe terminano con un carattere nullo"
#: src/main/help.c:361
msgid "update every SEC seconds"
msgstr "aggiornamento ogni SEC secondi"
#: src/main/help.c:364
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr "calcolare il tasso medio negli ultimi SEC secondi (predefinito 30s)"
#: src/main/help.c:366
msgid "WIDTH"
msgstr "LARGHEZZA"
#: src/main/help.c:367
msgid "assume terminal is WIDTH characters wide"
msgstr "assumere il terminale largo LARGHEZZA caratteri"
#: src/main/help.c:369
msgid "HEIGHT"
msgstr "ALTEZZA"
#: src/main/help.c:370
msgid "assume terminal is HEIGHT rows high"
msgstr "assumere terminale alto ALTEZZA righe"
#: src/main/help.c:372
msgid "NAME"
msgstr "NOME"
#: src/main/help.c:373
msgid "prefix visual information with NAME"
msgstr "anteponi NOME alle informazioni visive"
#: src/main/help.c:375
msgid "STYLE"
msgstr "STILE"
#: src/main/help.c:376
msgid "set default bar style to STYLE"
msgstr "impostare lo stile predefinito della barra a STILE"
#: src/main/help.c:378
msgid "SPEC"
msgstr "SPEC"
#: src/main/help.c:379
msgid "also send progress to SPEC"
msgstr "inviare i progressi anche a SPEC"
#: src/main/help.c:382
msgid "set terminal progress state with OSC 9;4 (ConEmu)"
msgstr "impostare lo stato di avanzamento del terminale con OSC 9;4 (ConEmu)"
#: src/main/help.c:385
msgid "output transfer statistics at the end"
msgstr "mostra statistiche di trasferimento alla fine"
#: src/main/help.c:388
msgid "output even if standard error is not a terminal"
msgstr "output anche se standard error non è un terminale"
#: src/main/help.c:391
msgid "use cursor positioning escape sequences"
msgstr "utilizzare le sequenze escape di posizionamento del cursore"
#: src/main/help.c:394 src/main/help.c:430 src/main/help.c:449
#: src/main/help.c:459
msgid "FILE"
msgstr "FILE"
#: src/main/help.c:395
msgid "write output to FILE instead of stdout"
msgstr "scrivere output su FILE invece che stdout"
#: src/main/help.c:397
msgid "RATE"
msgstr "TASSO"
#: src/main/help.c:398
msgid "limit transfer to RATE bytes per second"
msgstr "limite di trasferimento a TASSO byte al secondo"
#: src/main/help.c:400 src/main/help.c:406 src/main/help.c:412
msgid "BYTES"
msgstr "BYTE"
#: src/main/help.c:401
msgid "use a buffer size of BYTES"
msgstr "utilizzare un buffer di dimensione BYTE"
#: src/main/help.c:404
msgid "never use splice(), always use read/write"
msgstr "mai usare splice(), usare sempre lettura/scrittura"
#: src/main/help.c:407
msgid "set the pipe buffer size to BYTES"
msgstr "impostare la dimensione del pipe buffer a BYTE"
#: src/main/help.c:410
msgid "skip read errors in input"
msgstr "saltare gli errori di lettura in input"
#: src/main/help.c:413
msgid "skip errors in BYTES blocks at a time"
msgstr "passare errori passati in blocchi BYTE"
#: src/main/help.c:416
msgid "stop after --size bytes have been transferred"
msgstr "stop dopo aver trasferito --size byte"
#: src/main/help.c:419
msgid "flush cache to disk after every write"
msgstr "svuotare la cache sul disco dopo ogni scrittura"
#: src/main/help.c:422
msgid "use direct I/O to bypass cache"
msgstr "utilizzare direct I/O per bypassare la cache"
#: src/main/help.c:425
msgid "try to seek instead of writing null bytes"
msgstr "prova a cercare invece di scrivere byte nulli"
#: src/main/help.c:428
msgid "discard input instead of writing to output"
msgstr "scartare l'input invece di scrivere sull'output"
#: src/main/help.c:431
msgid "write all input to FILE before writing to output"
msgstr "scrivere tutti gli input su FILE prima di scrivere su output"
#: src/main/help.c:434
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr "PID[:FD]|=NOME|@FILE"
#: src/main/help.c:435
msgid "watch file FD opened by process PID"
msgstr "visualizza il file FD aperto dal processo PID"
#: src/main/help.c:438 src/main/help.c:441
msgid "PID"
msgstr "PID"
#: src/main/help.c:439
msgid "update settings of process PID"
msgstr "impostazioni di aggiornamento del processo PID"
#: src/main/help.c:442
msgid "show progress of process PID"
msgstr "mostrare il progresso del processo PID"
#: src/main/help.c:446
msgid "run a command and monitor its standard input, output, or both"
msgstr ""
"eseguire un comando e monitorare il suo standard input, output, o entrambi"
#: src/main/help.c:450
msgid "save process ID in FILE"
msgstr "salvare ID processo in FILE"
#: src/main/help.c:453
msgid "show this help and exit"
msgstr "mostra questo help ed esce"
#: src/main/help.c:456
msgid "show version information and exit"
msgstr "stampa le informazioni sulla versione ed esce"
#: src/main/help.c:460
msgid "write debug logs to FILE"
msgstr "scrivi i log di debug su FILE"
#: src/main/help.c:486
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Uso: %s [OPZIONE] [FILE]..."
#: src/main/help.c:497
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Concatena i FILE, o lo standard input, allo standard output, con "
"monitoraggio."
#: src/main/help.c:639
msgid "Supported format sequences:"
msgstr "Sequenze di formato supportate:"
#: src/main/help.c:653
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Per favore segnalare i bug a: %s"
#: src/main/main.c:225
msgid "(input)"
msgstr "(input)"
#: src/main/main.c:381 src/main/options.c:1359
msgid "a command to run must be specified"
msgstr "un comando da eseguire deve essere specificato"
#: src/main/main.c:704 src/main/options.c:757 src/main/options.c:777
#: src/pv/display.c:1086 src/pv/state.c:45 src/pv/state.c:902
#: src/pv/state.c:914 src/pv/state.c:950 src/pv/transfer.c:1335
#: src/pv/transfer.c:1451 src/pv/transfer.c:1778
msgid "memory allocation failure"
msgstr "fallimento nell'allocazione della memoria"
#: src/main/options.c:418
msgid "list files may not contain @ lines"
msgstr "file di elenco non possono contenere linee @"
#: src/main/options.c:438 src/main/options.c:440 src/main/options.c:901
msgid "process ID or pid:fd pair expected"
msgstr "è previsto un ID di processo o una coppia pid:fd"
#: src/main/options.c:449 src/main/options.c:451 src/main/options.c:908
msgid "invalid process ID"
msgstr "ID processo non valido"
#: src/main/options.c:829
msgid "numeric value not understood"
msgstr "valore numerico non compreso"
#: src/main/options.c:843
msgid "integer argument expected"
msgstr "argomento integer previsto"
#: src/main/options.c:853
msgid "numeric argument expected"
msgstr "argomento numerico previsto"
#: src/main/options.c:864
msgid "missing filename"
msgstr "nome del file mancante"
#: src/main/options.c:890
msgid "missing process name"
msgstr "nome del processo mancante"
#: src/main/options.c:1182
msgid "invalid side specification"
msgstr "specifica del lato non valida"
#: src/main/options.c:1197
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Usare «%s --help» per ulteriori informazioni."
#: src/main/options.c:1199
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Usare «%s -h» per ulteriori informazioni."
#: src/main/options.c:1231
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
"non è possibile utilizzare la modalità riga o il modificatore di "
"trasferimento durante la visualizzazione dei descrittori di file"
#: src/main/options.c:1239
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
"non può utilizzare il posizionamento del cursore durante la visualizzazione "
"dei descrittori di file"
#: src/main/options.c:1247
msgid "cannot use remote control when watching file descriptors"
msgstr "non può usare il telecomando quando si guarda i descrittori di file"
#: src/main/options.c:1255
msgid "cannot use remote query when watching file descriptors"
msgstr "non può utilizzare query remoto quando si guarda i descrittori di file"
#: src/main/options.c:1263
msgid "cannot transfer files when watching file descriptors"
msgstr ""
"non può trasferire i file durante la visualizzazione dei descrittori di file"
#: src/main/options.c:1287
msgid "not available on systems without /proc/self/fdinfo"
msgstr "non disponibile su sistemi senza /proc/self/fdinfo"
#: src/main/options.c:1298
msgid "cannot use remote control and remote query together"
msgstr "non può utilizzare il telecomando e la query remota insieme"
#: src/main/options.c:1325
msgid "monitor mode cannot be specified with this option"
msgstr "la modalità monitor non può essere specificata con questa opzione"
#: src/main/options.c:1337
msgid "monitor mode cannot be used with store-and-forward"
msgstr "modalità monitor non può essere utilizzato con negozio e in avanti"
#: src/main/options.c:1348
msgid "files cannot be specified with this option"
msgstr "i file non possono essere specificati con questa opzione"
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
msgstr "Licenza: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
#: src/main/version.c:29
msgid "This is free software: you are free to change and redistribute it."
msgstr "Questo è software libero: è possibile modificarlo e ridistribuirlo."
#: src/main/version.c:30
msgid "There is NO WARRANTY, to the extent permitted by law."
msgstr "Non c'è ALCUNA GARANZIA, nei limiti permessi dalla legge."
#: src/main/version.c:32
msgid "Project web site"
msgstr "Sito web del progetto"
#: src/pv/cursor.c:108 src/pv/cursor.c:135
msgid "failed to open lock file"
msgstr "non è riuscito ad aprire il file di blocco"
#: src/pv/cursor.c:790 src/pv/cursor.c:792
msgid "interrupted by a signal"
msgstr "interrotta da un segnale"
#: src/pv/display.c:311
msgid "yzafpnum kMGTPEZY"
msgstr "yzafpnum kMGTPEZY"
#: src/pv/display.c:329
msgid "yzafpnum KMGTPEZY"
msgstr "yzafpnum KMGTPEZY"
#: src/pv/file.c:81
msgid "/dev/null is not usable"
msgstr "/dev/null non è utilizzabile"
#: src/pv/file.c:371
msgid "error closing file"
msgstr "errore nel chiudere il file"
#: src/pv/file.c:438
msgid "input file is also the output"
msgstr "il file di input coincide con quello di output"
#: src/pv/file.c:596
msgid "(none)"
msgstr "(nessuno)"
#: src/pv/file.c:598
msgid "(stdin)"
msgstr "(stdin)"
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:181
msgid "b/s"
msgstr "b/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr "/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:181
msgid "B/s"
msgstr "B/s"
#: src/pv/format/bytes.c:35
msgid "b"
msgstr "b"
#: src/pv/format/bytes.c:39 src/pv/transfer.c:1284
msgid "B"
msgstr "B"
#: src/pv/format/eta.c:63 src/pv/format/eta.c:67
msgid "ETA"
msgstr "ETA"
#: src/pv/format/fineta.c:93
msgid "FIN"
msgstr "FIN"
#: src/pv/loop.c:180
msgid "rate min/avg/max/mdev"
msgstr "tasso min/med/mas/mdev"
#: src/pv/loop.c:192
msgid "rate not measured"
msgstr "tasso non misurato"
#: src/pv/loop.c:1098 src/pv/loop.c:1114 src/pv/loop.c:1132 src/pv/remote.c:93
#: src/pv/remote.c:188 src/pv/remote.c:536 src/pv/remote.c:582
#: src/pv/watchpid.c:123 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:158 src/pv/watchpid.c:194
#: src/pv/watchpid.c:206 src/pv/watchpid.c:218 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:286 src/pv/watchpid.c:401
#: src/pv/watchpid.c:409 src/pv/watchpid.c:556 src/pv/watchpid.c:565
#: src/pv/watchpid.c:586
msgid "pid"
msgstr "pid"
#: src/pv/loop.c:1132 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:160 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:288
msgid "fd"
msgstr "fd"
#: src/pv/remote.c:242 src/pv/remote.c:636
msgid "message not received"
msgstr "messaggio non ricevuto"
#: src/pv/remote.c:659 src/pv/remote.c:677
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO non supportato su questo sistema"
#: src/pv/transfer.c:1173
msgid "warning: read errors detected"
msgstr "avvertimento: errori di lettura rilevati"
#: src/pv/transfer.c:1283
msgid "skipped past read error"
msgstr "saltato l'errore di lettura"
#: src/pv/transfer.c:1642
msgid "write error"
msgstr "errore di scrittura"
#: src/pv/watchpid.c:160 src/pv/watchpid.c:288
msgid "not a regular file or block device"
msgstr "non è un file regolare o un dispositivo a blocchi"
+539
View File
@@ -0,0 +1,539 @@
msgid ""
msgstr ""
"Project-Id-Version: pv 1.9.34\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2026-08-01 14:53+0100\n"
"PO-Revision-Date: 2026-05-16 19:25+0000\n"
"Last-Translator: a-j-wood <a-j-wood@noreply.codeberg.org>\n"
"Language-Team: Georgian <https://translate.codeberg.org/projects/pv/pv/ka/>\n"
"Language: ka\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.17.1\n"
#: src/main/help.c:300
msgid "show progress bar"
msgstr "პროგრესის ზოლის ჩვენება"
#: src/main/help.c:303
msgid "show elapsed time"
msgstr "გასული დროის ჩვენება"
#: src/main/help.c:306
msgid "show estimated time of arrival (completion)"
msgstr "სავარაუდო დასრულების დროის ჩვენება"
#: src/main/help.c:309
msgid "show absolute estimated time of arrival (completion)"
msgstr "დასრულების აბსოლუტური სავარაუდო დროის ჩვენება"
#: src/main/help.c:312
msgid "show data transfer rate counter"
msgstr "მონაცემთა გადაცემის სიჩქარის ჩვენება"
#: src/main/help.c:315
msgid "show data transfer average rate counter"
msgstr "საშუალო მონაცემთა გადაცემის სიჩქარის ჩვენება"
#: src/main/help.c:318
msgid "show number of bytes transferred"
msgstr "გადატანილი ბაიტების რაოდენობის ჩვენება"
#: src/main/help.c:321
msgid "show percentage of transfer buffer in use"
msgstr "გამოყენებული გადაცემის ბუფერის პროცენტული მაჩვენებლის ჩვენება"
#: src/main/help.c:323
msgid "NUM"
msgstr "ႬႭႫ"
#: src/main/help.c:324
msgid "show NUM bytes last written"
msgstr "ბოლოს დაწერილი ႬႭႫ ბაიტის ჩვენება"
#: src/main/help.c:326
msgid "FORMAT"
msgstr "ႴႭႰႫႠႲႨ"
#: src/main/help.c:327
msgid "set output format to FORMAT"
msgstr "გამომავალი ფორმატის დაყენება ႴႭႰႫႠႲႨ"
#: src/main/help.c:330
msgid "output percentages, not visual information"
msgstr "გამომავალი პროცენტები, არა ვიზუალური ინფორმაცია"
#: src/main/help.c:333
msgid "do not output any transfer information at all"
msgstr "პროგრესის ინფორმაცია არ აჩვენოთ"
#: src/main/help.c:337
msgid "show number of bits transferred"
msgstr "გადაცემული ბიტების რაოდენობის ჩვენება"
#: src/main/help.c:340
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr "სუფიქსების 1000-ის ჯერადად განხილვა 1024-ის ნაცვლად"
#: src/main/help.c:343
msgid "display nothing until first byte transferred"
msgstr "არაფერი აჩვენოს პირველი ბაიტის გადატანამდე"
#: src/main/help.c:345 src/main/help.c:360 src/main/help.c:363
msgid "SEC"
msgstr "ႼႠႫ"
#: src/main/help.c:346
msgid "display nothing until SEC seconds have passed"
msgstr "არაფერი აჩვენოს ႼႠႫ წამების გასვლამდე"
#: src/main/help.c:348
msgid "SIZE"
msgstr "ႦႭႫႠ"
#: src/main/help.c:349
msgid "set estimated data size to SIZE bytes"
msgstr "მონაცემთა სავარაუდო ზომის ႦႭႫႠ ბაიტებზე დაყენება"
#: src/main/help.c:352
msgid "if size unknown, show rate vs max rate"
msgstr "თუ ზომა უცნობია, აჩვენეთ სიჩქარე მაქსიმალურ სიჩქარესთან შედარებით"
#: src/main/help.c:355
msgid "count lines instead of bytes"
msgstr "ბაიტების ნაცვლად ხაზების დათვლა"
#: src/main/help.c:358
msgid "lines are null-terminated"
msgstr "ხაზები ნულით დასრულებულია"
#: src/main/help.c:361
msgid "update every SEC seconds"
msgstr "განახლება ყოველ ႼႠႫ წამში"
#: src/main/help.c:364
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
"გამოთვალეთ საშუალო მაჩვენებელი ბოლო ႼႠႫ წამების განმავლობაში (ნაგულისხმევი "
"30 წმ)"
#: src/main/help.c:366
msgid "WIDTH"
msgstr "ႱႨႢႠႬႤ"
#: src/main/help.c:367
msgid "assume terminal is WIDTH characters wide"
msgstr "ვივარაუდოთ, რომ ტერმინალი ႱႨႢႠႬႤ სიმბოლოს სიგანისაა"
#: src/main/help.c:369
msgid "HEIGHT"
msgstr "ႱႨႫႠႶႪႤ"
#: src/main/help.c:370
msgid "assume terminal is HEIGHT rows high"
msgstr "ვივარაუდოთ, რომ ტერმინალი ႱႨႫႠႶႪႤ რიგის სიმაღლისაა"
#: src/main/help.c:372
msgid "NAME"
msgstr "ႱႠႾႤႪႨ"
#: src/main/help.c:373
msgid "prefix visual information with NAME"
msgstr "გამომავალი ხაზის დასაწყისში ႱႠႾႤႪႨ-ის ჩვენება"
#: src/main/help.c:375
msgid "STYLE"
msgstr "ႱႲႨႪႨ"
#: src/main/help.c:376
msgid "set default bar style to STYLE"
msgstr "ნაგულისხმევი ზოლის სტილი ႱႲႨႪႨ-ზე დააყენეთ"
#: src/main/help.c:378
msgid "SPEC"
msgstr "ႱႮႤႺႨႴႨႩႠ"
#: src/main/help.c:379
msgid "also send progress to SPEC"
msgstr "ასევე გაუგზავნეთ პროგრესი ႱႮႤႺႨႴႨႩႠ-ს"
#: src/main/help.c:382
msgid "set terminal progress state with OSC 9;4 (ConEmu)"
msgstr ""
#: src/main/help.c:385
msgid "output transfer statistics at the end"
msgstr "სტატისტიკის ჩვენება ბოლოს"
#: src/main/help.c:388
msgid "output even if standard error is not a terminal"
msgstr "გამომავალი მაშინაც კი, თუ სტანდარტული შეცდომა ტერმინალი არ არის"
#: src/main/help.c:391
msgid "use cursor positioning escape sequences"
msgstr "კურსორის პოზიციონირება ტერმინალის კოდებით"
#: src/main/help.c:394 src/main/help.c:430 src/main/help.c:449
#: src/main/help.c:459
msgid "FILE"
msgstr "ႴႠႨႪႨ"
#: src/main/help.c:395
msgid "write output to FILE instead of stdout"
msgstr "ჩაწერეთ გამომავალი ႴႠႨႪႨ-ში სტანდარტული გამომავალის ნაცვლად"
#: src/main/help.c:397
msgid "RATE"
msgstr "ႱႨႹႵႠႰႤ"
#: src/main/help.c:398
msgid "limit transfer to RATE bytes per second"
msgstr "სიჩქარის შეზღუდვა წამში ႱႨႹႵႠႰႤ ბაიტამდე"
#: src/main/help.c:400 src/main/help.c:406 src/main/help.c:412
msgid "BYTES"
msgstr "ႡႠႨႲႤႡႨ"
#: src/main/help.c:401
msgid "use a buffer size of BYTES"
msgstr "გამოიყენეთ ႡႠႨႲႤႡႨ ბუფერის ზომა"
#: src/main/help.c:404
msgid "never use splice(), always use read/write"
msgstr "არასდროს გამოიყენოთ splice(), ყოველთვის გამოიყენეთ წაკითხვა/ჩაწერა"
#: src/main/help.c:407
msgid "set the pipe buffer size to BYTES"
msgstr "მილის ბუფერის ზომა დააყენეთ ႡႠႨႲႤႡႨ ბაიტზე"
#: src/main/help.c:410
msgid "skip read errors in input"
msgstr "შეყვანის შეცდომების გამოტოვება"
#: src/main/help.c:413
msgid "skip errors in BYTES blocks at a time"
msgstr "შეცდომების გამოტოვება ႡႠႨႲႤႡႨ ბაიტის ბლოკებში"
#: src/main/help.c:416
msgid "stop after --size bytes have been transferred"
msgstr "შეჩერება --size ბაიტების გადატანის შემდეგ"
#: src/main/help.c:419
msgid "flush cache to disk after every write"
msgstr "დისკის ჩაწერის ქეშის გასუფთავება ყოველი ჩაწერის შემდეგ"
#: src/main/help.c:422
msgid "use direct I/O to bypass cache"
msgstr "ქეშის გვერდის ავლით პირდაპირი შეყვანის/გამოყვანის გამოყენებით"
#: src/main/help.c:425
msgid "try to seek instead of writing null bytes"
msgstr "დატოვეთ ხვრელები გამომავალში ნულოვანი ბაიტების ჩაწერის ნაცვლად"
#: src/main/help.c:428
msgid "discard input instead of writing to output"
msgstr "შეყვანის გაუქმება გამოსავალში ჩაწერის ნაცვლად"
#: src/main/help.c:431
msgid "write all input to FILE before writing to output"
msgstr "ყველა შემავალი მონაცემი ႴႠႨႪႨ-ში ჩაწერეთ გამოსავალში ჩაწერამდე"
#: src/main/help.c:434
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr "ႮႨႣ[:ႴႠ]|=ႱႠႾႤႪႨ|@ႴႠႨႪႨ"
#: src/main/help.c:435
msgid "watch file FD opened by process PID"
msgstr "ფაილის აღწერის ყურება ႴႠ გახსნილია ႮႨႣ პროცესის მიერ"
#: src/main/help.c:438 src/main/help.c:441
msgid "PID"
msgstr "ႮႨႣ"
#: src/main/help.c:439
msgid "update settings of process PID"
msgstr "პროცესის ႮႨႣ-ის პარამეტრების განახლება"
#: src/main/help.c:442
msgid "show progress of process PID"
msgstr "პროცესის ႮႨႣ პროგრესის ჩვენება"
#: src/main/help.c:446
msgid "run a command and monitor its standard input, output, or both"
msgstr ""
"ბრძანების გაშვება და მისი სტანდარტული შეყვანის, გამომავალი ან ორივეს "
"მონიტორინგი"
#: src/main/help.c:450
msgid "save process ID in FILE"
msgstr "პროცესის იდენტიფიკატორის შენახვა ႴႠႨႪႨ-ში"
#: src/main/help.c:453
msgid "show this help and exit"
msgstr "აჩვენეთ ეს დახმარება და გადით"
#: src/main/help.c:456
msgid "show version information and exit"
msgstr "ვერსიის ინფორმაციის ჩვენება და გასვლა"
#: src/main/help.c:460
msgid "write debug logs to FILE"
msgstr "გამართვის ჟურნალების ႴႠႨႪႨ-ში ჩაწერა"
#: src/main/help.c:486
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "გამოყენება: %s [ႠႰႹႤႥႠ] [ႴႠႨႪႨ]..."
#: src/main/help.c:497
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr "შეყვანის ფაილების გადატანა გამოსავალზე მონიტორინგით."
#: src/main/help.c:639
msgid "Supported format sequences:"
msgstr "მხარდაჭერილი ფორმატის თანმიმდევრობები:"
#: src/main/help.c:653
#, c-format
msgid "Please report any bugs to: %s"
msgstr "ნებისმიერი შეცდომის შესახებ, გთხოვთ, შეატყობინოთ შემდეგ მისამართზე: %s"
#: src/main/main.c:225
msgid "(input)"
msgstr "(შეყვანა)"
#: src/main/main.c:381 src/main/options.c:1359
msgid "a command to run must be specified"
msgstr "შესასრულებელი ბრძანება უნდა იყოს მითითებული"
#: src/main/main.c:704 src/main/options.c:757 src/main/options.c:777
#: src/pv/display.c:1086 src/pv/state.c:45 src/pv/state.c:902
#: src/pv/state.c:914 src/pv/state.c:950 src/pv/transfer.c:1335
#: src/pv/transfer.c:1451 src/pv/transfer.c:1778
msgid "memory allocation failure"
msgstr "მეხსიერების გამოყოფის შეცდომა"
#: src/main/options.c:418
msgid "list files may not contain @ lines"
msgstr "სიის ფაილები არ შეიძლება შეიცავდეს \"@\" ხაზებს"
#: src/main/options.c:438 src/main/options.c:440 src/main/options.c:901
msgid "process ID or pid:fd pair expected"
msgstr ""
#: src/main/options.c:449 src/main/options.c:451 src/main/options.c:908
msgid "invalid process ID"
msgstr ""
#: src/main/options.c:829
msgid "numeric value not understood"
msgstr ""
#: src/main/options.c:843
msgid "integer argument expected"
msgstr ""
#: src/main/options.c:853
msgid "numeric argument expected"
msgstr ""
#: src/main/options.c:864
msgid "missing filename"
msgstr "ფაილის სახელი აკლია"
#: src/main/options.c:890
msgid "missing process name"
msgstr ""
#: src/main/options.c:1182
msgid "invalid side specification"
msgstr ""
#: src/main/options.c:1197
#, c-format
msgid "Try `%s --help' for more information."
msgstr "დამატებითი ინფორმაციისთვის სცადეთ `%s --help'."
#: src/main/options.c:1199
#, c-format
msgid "Try `%s -h' for more information."
msgstr "დამატებითი ინფორმაციისთვის სცადეთ `%s -h'."
#: src/main/options.c:1231
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
#: src/main/options.c:1239
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
#: src/main/options.c:1247
msgid "cannot use remote control when watching file descriptors"
msgstr ""
#: src/main/options.c:1255
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1263
msgid "cannot transfer files when watching file descriptors"
msgstr ""
#: src/main/options.c:1287
msgid "not available on systems without /proc/self/fdinfo"
msgstr ""
#: src/main/options.c:1298
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/options.c:1325
msgid "monitor mode cannot be specified with this option"
msgstr ""
#: src/main/options.c:1337
msgid "monitor mode cannot be used with store-and-forward"
msgstr ""
#: src/main/options.c:1348
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
msgstr "ლიცენზია: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
#: 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 "კანონით დაშვებული ფარგლებში, გარანტია არ არსებობს."
#: src/main/version.c:32
msgid "Project web site"
msgstr "პროექტის ვებსაიტი"
#: src/pv/cursor.c:108 src/pv/cursor.c:135
msgid "failed to open lock file"
msgstr "დაბლოკვის ფაილის გახსნა ვერ მოხერხდა"
#: src/pv/cursor.c:790 src/pv/cursor.c:792
msgid "interrupted by a signal"
msgstr "შეწყვეტილია სიგნალის მიერ"
#: src/pv/display.c:311
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:329
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/file.c:81
msgid "/dev/null is not usable"
msgstr "/dev/null არ არის გამოსაყენებელი"
#: src/pv/file.c:371
msgid "error closing file"
msgstr "ფაილის დახურვის შეცდომა"
#: src/pv/file.c:438
msgid "input file is also the output"
msgstr "შეტანის ფაილი ასევე გამოსატანიცაა"
#: src/pv/file.c:596
msgid "(none)"
msgstr "(არცერთი)"
#: src/pv/file.c:598
msgid "(stdin)"
msgstr "(stdin)"
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:181
msgid "b/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:181
msgid "B/s"
msgstr ""
#: src/pv/format/bytes.c:35
msgid "b"
msgstr ""
#: src/pv/format/bytes.c:39 src/pv/transfer.c:1284
msgid "B"
msgstr ""
#: src/pv/format/eta.c:63 src/pv/format/eta.c:67
msgid "ETA"
msgstr ""
#: src/pv/format/fineta.c:93
msgid "FIN"
msgstr ""
#: src/pv/loop.c:180
msgid "rate min/avg/max/mdev"
msgstr "სიჩქარე მინიმალური/საშუალო/მაქსიმალური/სტანდარტული გადახრა"
#: src/pv/loop.c:192
msgid "rate not measured"
msgstr "სიჩქარე არ იზომებოდა"
#: src/pv/loop.c:1098 src/pv/loop.c:1114 src/pv/loop.c:1132 src/pv/remote.c:93
#: src/pv/remote.c:188 src/pv/remote.c:536 src/pv/remote.c:582
#: src/pv/watchpid.c:123 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:158 src/pv/watchpid.c:194
#: src/pv/watchpid.c:206 src/pv/watchpid.c:218 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:286 src/pv/watchpid.c:401
#: src/pv/watchpid.c:409 src/pv/watchpid.c:556 src/pv/watchpid.c:565
#: src/pv/watchpid.c:586
msgid "pid"
msgstr ""
#: src/pv/loop.c:1132 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:160 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:288
msgid "fd"
msgstr ""
#: src/pv/remote.c:242 src/pv/remote.c:636
msgid "message not received"
msgstr "შეტყობინება არ არის მიღებული"
#: src/pv/remote.c:659 src/pv/remote.c:677
msgid "SA_SIGINFO not supported on this system"
msgstr ""
#: src/pv/transfer.c:1173
msgid "warning: read errors detected"
msgstr "გაფრთხილება: წაკითხვის შეცდომები აღმოჩენილია"
#: src/pv/transfer.c:1283
msgid "skipped past read error"
msgstr ""
#: src/pv/transfer.c:1642
msgid "write error"
msgstr "ჩაწერის შეცდომა"
#: src/pv/watchpid.c:160 src/pv/watchpid.c:288
msgid "not a regular file or block device"
msgstr ""
+462 -304
View File
@@ -5,477 +5,635 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-04-21 14:15+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"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2026-08-01 14:53+0100\n"
"PO-Revision-Date: 2026-08-01 18:32+0000\n"
"Last-Translator: a-j-wood <a-j-wood@noreply.codeberg.org>\n"
"Language-Team: Polish <https://translate.codeberg.org/projects/pv/pv/pl/>\n"
"Language: pl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 2026.7.1\n"
#: src/main/help.c:284
#: src/main/help.c:300
msgid "show progress bar"
msgstr "pokaż pasek postępu"
#: src/main/help.c:287
#: src/main/help.c:303
msgid "show elapsed time"
msgstr "pokaż upływający czas"
#: src/main/help.c:290
#: src/main/help.c:306
msgid "show estimated time of arrival (completion)"
msgstr "pokaż szacowany czas ukończenia"
#: src/main/help.c:293
#: src/main/help.c:309
msgid "show absolute estimated time of arrival (completion)"
msgstr ""
msgstr "pokaż bezwzględny szacowany czas ukończenia"
#: src/main/help.c:296
#: src/main/help.c:312
msgid "show data transfer rate counter"
msgstr "pokaż licznik prędkości przesyłania"
#: src/main/help.c:299
#: src/main/help.c:315
msgid "show data transfer average rate counter"
msgstr ""
msgstr "pokaż licznik uśrednionej prędkości przesyłania"
#: src/main/help.c:301 src/main/help.c:332 src/main/help.c:344
msgid "SEC"
msgstr "WARTOŚĆ"
#: src/main/help.c:302
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
#: src/main/help.c:305
#: src/main/help.c:318
msgid "show number of bytes transferred"
msgstr "pokaż ilość przesłanych bajtów"
#: src/main/help.c:308
msgid "show number of bits transferred"
msgstr ""
#: src/main/help.c:311
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr ""
#: src/main/help.c:314
#: src/main/help.c:321
msgid "show percentage of transfer buffer in use"
msgstr ""
#: src/main/help.c:316
msgid "NUM"
msgstr ""
#: src/main/help.c:317
msgid "show NUM bytes last written"
msgstr ""
#: src/main/help.c:319
msgid "FORMAT"
msgstr ""
#: src/main/help.c:320
msgid "set output format to FORMAT"
msgstr ""
msgstr "pokaż procentowe użycie bufora transferu"
#: src/main/help.c:323
msgid "output percentages, not visual information"
msgstr "wświetl wyjście procentowo, bez graficznej prezentacji"
msgid "NUM"
msgstr "LICZBA"
#: src/main/help.c:324
msgid "show NUM bytes last written"
msgstr "pokaż ostatnie LICZBA przesłanych bajtów"
#: src/main/help.c:326
msgid "FORMAT"
msgstr "FORMAT"
#: src/main/help.c:327
msgid "set output format to FORMAT"
msgstr "ustaw FORMAT jako format wyjściowy"
#: src/main/help.c:330
msgid "output percentages, not visual information"
msgstr "wyświetl wyjście procentowo, bez graficznej prezentacji"
#: src/main/help.c:333
msgid "do not output any transfer information at all"
msgstr "nie wyświetlaj żadnych informacji o przesyłaniu"
#: src/main/help.c:330
#: src/main/help.c:337
msgid "show number of bits transferred"
msgstr "pokaż ilość przesłanych bitów"
#: src/main/help.c:340
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr "traktuj przyrostki jako wielokrotności 1000 zamiast 1024"
#: src/main/help.c:343
msgid "display nothing until first byte transferred"
msgstr "nie wyświetlaj nic aż do pierwszego przesłanego bajtu"
#: src/main/help.c:333
#: src/main/help.c:345 src/main/help.c:360 src/main/help.c:363
msgid "SEC"
msgstr "SEKUNDY"
#: src/main/help.c:346
msgid "display nothing until SEC seconds have passed"
msgstr ""
#: src/main/help.c:335
msgid "SIZE"
msgstr "WARTOŚĆ"
#: src/main/help.c:336
msgid "set estimated data size to SIZE bytes"
msgstr "ustaw oczekiwany rozmiar danych na WARTOŚĆ bajtów"
#: src/main/help.c:339
msgid "count lines instead of bytes"
msgstr ""
#: src/main/help.c:342
msgid "lines are null-terminated"
msgstr ""
#: src/main/help.c:345
msgid "update every SEC seconds"
msgstr "aktualizuj co każde WARTOŚĆ sekund"
#: src/main/help.c:347
msgid "WIDTH"
msgstr "WARTOŚĆ"
msgstr "nie wyświetlaj nic do momentu upłynięcia SEKUNDY sekund"
#: src/main/help.c:348
msgid "assume terminal is WIDTH characters wide"
msgstr "przyjmij, że terminal ma szerokość WARTOŚĆ znaków"
msgid "SIZE"
msgstr "ROZMIAR"
#: src/main/help.c:350
msgid "HEIGHT"
#: src/main/help.c:349
msgid "set estimated data size to SIZE bytes"
msgstr "ustaw oczekiwany rozmiar danych na ROZMIAR bajtów"
#: src/main/help.c:352
msgid "if size unknown, show rate vs max rate"
msgstr ""
"jeśli rozmiar nie jest znany, wyświetl zestawienie prędkości do maksymalnej "
"prędkości"
#: src/main/help.c:351
#: src/main/help.c:355
msgid "count lines instead of bytes"
msgstr "zliczaj linie zamiast bajty"
#: src/main/help.c:358
msgid "lines are null-terminated"
msgstr "linie są zakończone znakiem NUL"
#: src/main/help.c:361
msgid "update every SEC seconds"
msgstr "aktualizuj co każde SEKUNDY sekund"
#: src/main/help.c:364
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
"oblicz średnią prędkość transferu na podstawie poprzednich SEKUNDY sekund "
"(domyślnie 30 s)"
#: src/main/help.c:366
msgid "WIDTH"
msgstr "SZEROKOŚĆ"
#: src/main/help.c:367
msgid "assume terminal is WIDTH characters wide"
msgstr "przyjmij, że terminal ma szerokość SZEROKOŚĆ znaków"
#: src/main/help.c:369
msgid "HEIGHT"
msgstr "WYSOKOŚĆ"
#: src/main/help.c:370
msgid "assume terminal is HEIGHT rows high"
msgstr "przyjmij, że terminal ma szerokość WARTOŚĆ znaków"
msgstr "przyjmij, że terminal ma wysokość WYSOKOŚĆ linii"
#: src/main/help.c:353
#: src/main/help.c:372
msgid "NAME"
msgstr "NAZWA"
#: src/main/help.c:354
#: src/main/help.c:373
msgid "prefix visual information with NAME"
msgstr "poprzedź informacje prefiksem NAZWA"
#: src/main/help.c:357
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:360
msgid "use cursor positioning escape sequences"
msgstr "używaj sekwencji escape do pozycjonowania"
#: src/main/help.c:363
msgid "RATE"
msgstr ""
#: src/main/help.c:364
msgid "limit transfer to RATE bytes per second"
msgstr "ogranicz przesyłane dane do RATE bajtów na sekundę"
#: src/main/help.c:366 src/main/help.c:375
msgid "BYTES"
msgstr ""
#: src/main/help.c:367
msgid "use a buffer size of BYTES"
msgstr ""
#: src/main/help.c:370
msgid "never use splice(), always use read/write"
msgstr ""
#: src/main/help.c:373
msgid "skip read errors in input"
msgstr ""
#: src/main/help.c:375
msgid "STYLE"
msgstr "STYL"
#: src/main/help.c:376
msgid "skip errors in BYTES blocks at a time"
msgstr ""
msgid "set default bar style to STYLE"
msgstr "ustaw domyślny styl paska postępu na STYL"
#: src/main/help.c:378
msgid "SPEC"
msgstr "SPEC"
#: src/main/help.c:379
msgid "stop after --size bytes have been transferred"
msgstr ""
msgid "also send progress to SPEC"
msgstr "wysyłaj postęp również do SPEC"
#: src/main/help.c:382
msgid "flush cache to disk after every write"
msgstr ""
msgid "set terminal progress state with OSC 9;4 (ConEmu)"
msgstr "aktualizacja stanu zaawansowania terminala za pomocą OSC 9;4 (ConEmu)"
#: src/main/help.c:385
msgid "use direct I/O to bypass cache"
msgstr ""
msgid "output transfer statistics at the end"
msgstr "wyświetl na końcu statystyki transferu"
#: src/main/help.c:388
msgid "discard input instead of writing to output"
msgstr ""
msgid "output even if standard error is not a terminal"
msgstr "pokaż wyjście nawet standardowe wyjście błędu nie jest terminalem"
#: src/main/help.c:391
msgid "PID"
msgstr ""
msgid "use cursor positioning escape sequences"
msgstr "używaj znaków ucieczki do pozycjonowania kursora"
#: src/main/help.c:392
msgid "update settings of process PID"
msgstr ""
#: src/main/help.c:396 src/main/help.c:411
#: src/main/help.c:394 src/main/help.c:430 src/main/help.c:449
#: src/main/help.c:459
msgid "FILE"
msgstr ""
msgstr "PLIK"
#: src/main/help.c:395
msgid "write output to FILE instead of stdout"
msgstr "zapisz wyjście do PLIK zamiast do wyjścia standardowego"
#: src/main/help.c:397
msgid "save process ID in FILE"
msgstr ""
msgid "RATE"
msgstr "PRĘDKOŚĆ"
#: src/main/help.c:400
msgid "PID[:FD]"
msgstr ""
#: src/main/help.c:398
msgid "limit transfer to RATE bytes per second"
msgstr "ogranicz przesyłane dane do PRĘDKOŚĆ bajtów na sekundę"
#: src/main/help.c:400 src/main/help.c:406 src/main/help.c:412
msgid "BYTES"
msgstr "BAJTY"
#: src/main/help.c:401
msgid "watch file FD opened by process PID"
msgstr ""
msgid "use a buffer size of BYTES"
msgstr "użyj bufora o rozmiarze BAJTY"
#: src/main/help.c:405
#: src/main/help.c:404
msgid "never use splice(), always use read/write"
msgstr "nigdy nie używaj splice(), zawsze używaj read/write"
#: src/main/help.c:407
msgid "set the pipe buffer size to BYTES"
msgstr "użyj bufora potokowego o rozmiarze BAJTY"
#: src/main/help.c:410
msgid "skip read errors in input"
msgstr "pomijaj błędy odczytu wejścia"
#: src/main/help.c:413
msgid "skip errors in BYTES blocks at a time"
msgstr "pomijaj błędy w blokach po BAJTY bajtów na raz"
#: src/main/help.c:416
msgid "stop after --size bytes have been transferred"
msgstr "zakończ po przesłaniu --size bajtów"
#: src/main/help.c:419
msgid "flush cache to disk after every write"
msgstr "wymuś zapis pamięci podręcznej na dysk po każdym zapisie"
#: src/main/help.c:422
msgid "use direct I/O to bypass cache"
msgstr ""
"użyj bezpośredniego wejścia/wyjścia celem pominięcia pamięci podręcznej"
#: src/main/help.c:425
msgid "try to seek instead of writing null bytes"
msgstr "próbuj przewinąć zamiast wypisywać zerowe bajty"
#: src/main/help.c:428
msgid "discard input instead of writing to output"
msgstr "zignoruj dane wejściowe zamiast wyświetlić je na wyjściu standardowym"
#: src/main/help.c:431
msgid "write all input to FILE before writing to output"
msgstr ""
"zapisz wszystkie dane wejściowe do PLIK przed wyświetleniem ich na wyjściu"
#: src/main/help.c:434
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr "PID[:FD]|=NAZWA|@PLIKLISTY"
#: src/main/help.c:435
msgid "watch file FD opened by process PID"
msgstr "obserwuj plik FD otworzony przez proces PID"
#: src/main/help.c:438 src/main/help.c:441
msgid "PID"
msgstr "PID"
#: src/main/help.c:439
msgid "update settings of process PID"
msgstr "zaktualizuj ustawienia procesu PID"
#: src/main/help.c:442
msgid "show progress of process PID"
msgstr "pokaż postęp procesu PID"
#: src/main/help.c:446
msgid "run a command and monitor its standard input, output, or both"
msgstr "uruchom polecenie i monitoruj jego wejście i/lub wyjście standardowe"
#: src/main/help.c:450
msgid "save process ID in FILE"
msgstr "zapisz ID procesu do PLIK"
#: src/main/help.c:453
msgid "show this help and exit"
msgstr "wyświetl te informacje z pomocą i wyjdź"
#: src/main/help.c:408
#: src/main/help.c:456
msgid "show version information and exit"
msgstr "wyświetl informacje o wersji i wyjdź"
#: src/main/help.c:412
#: src/main/help.c:460
msgid "write debug logs to FILE"
msgstr ""
msgstr "zapisz logi debugujące do PLIK"
#: src/main/help.c:437
#: src/main/help.c:486
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Sposób użycia: %s [OPCJA] [PLIK]..."
#: src/main/help.c:448
#: src/main/help.c:497
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"Łączenie PLIK(ów) lub wejścia standardowego, do wyjścia standardowego z "
"monitoringiem."
"monitorowaniem."
#: src/main/help.c:585
#: src/main/help.c:639
msgid "Supported format sequences:"
msgstr "Wspierane sekwencje formatowania:"
#: src/main/help.c:653
#, 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
msgid "state allocation failed"
msgstr ""
#: src/main/main.c:225
msgid "(input)"
msgstr "(wejście)"
#: src/main/options.c:174
msgid "option structure allocation failed"
msgstr "nie udało się zaalokować struktur opcji"
#: src/main/main.c:381 src/main/options.c:1359
msgid "a command to run must be specified"
msgstr "polecenie do uruchomienia musi zostać określone"
#: src/main/options.c:193
msgid "option structure argv allocation failed"
msgstr "nie udało się zaalokować struktur opcji argv"
#: src/main/main.c:704 src/main/options.c:757 src/main/options.c:777
#: src/pv/display.c:1086 src/pv/state.c:45 src/pv/state.c:902
#: src/pv/state.c:914 src/pv/state.c:950 src/pv/transfer.c:1335
#: src/pv/transfer.c:1451 src/pv/transfer.c:1778
msgid "memory allocation failure"
msgstr "błąd przydziału pamięci"
#: src/main/options.c:255
msgid "integer argument expected"
msgstr ""
#: src/main/options.c:418
msgid "list files may not contain @ lines"
msgstr "pliki list nie mogą zawierać linii wykorzystujących @"
#: src/main/options.c:266
msgid "numeric argument expected"
msgstr ""
#: src/main/options.c:277
#: src/main/options.c:438 src/main/options.c:440 src/main/options.c:901
msgid "process ID or pid:fd pair expected"
msgstr ""
msgstr "oczekiwany proces ID lub para PID:FD"
#: src/main/options.c:284
#: src/main/options.c:449 src/main/options.c:451 src/main/options.c:908
msgid "invalid process ID"
msgstr ""
msgstr "niepoprawne ID procesu"
#: src/main/options.c:388 src/pv/file.c:323
msgid "failed to stat file"
msgstr "nie udało się wykonać operacji stat na pliku"
#: src/main/options.c:829
msgid "numeric value not understood"
msgstr "wartość liczbowa niezrozumiana"
#: src/main/options.c:491
#: src/main/options.c:843
msgid "integer argument expected"
msgstr "oczekiwany argument typu liczby całkowitej"
#: src/main/options.c:853
msgid "numeric argument expected"
msgstr "oczekiwany argument liczbowy"
#: src/main/options.c:864
msgid "missing filename"
msgstr "brakująca nazwa pliku"
#: src/main/options.c:890
msgid "missing process name"
msgstr "brakująca nazwa procesu"
#: src/main/options.c:1182
msgid "invalid side specification"
msgstr "niepoprawne określenie monitorowanych stron"
#: src/main/options.c:1197
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Spróbuj `%s --help' by uzyskać więcej informacji"
msgstr "Spróbuj `%s --help' by uzyskać więcej informacji."
#: src/main/options.c:493
#: src/main/options.c:1199
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Spróbuj `%s -h' by uzyskać więcej informacji"
msgstr "Spróbuj `%s -h' by uzyskać więcej informacji."
#: src/main/options.c:524
#: src/main/options.c:1231
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
"nie można użyć trybu zliczania linii lub opcji modyfikujących przesył "
"łącznie z opcją obserwowania deskryptorów plików"
#: src/main/options.c:533
#: src/main/options.c:1239
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
"nie można użyć pozycjonowania kursora łącznie z opcją obserwowania "
"deskryptorów plików"
#: src/main/options.c:542
#: src/main/options.c:1247
msgid "cannot use remote control when watching file descriptors"
msgstr ""
"nie można korzystać ze zdalnego sterowania łącznie z obserwowaniem "
"deskryptorów plików"
#: src/main/options.c:551
#: src/main/options.c:1255
msgid "cannot use remote query when watching file descriptors"
msgstr ""
"nie można korzystać ze zdalnego odczytu łącznie z obserwowaniem deskryptorów "
"plików"
#: src/main/options.c:1263
msgid "cannot transfer files when watching file descriptors"
msgstr ""
msgstr "nie można przesyłać plików z opcją obserwowania deskryptorów plików"
#: src/main/options.c:566
#: src/main/options.c:1287
msgid "not available on systems without /proc/self/fdinfo"
msgstr ""
msgstr "niedostępne na systemach bez /proc/self/fdinfo"
#: src/main/remote.c:302
msgid "message not received"
msgstr ""
#: src/main/options.c:1298
msgid "cannot use remote control and remote query together"
msgstr "nie można użyć zdalnego sterowania i zdalnego odczytu jednocześnie"
#: src/main/remote.c:429
msgid "SA_SIGINFO not supported on this system"
msgstr ""
#: src/main/options.c:1325
msgid "monitor mode cannot be specified with this option"
msgstr "tryb monitorowania nie może być określony z tą opcją"
#: src/main/options.c:1337
msgid "monitor mode cannot be used with store-and-forward"
msgstr "tryb monitorowania nie może być użyty z store-and-forward"
#: src/main/options.c:1348
msgid "files cannot be specified with this option"
msgstr "pliki nie mogą być określone przy użyciu tej opcji"
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
msgstr ""
msgstr "Licencja: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
#: src/main/version.c:29
msgid "This is free software: you are free to change and redistribute it."
msgstr ""
msgstr "To jest wolne oprogramowanie: masz prawo do zmian i redystrybucji."
#: src/main/version.c:30
msgid "There is NO WARRANTY, to the extent permitted by law."
msgstr ""
msgstr "Nie udziela się GWARANCJI w zakresie dozwolonym przez prawo."
#: src/main/version.c:32
msgid "Project web site"
msgstr ""
msgstr "Strona projektu"
#: src/pv/cursor.c:87
msgid "failed to get terminal name"
msgstr ""
# "Przewidywany czas ukończenia" for ETA is too long
#: src/pv/cursor.c:132
#: src/pv/cursor.c:108 src/pv/cursor.c:135
msgid "failed to open lock file"
msgstr ""
msgstr "nie udało się otworzyć pliku blokowania zasobów"
#: src/pv/cursor.c:165
msgid "lock attempt failed"
msgstr ""
#: src/pv/cursor.c:790 src/pv/cursor.c:792
msgid "interrupted by a signal"
msgstr "przerwany przez sygnał"
#: src/pv/cursor.c:426
msgid "failed to open terminal"
msgstr "nie udało się otworzyć terminala"
#: src/pv/display.c:193
#: src/pv/display.c:311
msgid "yzafpnum kMGTPEZY"
msgstr ""
msgstr "yzafpnum kMGTPEZY"
#: src/pv/display.c:211
#: src/pv/display.c:329
msgid "yzafpnum KMGTPEZY"
msgstr ""
msgstr "yzafpnum KMGTPEZY"
#: src/pv/display.c:750 src/pv/transfer.c:954
msgid "buffer allocation failed"
msgstr "nie udało się zaalokować bufora"
#: src/pv/file.c:81
msgid "/dev/null is not usable"
msgstr "/dev/null nie nadaje się do użytku"
#: src/pv/display.c:856
msgid "b"
msgstr ""
#: src/pv/file.c:371
msgid "error closing file"
msgstr "błąd zamknięcia pliku"
#: src/pv/display.c:859 src/pv/transfer.c:596
msgid "B"
msgstr "B"
#: src/pv/file.c:438
msgid "input file is also the output"
msgstr "plik wejściowy jest również plikiem wyjściowym"
#: src/pv/display.c:900 src/pv/display.c:916
#: src/pv/file.c:596
msgid "(none)"
msgstr "(brak)"
#: src/pv/file.c:598
msgid "(stdin)"
msgstr "(stdin)"
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:181
msgid "b/s"
msgstr ""
msgstr "b/s"
#: src/pv/display.c:905 src/pv/display.c:920
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr "/s"
#: src/pv/display.c:905 src/pv/display.c:920
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:181
msgid "B/s"
msgstr "B/s"
#: src/pv/display.c:947 src/pv/display.c:951 src/pv/display.c:1017
#: src/pv/format/bytes.c:35
msgid "b"
msgstr "b"
#: src/pv/format/bytes.c:39 src/pv/transfer.c:1284
msgid "B"
msgstr "B"
# "Przewidywany czas ukończenia" for ETA is too long
#: src/pv/format/eta.c:63 src/pv/format/eta.c:67
msgid "ETA"
msgstr "ETA"
#: src/pv/file.c:148
msgid "failed to seek to start of output"
msgstr ""
#: src/pv/format/fineta.c:93
msgid "FIN"
msgstr "FIN"
# "Przewidywany czas ukończenia" for ETA is too long
#: src/pv/file.c:293
msgid "failed to close file"
msgstr "nie udało się zamknąć pliku"
#: src/pv/loop.c:180
msgid "rate min/avg/max/mdev"
msgstr "prędkość min/śr/max/odch"
#: src/pv/file.c:316
msgid "failed to read file"
msgstr "nie udało się odczytać pliku"
#: src/pv/loop.c:192
msgid "rate not measured"
msgstr "prędkość niezmierzona"
#: src/pv/file.c:331
msgid "failed to stat output file"
msgstr "nie udało się wykonać operacji stat na pliku wyjściowym"
#: src/pv/file.c:353
msgid "input file is output file"
msgstr "plik wejściowy jest zarazem plikiem wyjściowym"
#: src/pv/file.c:411
msgid "(none)"
msgstr ""
#: src/pv/file.c:413
msgid "(stdin)"
msgstr ""
#: src/pv/loop.c:570 src/pv/loop.c:621 src/pv/loop.c:662 src/pv/watchpid.c:99
#: src/pv/watchpid.c:109 src/pv/watchpid.c:120 src/pv/watchpid.c:128
#: src/pv/watchpid.c:165 src/pv/watchpid.c:184 src/pv/watchpid.c:192
#: src/pv/watchpid.c:202 src/pv/watchpid.c:293 src/pv/watchpid.c:301
#: src/pv/watchpid.c:377 src/pv/watchpid.c:398
#: src/pv/loop.c:1098 src/pv/loop.c:1114 src/pv/loop.c:1132 src/pv/remote.c:93
#: src/pv/remote.c:188 src/pv/remote.c:536 src/pv/remote.c:582
#: src/pv/watchpid.c:123 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:158 src/pv/watchpid.c:194
#: src/pv/watchpid.c:206 src/pv/watchpid.c:218 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:286 src/pv/watchpid.c:401
#: src/pv/watchpid.c:409 src/pv/watchpid.c:556 src/pv/watchpid.c:565
#: src/pv/watchpid.c:586
msgid "pid"
msgstr ""
msgstr "pid"
#: src/pv/state.c:36
msgid "history structure allocation failed"
msgstr ""
#: src/pv/loop.c:1132 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:160 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:288
msgid "fd"
msgstr "fd"
#: src/pv/state.c:391 src/pv/state.c:402
msgid "file list allocation failed"
msgstr ""
#: src/pv/remote.c:242 src/pv/remote.c:636
msgid "message not received"
msgstr "wiadomość nieodebrana"
#: src/pv/transfer.c:458
msgid "read failed"
msgstr "błąd odczytu"
#: src/pv/remote.c:659 src/pv/remote.c:677
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO nie jest wspierane na tym systemie"
#: src/pv/transfer.c:481
#: src/pv/transfer.c:1173
msgid "warning: read errors detected"
msgstr ""
msgstr "ostrzeżenie: błędy odczytu wykryte"
#: src/pv/transfer.c:497
msgid "file is not seekable"
msgstr ""
#: src/pv/transfer.c:575
msgid "failed to seek past error"
msgstr ""
#: src/pv/transfer.c:595
#: src/pv/transfer.c:1283
msgid "skipped past read error"
msgstr ""
msgstr "pominięto błąd odczytu"
#: src/pv/transfer.c:635
msgid "no transfer buffer allocated"
msgstr ""
#: src/pv/transfer.c:676
msgid "failed to set interval timer"
msgstr ""
# "Przewidywany czas ukończenia" for ETA is too long
#: src/pv/transfer.c:694
msgid "failed to clear interval timer"
msgstr ""
#: src/pv/transfer.c:818
msgid "write failed"
#: src/pv/transfer.c:1642
msgid "write error"
msgstr "błąd zapisu"
#: src/pv/transfer.c:1051
msgid "select call failed"
msgstr "nie udało się wywołać funkcji select"
#: src/pv/watchpid.c:109 src/pv/watchpid.c:121 src/pv/watchpid.c:130
#: src/pv/watchpid.c:184 src/pv/watchpid.c:193 src/pv/watchpid.c:204
msgid "fd"
msgstr ""
#: src/pv/watchpid.c:130 src/pv/watchpid.c:204
#: src/pv/watchpid.c:160 src/pv/watchpid.c:288
msgid "not a regular file or block device"
msgstr ""
msgstr "plik nie jest plikiem regularnym lub urządzeniem blokowym"
#~ msgid "state allocation failed"
#~ msgstr "alokacja stanu programu nie powiodła się"
#~ msgid "failed to stat file"
#~ msgstr "nie udało się wykonać operacji stat na pliku"
#~ msgid "is a directory"
#~ msgstr "jest katalogiem"
#~ msgid "failed to generate sysfs filename"
#~ msgstr "nie udało się wygenerować nazwy pliku dla sysfs"
#~ msgid "failed to read sysfs size file"
#~ msgstr "nie udało się odczytać rozmiaru pliku sysfs"
#~ msgid "failed to open block device"
#~ msgstr "nie udało się otworzyć urządzenia blokowego"
#~ msgid "failed to determine size of block device"
#~ msgstr "nie udało się ustalić rozmiaru urządzenia blokowego"
#~ msgid "option structure allocation failed"
#~ msgstr "nie udało się zaalokować struktur opcji"
#~ msgid "option structure argv allocation failed"
#~ msgstr "nie udało się zaalokować struktur opcji argv"
#~ msgid "failed to get terminal name"
#~ msgstr "nie udało się uzyskać nazwy terminala"
#~ msgid "lock attempt failed"
#~ msgstr "blokada zasobów nie powiodła się"
#~ msgid "failed to open terminal"
#~ msgstr "nie udało się otworzyć terminala"
#~ msgid "failed to seek to start of output"
#~ msgstr "nie udało się przewinąć wyjścia do początku"
#~ msgid "failed to read file"
#~ msgstr "nie udało się odczytać pliku"
#~ msgid "failed to stat output file"
#~ msgstr "nie udało się wykonać operacji stat na pliku wyjściowym"
#~ msgid "history structure allocation failed"
#~ msgstr "nie udało się zaalokować struktury historii"
#~ msgid "file list allocation failed"
#~ msgstr "nie udało się zaalokować listy plików"
#~ msgid "read failed"
#~ msgstr "błąd odczytu"
#~ msgid "file is not seekable"
#~ msgstr "pliku nie da się przewijać"
#~ msgid "failed to seek past error"
#~ msgstr "nie udało się przewinąć za błąd"
#~ msgid "no transfer buffer allocated"
#~ msgstr "brak zaalokowanego bufora transferu"
#~ msgid "failed to set interval timer"
#~ msgstr "nie udało się ustawić interwału czasowego"
#~ msgid "failed to clear interval timer"
#~ msgstr "nie udało się wyczyścić interwału czasowego"
#~ msgid "line position buffer allocation failed"
#~ msgstr "alokacja buforu pozycji linii nie powiodła się"
#~ msgid "select call failed"
#~ msgstr "nie udało się wywołać funkcji select"
#~ msgid "process list allocation failed"
#~ msgstr "nie udało się zaalokować listy procesów"
#~ msgid "file descriptor list allocation failed"
#~ msgstr "nie udało się zaalokować listy deskryptorów plików"
#~ msgid "PID[:FD]"
#~ msgstr "PID[:FD]"
+351 -250
View File
@@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: pv@ivarch.com\n"
"POT-Creation-Date: 2024-04-21 14:15+0100\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2026-08-01 14:53+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"
@@ -15,278 +15,354 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/main/help.c:284
#: src/main/help.c:300
msgid "show progress bar"
msgstr "exibe barra de progressão"
#: src/main/help.c:287
#: src/main/help.c:303
msgid "show elapsed time"
msgstr "exibe tempo passado"
#: src/main/help.c:290
#: src/main/help.c:306
msgid "show estimated time of arrival (completion)"
msgstr "exibe o tempo estimado de término"
#: src/main/help.c:293
#: src/main/help.c:309
msgid "show absolute estimated time of arrival (completion)"
msgstr "exibe o tempo absoluto estimado de término"
#: src/main/help.c:296
#: src/main/help.c:312
msgid "show data transfer rate counter"
msgstr "exibe a taxa de transferência"
#: src/main/help.c:299
#: src/main/help.c:315
msgid "show data transfer average rate counter"
msgstr "exibe o contador da taxa média de transferência de dados"
#: src/main/help.c:301 src/main/help.c:332 src/main/help.c:344
msgid "SEC"
msgstr ""
#: src/main/help.c:302
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
#: src/main/help.c:305
#: src/main/help.c:318
msgid "show number of bytes transferred"
msgstr "exibe a quantidade de bytes transferidos"
#: src/main/help.c:308
msgid "show number of bits transferred"
msgstr ""
#: src/main/help.c:311
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr ""
#: src/main/help.c:314
#: src/main/help.c:321
msgid "show percentage of transfer buffer in use"
msgstr "exibe a porcentagem de buffer de transferência em uso"
#: src/main/help.c:316
#: src/main/help.c:323
msgid "NUM"
msgstr ""
#: src/main/help.c:317
#: src/main/help.c:324
msgid "show NUM bytes last written"
msgstr "exibe NUM bytes gravados pela última vez"
#: src/main/help.c:319
#: src/main/help.c:326
msgid "FORMAT"
msgstr ""
#: src/main/help.c:320
#: src/main/help.c:327
msgid "set output format to FORMAT"
msgstr "definir o formato de saída para FORMAT"
#: src/main/help.c:323
#: src/main/help.c:330
msgid "output percentages, not visual information"
msgstr "exibe apenas as porcentagens, sem informações visuais"
#: src/main/help.c:326
#: src/main/help.c:333
msgid "do not output any transfer information at all"
msgstr "executa programa sem exibir quaisquer informações"
#: src/main/help.c:330
#: src/main/help.c:337
msgid "show number of bits transferred"
msgstr ""
#: src/main/help.c:340
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr ""
#: src/main/help.c:343
msgid "display nothing until first byte transferred"
msgstr "não exibe nada até iniciar o processamento"
#: src/main/help.c:333
#: src/main/help.c:345 src/main/help.c:360 src/main/help.c:363
msgid "SEC"
msgstr ""
#: src/main/help.c:346
msgid "display nothing until SEC seconds have passed"
msgstr "não exibir nada até que os segundos SEC tenham passado"
#: src/main/help.c:335
#: src/main/help.c:348
msgid "SIZE"
msgstr ""
#: src/main/help.c:336
#: src/main/help.c:349
msgid "set estimated data size to SIZE bytes"
msgstr "seta a quantidade estimada de dados em SIZE bytes"
#: src/main/help.c:339
#: src/main/help.c:352
msgid "if size unknown, show rate vs max rate"
msgstr ""
#: src/main/help.c:355
msgid "count lines instead of bytes"
msgstr "contar linhas em vez de bytes"
#: src/main/help.c:342
#: src/main/help.c:358
msgid "lines are null-terminated"
msgstr "linhas são terminadas em nulo"
#: src/main/help.c:345
#: src/main/help.c:361
msgid "update every SEC seconds"
msgstr "atualiza informações a cada SEC segundos"
#: src/main/help.c:347
#: src/main/help.c:364
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
#: src/main/help.c:366
msgid "WIDTH"
msgstr ""
#: src/main/help.c:348
#: src/main/help.c:367
msgid "assume terminal is WIDTH characters wide"
msgstr "presuma que o terminal tem WIDTH caracteres de largura"
#: src/main/help.c:350
#: src/main/help.c:369
msgid "HEIGHT"
msgstr ""
#: src/main/help.c:351
#: src/main/help.c:370
msgid "assume terminal is HEIGHT rows high"
msgstr "presuma que o terminal tem HEIGHT caracteres de altura"
#: src/main/help.c:353
#: src/main/help.c:372
msgid "NAME"
msgstr ""
#: src/main/help.c:354
#: src/main/help.c:373
msgid "prefix visual information with NAME"
msgstr "exibe NAME antes das demais informações"
#: src/main/help.c:357
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:360
msgid "use cursor positioning escape sequences"
msgstr "utiliza caracteres de escape para posicionar o cursor"
#: src/main/help.c:363
msgid "RATE"
#: src/main/help.c:375
msgid "STYLE"
msgstr ""
#: src/main/help.c:364
msgid "limit transfer to RATE bytes per second"
msgstr "limita a transferência a RATE bytes por segundo"
#: src/main/help.c:366 src/main/help.c:375
msgid "BYTES"
msgstr ""
#: src/main/help.c:367
msgid "use a buffer size of BYTES"
msgstr "use um tamanho de buffer de BYTES"
#: src/main/help.c:370
msgid "never use splice(), always use read/write"
msgstr "nunca use splice(), sempre use read/write"
#: src/main/help.c:373
msgid "skip read errors in input"
msgstr "ignorar erros de leitura em entrada"
#: src/main/help.c:376
msgid "skip errors in BYTES blocks at a time"
msgid "set default bar style to STYLE"
msgstr ""
#: src/main/help.c:378
msgid "SPEC"
msgstr ""
#: src/main/help.c:379
msgid "stop after --size bytes have been transferred"
msgstr "parar após --size bytes terem sido transferidos"
msgid "also send progress to SPEC"
msgstr ""
#: src/main/help.c:382
msgid "flush cache to disk after every write"
msgid "set terminal progress state with OSC 9;4 (ConEmu)"
msgstr ""
#: src/main/help.c:385
msgid "use direct I/O to bypass cache"
msgid "output transfer statistics at the end"
msgstr ""
#: src/main/help.c:388
msgid "discard input instead of writing to output"
msgstr ""
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:391
msgid "PID"
msgstr ""
msgid "use cursor positioning escape sequences"
msgstr "utiliza caracteres de escape para posicionar o cursor"
#: src/main/help.c:392
msgid "update settings of process PID"
msgstr "atualizar as configurações do processo PID"
#: src/main/help.c:396 src/main/help.c:411
#: src/main/help.c:394 src/main/help.c:430 src/main/help.c:449
#: src/main/help.c:459
msgid "FILE"
msgstr ""
#: src/main/help.c:397
msgid "save process ID in FILE"
msgstr "salvar ID do processo em FILE"
#: src/main/help.c:395
msgid "write output to FILE instead of stdout"
msgstr ""
#: src/main/help.c:400
msgid "PID[:FD]"
#: src/main/help.c:397
msgid "RATE"
msgstr ""
#: src/main/help.c:398
msgid "limit transfer to RATE bytes per second"
msgstr "limita a transferência a RATE bytes por segundo"
#: src/main/help.c:400 src/main/help.c:406 src/main/help.c:412
msgid "BYTES"
msgstr ""
#: src/main/help.c:401
msgid "use a buffer size of BYTES"
msgstr "use um tamanho de buffer de BYTES"
#: src/main/help.c:404
msgid "never use splice(), always use read/write"
msgstr "nunca use splice(), sempre use read/write"
#: src/main/help.c:407
msgid "set the pipe buffer size to BYTES"
msgstr ""
#: src/main/help.c:410
msgid "skip read errors in input"
msgstr "ignorar erros de leitura em entrada"
#: src/main/help.c:413
msgid "skip errors in BYTES blocks at a time"
msgstr ""
#: src/main/help.c:416
msgid "stop after --size bytes have been transferred"
msgstr "parar após --size bytes terem sido transferidos"
#: src/main/help.c:419
msgid "flush cache to disk after every write"
msgstr ""
#: src/main/help.c:422
msgid "use direct I/O to bypass cache"
msgstr ""
#: src/main/help.c:425
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:428
msgid "discard input instead of writing to output"
msgstr ""
#: src/main/help.c:431
msgid "write all input to FILE before writing to output"
msgstr ""
#: src/main/help.c:434
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:435
msgid "watch file FD opened by process PID"
msgstr "assistir arquivo FD aberto pelo processo PID"
#: src/main/help.c:405
#: src/main/help.c:438 src/main/help.c:441
msgid "PID"
msgstr ""
#: src/main/help.c:439
msgid "update settings of process PID"
msgstr "atualizar as configurações do processo PID"
#: src/main/help.c:442
msgid "show progress of process PID"
msgstr ""
#: src/main/help.c:446
msgid "run a command and monitor its standard input, output, or both"
msgstr ""
#: src/main/help.c:450
msgid "save process ID in FILE"
msgstr "salvar ID do processo em FILE"
#: src/main/help.c:453
msgid "show this help and exit"
msgstr "exibe esta tela de ajuda e termina"
#: src/main/help.c:408
#: src/main/help.c:456
msgid "show version information and exit"
msgstr "exibe a versão e termina"
#: src/main/help.c:412
#: src/main/help.c:460
msgid "write debug logs to FILE"
msgstr ""
#: src/main/help.c:437
#: src/main/help.c:486
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Uso: %s [OPÇÕES] [ARQUIVOS]..."
#: src/main/help.c:448
#: src/main/help.c:497
msgid ""
"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, com "
"monitoramento."
#: src/main/help.c:585
#: src/main/help.c:639
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:653
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Por favor, reporte quaisquer defeitos para %s"
#: src/main/main.c:74
msgid "state allocation failed"
msgstr "alocação de memória de status falhou"
#: src/main/main.c:225
msgid "(input)"
msgstr ""
#: src/main/options.c:174
msgid "option structure allocation failed"
msgstr "erro na alocação da estrutura de opções"
#: src/main/main.c:381 src/main/options.c:1359
msgid "a command to run must be specified"
msgstr ""
#: src/main/options.c:193
msgid "option structure argv allocation failed"
msgstr "erro na alocação da estrutura de opções argv"
#: src/main/main.c:704 src/main/options.c:757 src/main/options.c:777
#: src/pv/display.c:1086 src/pv/state.c:45 src/pv/state.c:902
#: src/pv/state.c:914 src/pv/state.c:950 src/pv/transfer.c:1335
#: src/pv/transfer.c:1451 src/pv/transfer.c:1778
msgid "memory allocation failure"
msgstr "falha de alocação de memória"
#: src/main/options.c:255
msgid "integer argument expected"
msgstr "argumento inteiro esperado"
#: src/main/options.c:418
msgid "list files may not contain @ lines"
msgstr ""
#: src/main/options.c:266
msgid "numeric argument expected"
msgstr "argumento numérico esperado"
#: src/main/options.c:277
#: src/main/options.c:438 src/main/options.c:440 src/main/options.c:901
msgid "process ID or pid:fd pair expected"
msgstr "ID do processo ou par pid:fd esperado"
#: src/main/options.c:284
#: src/main/options.c:449 src/main/options.c:451 src/main/options.c:908
msgid "invalid process ID"
msgstr "ID de processo inválido"
#: src/main/options.c:388 src/pv/file.c:323
msgid "failed to stat file"
msgstr "erro obtendo informações do arquivo"
#: src/main/options.c:829
msgid "numeric value not understood"
msgstr ""
#: src/main/options.c:491
#: src/main/options.c:843
msgid "integer argument expected"
msgstr "argumento inteiro esperado"
#: src/main/options.c:853
msgid "numeric argument expected"
msgstr "argumento numérico esperado"
#: src/main/options.c:864
msgid "missing filename"
msgstr ""
#: src/main/options.c:890
msgid "missing process name"
msgstr ""
#: src/main/options.c:1182
msgid "invalid side specification"
msgstr ""
#: src/main/options.c:1197
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Tente `%s --help' para maiores informações."
#: src/main/options.c:493
#: src/main/options.c:1199
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Tente `%s -h' para maiores informações."
#: src/main/options.c:524
#: src/main/options.c:1231
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
@@ -294,31 +370,43 @@ 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:533
#: src/main/options.c:1239
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:542
#: src/main/options.c:1247
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:551
#: src/main/options.c:1255
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1263
msgid "cannot transfer files when watching file descriptors"
msgstr "não pode transferir arquivos ao assistir descritores de arquivo"
#: src/main/options.c:566
#: src/main/options.c:1287
msgid "not available on systems without /proc/self/fdinfo"
msgstr "não disponível em sistemas sem /proc/self/fdinfo"
#: src/main/remote.c:302
msgid "message not received"
msgstr "mensagem não recebida"
#: src/main/options.c:1298
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/remote.c:429
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO não suportado neste sistema"
#: src/main/options.c:1325
msgid "monitor mode cannot be specified with this option"
msgstr ""
#: src/main/options.c:1337
msgid "monitor mode cannot be used with store-and-forward"
msgstr ""
#: src/main/options.c:1348
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
@@ -336,147 +424,160 @@ msgstr ""
msgid "Project web site"
msgstr ""
#: src/pv/cursor.c:87
msgid "failed to get terminal name"
msgstr "erro ao ler o nome do terminal"
#: src/pv/cursor.c:132
#: src/pv/cursor.c:108 src/pv/cursor.c:135
msgid "failed to open lock file"
msgstr "erro ao abrir arquivo de bloqueio"
#: src/pv/cursor.c:165
msgid "lock attempt failed"
msgstr "tentativa de bloqueio falhou"
#: src/pv/cursor.c:790 src/pv/cursor.c:792
msgid "interrupted by a signal"
msgstr "interrompido por um sinal"
#: src/pv/cursor.c:426
msgid "failed to open terminal"
msgstr "erro abrindo o terminal"
#: src/pv/display.c:193
#: src/pv/display.c:311
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:211
#: src/pv/display.c:329
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/display.c:750 src/pv/transfer.c:954
msgid "buffer allocation failed"
msgstr "erro alocando o buffer"
#: src/pv/display.c:856
msgid "b"
#: src/pv/file.c:81
msgid "/dev/null is not usable"
msgstr ""
#: src/pv/display.c:859 src/pv/transfer.c:596
msgid "B"
msgstr ""
#: src/pv/file.c:371
msgid "error closing file"
msgstr "erro ao fechar o ficheiro"
#: src/pv/display.c:900 src/pv/display.c:916
msgid "b/s"
msgstr ""
#: src/pv/file.c:438
msgid "input file is also the output"
msgstr "ficheiro de entrada também é a saída"
#: src/pv/display.c:905 src/pv/display.c:920
msgid "/s"
msgstr ""
#: src/pv/display.c:905 src/pv/display.c:920
msgid "B/s"
msgstr "B/s"
#: src/pv/display.c:947 src/pv/display.c:951 src/pv/display.c:1017
msgid "ETA"
msgstr "ETA"
#: src/pv/file.c:148
msgid "failed to seek to start of output"
msgstr "não pode mover para o início da produção"
#: src/pv/file.c:293
msgid "failed to close file"
msgstr "erro fechando o arquivo"
#: src/pv/file.c:316
msgid "failed to read file"
msgstr "erro lendo o arquivo"
#: src/pv/file.c:331
msgid "failed to stat output file"
msgstr "erro obtendo informações do arquivo de saída"
#: src/pv/file.c:353
msgid "input file is output file"
msgstr "os arquivos de entrada e saída são o mesmo"
#: src/pv/file.c:411
#: src/pv/file.c:596
msgid "(none)"
msgstr ""
#: src/pv/file.c:413
#: src/pv/file.c:598
msgid "(stdin)"
msgstr ""
#: src/pv/loop.c:570 src/pv/loop.c:621 src/pv/loop.c:662 src/pv/watchpid.c:99
#: src/pv/watchpid.c:109 src/pv/watchpid.c:120 src/pv/watchpid.c:128
#: src/pv/watchpid.c:165 src/pv/watchpid.c:184 src/pv/watchpid.c:192
#: src/pv/watchpid.c:202 src/pv/watchpid.c:293 src/pv/watchpid.c:301
#: src/pv/watchpid.c:377 src/pv/watchpid.c:398
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:181
msgid "b/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:181
msgid "B/s"
msgstr "B/s"
#: src/pv/format/bytes.c:35
msgid "b"
msgstr ""
#: src/pv/format/bytes.c:39 src/pv/transfer.c:1284
msgid "B"
msgstr ""
#: src/pv/format/eta.c:63 src/pv/format/eta.c:67
msgid "ETA"
msgstr "ETA"
#: src/pv/format/fineta.c:93
msgid "FIN"
msgstr ""
#: src/pv/loop.c:180
msgid "rate min/avg/max/mdev"
msgstr ""
#: src/pv/loop.c:192
msgid "rate not measured"
msgstr ""
#: src/pv/loop.c:1098 src/pv/loop.c:1114 src/pv/loop.c:1132 src/pv/remote.c:93
#: src/pv/remote.c:188 src/pv/remote.c:536 src/pv/remote.c:582
#: src/pv/watchpid.c:123 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:158 src/pv/watchpid.c:194
#: src/pv/watchpid.c:206 src/pv/watchpid.c:218 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:286 src/pv/watchpid.c:401
#: src/pv/watchpid.c:409 src/pv/watchpid.c:556 src/pv/watchpid.c:565
#: src/pv/watchpid.c:586
msgid "pid"
msgstr ""
#: src/pv/state.c:36
msgid "history structure allocation failed"
msgstr ""
#: src/pv/state.c:391 src/pv/state.c:402
msgid "file list allocation failed"
msgstr ""
#: src/pv/transfer.c:458
msgid "read failed"
msgstr "erro de leitura"
#: src/pv/transfer.c:481
msgid "warning: read errors detected"
msgstr "aviso: erros de leitura detectados"
#: src/pv/transfer.c:497
msgid "file is not seekable"
msgstr "não pode mover dentro do arquivo"
#: src/pv/transfer.c:575
msgid "failed to seek past error"
msgstr "não pode ir além do erro"
#: src/pv/transfer.c:595
msgid "skipped past read error"
msgstr "ignorado erro de leitura"
#: src/pv/transfer.c:635
msgid "no transfer buffer allocated"
msgstr ""
#: src/pv/transfer.c:676
msgid "failed to set interval timer"
msgstr ""
#: src/pv/transfer.c:694
msgid "failed to clear interval timer"
msgstr ""
#: src/pv/transfer.c:818
msgid "write failed"
msgstr "erro de gravação"
#: src/pv/transfer.c:1051
msgid "select call failed"
msgstr "erro na chamada da função select"
#: src/pv/watchpid.c:109 src/pv/watchpid.c:121 src/pv/watchpid.c:130
#: src/pv/watchpid.c:184 src/pv/watchpid.c:193 src/pv/watchpid.c:204
#: src/pv/loop.c:1132 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:160 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:288
msgid "fd"
msgstr ""
#: src/pv/watchpid.c:130 src/pv/watchpid.c:204
#: src/pv/remote.c:242 src/pv/remote.c:636
msgid "message not received"
msgstr "mensagem não recebida"
#: src/pv/remote.c:659 src/pv/remote.c:677
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO não suportado neste sistema"
#: src/pv/transfer.c:1173
msgid "warning: read errors detected"
msgstr "aviso: erros de leitura detectados"
#: src/pv/transfer.c:1283
msgid "skipped past read error"
msgstr "ignorado erro de leitura"
#: src/pv/transfer.c:1642
msgid "write error"
msgstr "erro de escrita"
#: src/pv/watchpid.c:160 src/pv/watchpid.c:288
msgid "not a regular file or block device"
msgstr "não é um arquivo regular ou dispositivo de bloqueio"
#~ msgid "state allocation failed"
#~ msgstr "alocação de memória de status falhou"
#~ msgid "failed to stat file"
#~ msgstr "erro obtendo informações do arquivo"
#~ msgid "option structure allocation failed"
#~ msgstr "erro na alocação da estrutura de opções"
#~ msgid "option structure argv allocation failed"
#~ msgstr "erro na alocação da estrutura de opções argv"
#~ msgid "failed to get terminal name"
#~ msgstr "erro ao ler o nome do terminal"
#~ msgid "lock attempt failed"
#~ msgstr "tentativa de bloqueio falhou"
#~ msgid "failed to open terminal"
#~ 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"
#~ msgid "failed to read file"
#~ msgstr "erro lendo o arquivo"
#~ msgid "failed to stat output file"
#~ msgstr "erro obtendo informações do arquivo de saída"
#~ msgid "read failed"
#~ msgstr "erro de leitura"
#~ msgid "file is not seekable"
#~ msgstr "não pode mover dentro do arquivo"
#~ msgid "failed to seek past error"
#~ msgstr "não pode ir além do erro"
#~ msgid "select call failed"
#~ msgstr "erro na chamada da função select"
+530
View File
@@ -0,0 +1,530 @@
msgid ""
msgstr ""
"Project-Id-Version: pv 1.11.0\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2026-08-01 14:53+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Language-Team: Romanian <https://translate.codeberg.org/projects/pv/pv/ro/>\n"
"Language: ro\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/main/help.c:300
msgid "show progress bar"
msgstr ""
#: src/main/help.c:303
msgid "show elapsed time"
msgstr ""
#: src/main/help.c:306
msgid "show estimated time of arrival (completion)"
msgstr ""
#: src/main/help.c:309
msgid "show absolute estimated time of arrival (completion)"
msgstr ""
#: src/main/help.c:312
msgid "show data transfer rate counter"
msgstr ""
#: src/main/help.c:315
msgid "show data transfer average rate counter"
msgstr ""
#: src/main/help.c:318
msgid "show number of bytes transferred"
msgstr ""
#: src/main/help.c:321
msgid "show percentage of transfer buffer in use"
msgstr ""
#: src/main/help.c:323
msgid "NUM"
msgstr ""
#: src/main/help.c:324
msgid "show NUM bytes last written"
msgstr ""
#: src/main/help.c:326
msgid "FORMAT"
msgstr ""
#: src/main/help.c:327
msgid "set output format to FORMAT"
msgstr ""
#: src/main/help.c:330
msgid "output percentages, not visual information"
msgstr ""
#: src/main/help.c:333
msgid "do not output any transfer information at all"
msgstr ""
#: src/main/help.c:337
msgid "show number of bits transferred"
msgstr ""
#: src/main/help.c:340
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr ""
#: src/main/help.c:343
msgid "display nothing until first byte transferred"
msgstr ""
#: src/main/help.c:345 src/main/help.c:360 src/main/help.c:363
msgid "SEC"
msgstr ""
#: src/main/help.c:346
msgid "display nothing until SEC seconds have passed"
msgstr ""
#: src/main/help.c:348
msgid "SIZE"
msgstr ""
#: src/main/help.c:349
msgid "set estimated data size to SIZE bytes"
msgstr ""
#: src/main/help.c:352
msgid "if size unknown, show rate vs max rate"
msgstr ""
#: src/main/help.c:355
msgid "count lines instead of bytes"
msgstr ""
#: src/main/help.c:358
msgid "lines are null-terminated"
msgstr ""
#: src/main/help.c:361
msgid "update every SEC seconds"
msgstr ""
#: src/main/help.c:364
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr ""
#: src/main/help.c:366
msgid "WIDTH"
msgstr ""
#: src/main/help.c:367
msgid "assume terminal is WIDTH characters wide"
msgstr ""
#: src/main/help.c:369
msgid "HEIGHT"
msgstr ""
#: src/main/help.c:370
msgid "assume terminal is HEIGHT rows high"
msgstr ""
#: src/main/help.c:372
msgid "NAME"
msgstr ""
#: src/main/help.c:373
msgid "prefix visual information with NAME"
msgstr ""
#: src/main/help.c:375
msgid "STYLE"
msgstr ""
#: src/main/help.c:376
msgid "set default bar style to STYLE"
msgstr ""
#: src/main/help.c:378
msgid "SPEC"
msgstr ""
#: src/main/help.c:379
msgid "also send progress to SPEC"
msgstr ""
#: src/main/help.c:382
msgid "set terminal progress state with OSC 9;4 (ConEmu)"
msgstr ""
#: src/main/help.c:385
msgid "output transfer statistics at the end"
msgstr ""
#: src/main/help.c:388
msgid "output even if standard error is not a terminal"
msgstr ""
#: src/main/help.c:391
msgid "use cursor positioning escape sequences"
msgstr ""
#: src/main/help.c:394 src/main/help.c:430 src/main/help.c:449
#: src/main/help.c:459
msgid "FILE"
msgstr ""
#: src/main/help.c:395
msgid "write output to FILE instead of stdout"
msgstr ""
#: src/main/help.c:397
msgid "RATE"
msgstr ""
#: src/main/help.c:398
msgid "limit transfer to RATE bytes per second"
msgstr ""
#: src/main/help.c:400 src/main/help.c:406 src/main/help.c:412
msgid "BYTES"
msgstr ""
#: src/main/help.c:401
msgid "use a buffer size of BYTES"
msgstr ""
#: src/main/help.c:404
msgid "never use splice(), always use read/write"
msgstr ""
#: src/main/help.c:407
msgid "set the pipe buffer size to BYTES"
msgstr ""
#: src/main/help.c:410
msgid "skip read errors in input"
msgstr ""
#: src/main/help.c:413
msgid "skip errors in BYTES blocks at a time"
msgstr ""
#: src/main/help.c:416
msgid "stop after --size bytes have been transferred"
msgstr ""
#: src/main/help.c:419
msgid "flush cache to disk after every write"
msgstr ""
#: src/main/help.c:422
msgid "use direct I/O to bypass cache"
msgstr ""
#: src/main/help.c:425
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:428
msgid "discard input instead of writing to output"
msgstr ""
#: src/main/help.c:431
msgid "write all input to FILE before writing to output"
msgstr ""
#: src/main/help.c:434
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:435
msgid "watch file FD opened by process PID"
msgstr ""
#: src/main/help.c:438 src/main/help.c:441
msgid "PID"
msgstr ""
#: src/main/help.c:439
msgid "update settings of process PID"
msgstr ""
#: src/main/help.c:442
msgid "show progress of process PID"
msgstr ""
#: src/main/help.c:446
msgid "run a command and monitor its standard input, output, or both"
msgstr ""
#: src/main/help.c:450
msgid "save process ID in FILE"
msgstr ""
#: src/main/help.c:453
msgid "show this help and exit"
msgstr ""
#: src/main/help.c:456
msgid "show version information and exit"
msgstr ""
#: src/main/help.c:460
msgid "write debug logs to FILE"
msgstr ""
#: src/main/help.c:486
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr ""
#: src/main/help.c:497
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
#: src/main/help.c:639
msgid "Supported format sequences:"
msgstr ""
#: src/main/help.c:653
#, c-format
msgid "Please report any bugs to: %s"
msgstr ""
#: src/main/main.c:225
msgid "(input)"
msgstr ""
#: src/main/main.c:381 src/main/options.c:1359
msgid "a command to run must be specified"
msgstr ""
#: src/main/main.c:704 src/main/options.c:757 src/main/options.c:777
#: src/pv/display.c:1086 src/pv/state.c:45 src/pv/state.c:902
#: src/pv/state.c:914 src/pv/state.c:950 src/pv/transfer.c:1335
#: src/pv/transfer.c:1451 src/pv/transfer.c:1778
msgid "memory allocation failure"
msgstr ""
#: src/main/options.c:418
msgid "list files may not contain @ lines"
msgstr ""
#: src/main/options.c:438 src/main/options.c:440 src/main/options.c:901
msgid "process ID or pid:fd pair expected"
msgstr ""
#: src/main/options.c:449 src/main/options.c:451 src/main/options.c:908
msgid "invalid process ID"
msgstr ""
#: src/main/options.c:829
msgid "numeric value not understood"
msgstr ""
#: src/main/options.c:843
msgid "integer argument expected"
msgstr ""
#: src/main/options.c:853
msgid "numeric argument expected"
msgstr ""
#: src/main/options.c:864
msgid "missing filename"
msgstr ""
#: src/main/options.c:890
msgid "missing process name"
msgstr ""
#: src/main/options.c:1182
msgid "invalid side specification"
msgstr ""
#: src/main/options.c:1197
#, c-format
msgid "Try `%s --help' for more information."
msgstr ""
#: src/main/options.c:1199
#, c-format
msgid "Try `%s -h' for more information."
msgstr ""
#: src/main/options.c:1231
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
#: src/main/options.c:1239
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
#: src/main/options.c:1247
msgid "cannot use remote control when watching file descriptors"
msgstr ""
#: src/main/options.c:1255
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1263
msgid "cannot transfer files when watching file descriptors"
msgstr ""
#: src/main/options.c:1287
msgid "not available on systems without /proc/self/fdinfo"
msgstr ""
#: src/main/options.c:1298
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/options.c:1325
msgid "monitor mode cannot be specified with this option"
msgstr ""
#: src/main/options.c:1337
msgid "monitor mode cannot be used with store-and-forward"
msgstr ""
#: src/main/options.c:1348
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
msgstr ""
#: 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 ""
#: src/main/version.c:32
msgid "Project web site"
msgstr ""
#: src/pv/cursor.c:108 src/pv/cursor.c:135
msgid "failed to open lock file"
msgstr ""
#: src/pv/cursor.c:790 src/pv/cursor.c:792
msgid "interrupted by a signal"
msgstr ""
#: src/pv/display.c:311
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:329
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/file.c:81
msgid "/dev/null is not usable"
msgstr ""
#: src/pv/file.c:371
msgid "error closing file"
msgstr ""
#: src/pv/file.c:438
msgid "input file is also the output"
msgstr ""
#: src/pv/file.c:596
msgid "(none)"
msgstr ""
#: src/pv/file.c:598
msgid "(stdin)"
msgstr ""
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:181
msgid "b/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr ""
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:181
msgid "B/s"
msgstr ""
#: src/pv/format/bytes.c:35
msgid "b"
msgstr ""
#: src/pv/format/bytes.c:39 src/pv/transfer.c:1284
msgid "B"
msgstr ""
#: src/pv/format/eta.c:63 src/pv/format/eta.c:67
msgid "ETA"
msgstr ""
#: src/pv/format/fineta.c:93
msgid "FIN"
msgstr ""
#: src/pv/loop.c:180
msgid "rate min/avg/max/mdev"
msgstr ""
#: src/pv/loop.c:192
msgid "rate not measured"
msgstr ""
#: src/pv/loop.c:1098 src/pv/loop.c:1114 src/pv/loop.c:1132 src/pv/remote.c:93
#: src/pv/remote.c:188 src/pv/remote.c:536 src/pv/remote.c:582
#: src/pv/watchpid.c:123 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:158 src/pv/watchpid.c:194
#: src/pv/watchpid.c:206 src/pv/watchpid.c:218 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:286 src/pv/watchpid.c:401
#: src/pv/watchpid.c:409 src/pv/watchpid.c:556 src/pv/watchpid.c:565
#: src/pv/watchpid.c:586
msgid "pid"
msgstr ""
#: src/pv/loop.c:1132 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:160 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:288
msgid "fd"
msgstr ""
#: src/pv/remote.c:242 src/pv/remote.c:636
msgid "message not received"
msgstr ""
#: src/pv/remote.c:659 src/pv/remote.c:677
msgid "SA_SIGINFO not supported on this system"
msgstr ""
#: src/pv/transfer.c:1173
msgid "warning: read errors detected"
msgstr ""
#: src/pv/transfer.c:1283
msgid "skipped past read error"
msgstr ""
#: src/pv/transfer.c:1642
msgid "write error"
msgstr ""
#: src/pv/watchpid.c:160 src/pv/watchpid.c:288
msgid "not a regular file or block device"
msgstr ""
+600
View File
@@ -0,0 +1,600 @@
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2026-08-01 14:53+0100\n"
"PO-Revision-Date: 2026-08-17 12:27+0000\n"
"Last-Translator: some_user <some_user@noreply.codeberg.org>\n"
"Language-Team: Russian <https://translate.codeberg.org/projects/pv/pv/ru/>\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 2026.8.1\n"
#: src/main/help.c:300
msgid "show progress bar"
msgstr "показать полосу прогресса"
#: src/main/help.c:303
msgid "show elapsed time"
msgstr "показать прошедшее время"
#: src/main/help.c:306
msgid "show estimated time of arrival (completion)"
msgstr "показать примерное время завершения"
#: src/main/help.c:309
msgid "show absolute estimated time of arrival (completion)"
msgstr "показать примерное абсолютное время завершения"
#: src/main/help.c:312
msgid "show data transfer rate counter"
msgstr "показать скорость передачи данных"
#: src/main/help.c:315
msgid "show data transfer average rate counter"
msgstr "показать среднюю скорость передачи данных"
#: src/main/help.c:318
msgid "show number of bytes transferred"
msgstr "показать объём переданных данных в байтах"
#: src/main/help.c:321
msgid "show percentage of transfer buffer in use"
msgstr "показать использование буфера передачи в процентах"
#: src/main/help.c:323
msgid "NUM"
msgstr "КОЛ"
#: src/main/help.c:324
msgid "show NUM bytes last written"
msgstr "показать КОЛ байт, переданных в последний раз"
#: src/main/help.c:326
msgid "FORMAT"
msgstr "ФОРМАТ"
#: src/main/help.c:327
msgid "set output format to FORMAT"
msgstr "указать формат вывода как ФОРМАТ"
#: src/main/help.c:330
msgid "output percentages, not visual information"
msgstr "показать проценты вместо визуальной информации"
#: src/main/help.c:333
msgid "do not output any transfer information at all"
msgstr "не отображать никакую информацию о передаче"
#: src/main/help.c:337
msgid "show number of bits transferred"
msgstr "показать объём переданных данных в битах"
#: src/main/help.c:340
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr "считать суффиксы как умножители на 1000, а не на 1024"
#: src/main/help.c:343
msgid "display nothing until first byte transferred"
msgstr "ничего не показывать, пока не будет передан первый байт"
#: src/main/help.c:345 src/main/help.c:360 src/main/help.c:363
msgid "SEC"
msgstr "СЕК"
#: src/main/help.c:346
msgid "display nothing until SEC seconds have passed"
msgstr "ничего не показывать, пока не пройдёт СЕК секунд"
#: src/main/help.c:348
msgid "SIZE"
msgstr "РАЗМ"
#: src/main/help.c:349
msgid "set estimated data size to SIZE bytes"
msgstr "указать ожидаемый объём данных как РАЗМ байт"
#: src/main/help.c:352
msgid "if size unknown, show rate vs max rate"
msgstr "если объём неизвестен, показать скорость и макс. скорость"
#: src/main/help.c:355
msgid "count lines instead of bytes"
msgstr "считать линии вместо байт"
#: src/main/help.c:358
msgid "lines are null-terminated"
msgstr "строки прерываются нулями"
#: src/main/help.c:361
msgid "update every SEC seconds"
msgstr "обновлять каждые СЕК секунд"
#: src/main/help.c:364
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr "вычислять среднюю скорость за последние СЕК секунд (по умолчанию 30)"
#: src/main/help.c:366
msgid "WIDTH"
msgstr "ШИРИНА"
#: src/main/help.c:367
msgid "assume terminal is WIDTH characters wide"
msgstr "считать, что в одной строке помещается ШИРИНА символов"
#: src/main/help.c:369
msgid "HEIGHT"
msgstr "ВЫСОТА"
#: src/main/help.c:370
msgid "assume terminal is HEIGHT rows high"
msgstr "считать, что на экране помещается ВЫСОТА строк"
#: src/main/help.c:372
msgid "NAME"
msgstr "ИМЯ"
#: src/main/help.c:373
msgid "prefix visual information with NAME"
msgstr "писать ИМЯ до визуальной информации"
#: src/main/help.c:375
msgid "STYLE"
msgstr "СТИЛЬ"
#: src/main/help.c:376
msgid "set default bar style to STYLE"
msgstr "задать стиль полоски по умолчанию как СТИЛЬ"
#: src/main/help.c:378
msgid "SPEC"
msgstr "НАЗНАЧ"
#: src/main/help.c:379
msgid "also send progress to SPEC"
msgstr "дополнительно выводить прогресс в НАЗНАЧ"
#: src/main/help.c:382
msgid "set terminal progress state with OSC 9;4 (ConEmu)"
msgstr ""
#: src/main/help.c:385
msgid "output transfer statistics at the end"
msgstr "после завершения показать статистику"
#: src/main/help.c:388
msgid "output even if standard error is not a terminal"
msgstr "вевести, даже если стд. ошибка не является терминалом"
#: src/main/help.c:391
msgid "use cursor positioning escape sequences"
msgstr ""
"использовать символьные последовательности для позиционирования курсора"
#: src/main/help.c:394 src/main/help.c:430 src/main/help.c:449
#: src/main/help.c:459
msgid "FILE"
msgstr "ФАЙЛ"
#: src/main/help.c:395
msgid "write output to FILE instead of stdout"
msgstr "направить вывод в ФАЙЛ вместо стд. вывода"
#: src/main/help.c:397
msgid "RATE"
msgstr "СКОР"
#: src/main/help.c:398
msgid "limit transfer to RATE bytes per second"
msgstr "ограничить скорость передачи до СКОР байт/сек"
#: src/main/help.c:400 src/main/help.c:406 src/main/help.c:412
msgid "BYTES"
msgstr "БАЙТ"
#: src/main/help.c:401
msgid "use a buffer size of BYTES"
msgstr "использовать буфер размера БАЙТ"
#: src/main/help.c:404
msgid "never use splice(), always use read/write"
msgstr "использовать чтение/запись вместо splice()"
#: src/main/help.c:407
msgid "set the pipe buffer size to BYTES"
msgstr ""
#: src/main/help.c:410
msgid "skip read errors in input"
msgstr "пропустить ошибки чтения во вводе"
#: src/main/help.c:413
msgid "skip errors in BYTES blocks at a time"
msgstr "пропускать ошибки в <БАЙТ> блоках за раз"
#: src/main/help.c:416
msgid "stop after --size bytes have been transferred"
msgstr "остановить после передачи --size байт"
#: src/main/help.c:419
msgid "flush cache to disk after every write"
msgstr "сбрасывать кеш на диск каждый раз"
#: src/main/help.c:422
msgid "use direct I/O to bypass cache"
msgstr "использовать прямой ввод/вывод для обхода кеша"
#: src/main/help.c:425
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:428
msgid "discard input instead of writing to output"
msgstr "отбрасывать ввод вместо записи в вывод"
#: src/main/help.c:431
msgid "write all input to FILE before writing to output"
msgstr "записывать весь ввод в ФАЙЛ прежде, чем отправлять на вывод"
#: src/main/help.c:434
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:435
msgid "watch file FD opened by process PID"
msgstr "следить за FD файла, открытого процессом ИДпр"
#: src/main/help.c:438 src/main/help.c:441
msgid "PID"
msgstr "ИДпр"
#: src/main/help.c:439
msgid "update settings of process PID"
msgstr "обновить настройки ИДпр процесса"
#: src/main/help.c:442
msgid "show progress of process PID"
msgstr "показать прогресс процесса ИДпр"
#: src/main/help.c:446
msgid "run a command and monitor its standard input, output, or both"
msgstr ""
"запустить команду и отслеживать её стандартный ввод, вывод или и то, и другое"
#: src/main/help.c:450
msgid "save process ID in FILE"
msgstr "сохранить ИД процесса в ФАЙЛ"
#: src/main/help.c:453
msgid "show this help and exit"
msgstr "показать справку и завершить работу"
#: src/main/help.c:456
msgid "show version information and exit"
msgstr "показать версию программы и завершить работу"
#: src/main/help.c:460
msgid "write debug logs to FILE"
msgstr "вести запись отладочного журнала в ФАЙЛ"
#: src/main/help.c:486
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Использование: %s [ОПЦИИ] [ФАЙЛ]..."
#: src/main/help.c:497
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
#: src/main/help.c:639
msgid "Supported format sequences:"
msgstr "Поддерживаемые последовательности:"
#: src/main/help.c:653
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Сообщайте о проблемах на: %s"
#: src/main/main.c:225
msgid "(input)"
msgstr "(ввод)"
#: src/main/main.c:381 src/main/options.c:1359
msgid "a command to run must be specified"
msgstr "необходимо указать команду для запуска"
#: src/main/main.c:704 src/main/options.c:757 src/main/options.c:777
#: src/pv/display.c:1086 src/pv/state.c:45 src/pv/state.c:902
#: src/pv/state.c:914 src/pv/state.c:950 src/pv/transfer.c:1335
#: src/pv/transfer.c:1451 src/pv/transfer.c:1778
msgid "memory allocation failure"
msgstr "ошибка выделения памяти"
#: src/main/options.c:418
msgid "list files may not contain @ lines"
msgstr "файлы списка не должны содержать строк, начинающихся с символа @"
#: src/main/options.c:438 src/main/options.c:440 src/main/options.c:901
msgid "process ID or pid:fd pair expected"
msgstr "ожидался ИД процесса или пара ИДпр:ДФ"
#: src/main/options.c:449 src/main/options.c:451 src/main/options.c:908
msgid "invalid process ID"
msgstr "неправильный ИД процесса"
#: src/main/options.c:829
msgid "numeric value not understood"
msgstr "число не распознано"
#: src/main/options.c:843
msgid "integer argument expected"
msgstr "ожидалось целое число"
#: src/main/options.c:853
msgid "numeric argument expected"
msgstr "ожидалось число"
#: src/main/options.c:864
msgid "missing filename"
msgstr ""
#: src/main/options.c:890
msgid "missing process name"
msgstr ""
#: src/main/options.c:1182
msgid "invalid side specification"
msgstr ""
#: src/main/options.c:1197
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Выполните `%s --help' для получения подробностей."
#: src/main/options.c:1199
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Выполните `%s -h' для получения подробностей."
#: src/main/options.c:1231
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
#: src/main/options.c:1239
msgid "cannot use cursor positioning when watching file descriptors"
msgstr ""
#: src/main/options.c:1247
msgid "cannot use remote control when watching file descriptors"
msgstr "удалённое управление невозможно при отслеживании дескрипторов файлов"
#: src/main/options.c:1255
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1263
msgid "cannot transfer files when watching file descriptors"
msgstr "передача файлов невозможна при отслеживании дескрипторов файлов"
#: src/main/options.c:1287
msgid "not available on systems without /proc/self/fdinfo"
msgstr "невозможно на системах без /proc/self/fdinfo"
#: src/main/options.c:1298
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/options.c:1325
msgid "monitor mode cannot be specified with this option"
msgstr ""
#: src/main/options.c:1337
msgid "monitor mode cannot be used with store-and-forward"
msgstr ""
#: src/main/options.c:1348
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
msgstr "Лицензия: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
#: 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 ""
"Разработчики не дают никаких гарантий, связанных с работой этой программы, "
"насколько это юридически возможно."
#: src/main/version.c:32
msgid "Project web site"
msgstr "Веб-сайт проекта"
#: src/pv/cursor.c:108 src/pv/cursor.c:135
msgid "failed to open lock file"
msgstr "не удалось открыть блокирующий файл"
#: src/pv/cursor.c:790 src/pv/cursor.c:792
msgid "interrupted by a signal"
msgstr "прервано по сигналу"
#: src/pv/display.c:311
msgid "yzafpnum kMGTPEZY"
msgstr ""
#: src/pv/display.c:329
msgid "yzafpnum KMGTPEZY"
msgstr ""
#: src/pv/file.c:81
msgid "/dev/null is not usable"
msgstr ""
#: src/pv/file.c:371
msgid "error closing file"
msgstr "ошибка закрытия файла"
#: src/pv/file.c:438
msgid "input file is also the output"
msgstr "файл ввода также используется и для вывода"
#: src/pv/file.c:596
msgid "(none)"
msgstr "(нет)"
#: src/pv/file.c:598
msgid "(stdin)"
msgstr "(стд. ввод)"
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:181
msgid "b/s"
msgstr "бит/с"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr "/с"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:181
msgid "B/s"
msgstr "байт/с"
#: src/pv/format/bytes.c:35
msgid "b"
msgstr "бит"
#: src/pv/format/bytes.c:39 src/pv/transfer.c:1284
msgid "B"
msgstr "байт"
#: src/pv/format/eta.c:63 src/pv/format/eta.c:67
msgid "ETA"
msgstr "ОЖИД"
#: src/pv/format/fineta.c:93
msgid "FIN"
msgstr "ЗАВЕРШ"
#: src/pv/loop.c:180
msgid "rate min/avg/max/mdev"
msgstr "скор. мин/сред/макс/дев"
#: src/pv/loop.c:192
msgid "rate not measured"
msgstr "скорость не изменяется"
#: src/pv/loop.c:1098 src/pv/loop.c:1114 src/pv/loop.c:1132 src/pv/remote.c:93
#: src/pv/remote.c:188 src/pv/remote.c:536 src/pv/remote.c:582
#: src/pv/watchpid.c:123 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:158 src/pv/watchpid.c:194
#: src/pv/watchpid.c:206 src/pv/watchpid.c:218 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:286 src/pv/watchpid.c:401
#: src/pv/watchpid.c:409 src/pv/watchpid.c:556 src/pv/watchpid.c:565
#: src/pv/watchpid.c:586
msgid "pid"
msgstr "ИДпр"
#: src/pv/loop.c:1132 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:160 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:288
msgid "fd"
msgstr "дф"
#: src/pv/remote.c:242 src/pv/remote.c:636
msgid "message not received"
msgstr "сообщение не получено"
#: src/pv/remote.c:659 src/pv/remote.c:677
msgid "SA_SIGINFO not supported on this system"
msgstr "Этой системой не поддерживается SA_SIGINFO"
#: src/pv/transfer.c:1173
msgid "warning: read errors detected"
msgstr "внимание: замечены ошибки чтения"
#: src/pv/transfer.c:1283
msgid "skipped past read error"
msgstr ""
#: src/pv/transfer.c:1642
msgid "write error"
msgstr "ошибка записи"
#: src/pv/watchpid.c:160 src/pv/watchpid.c:288
msgid "not a regular file or block device"
msgstr "не является обычным файлом или блочным устройством"
#~ msgid "failed to stat file"
#~ msgstr "не удалось получить информацию о файле"
#~ msgid "is a directory"
#~ msgstr "является каталогом"
#~ msgid "failed to generate sysfs filename"
#~ msgstr "не удалось создать имя файла sysfs"
#~ msgid "failed to read sysfs size file"
#~ msgstr "не удалось узнать размер файла sysfs"
#~ msgid "failed to open block device"
#~ msgstr "не удалось открыть блочное устройство"
#~ msgid "failed to determine size of block device"
#~ msgstr "не удалось определить размер блочного устройства"
#~ msgid "option structure allocation failed"
#~ msgstr "не удалось выделить память для структуры опций"
#~ msgid "option structure argv allocation failed"
#~ msgstr "не удалось выделить память для структуры опций argv"
#~ msgid "failed to get terminal name"
#~ msgstr "не удалось получить имя терминала"
#~ msgid "lock attempt failed"
#~ msgstr "попытка блокировки не удалась"
#~ msgid "failed to open terminal"
#~ msgstr "не удалось открыть терминал"
#~ msgid "failed to read file"
#~ msgstr "не удалось прочесть файл"
#~ msgid "failed to stat output file"
#~ msgstr "не удалось получить информацию о выходном файле"
#~ msgid "history structure allocation failed"
#~ msgstr "не удалось выделить память для структуры истории"
#~ msgid "file list allocation failed"
#~ msgstr "не удалось выделить память для списка файлов"
#~ msgid "read failed"
#~ msgstr "чтение не удалось"
#~ msgid "no transfer buffer allocated"
#~ msgstr "не выделена память для буфера передачи"
#~ msgid "failed to set interval timer"
#~ msgstr "не удалось задать измеритель временного промежутка"
#~ msgid "failed to clear interval timer"
#~ msgstr "не удалось очистить измеритель временного промежутка"
#~ msgid "select call failed"
#~ msgstr "запрос выборки не удался"
#~ msgid "PID[:FD]"
#~ msgstr "ИДпр[:FD]"
+621
View File
@@ -0,0 +1,621 @@
msgid ""
msgstr ""
"Project-Id-Version: pv 1.8.14\n"
"Report-Msgid-Bugs-To: https://codeberg.org/ivarch/pv/issues\n"
"POT-Creation-Date: 2026-08-01 14:53+0100\n"
"PO-Revision-Date: 2025-10-05 20:09+0000\n"
"Last-Translator: Oğuz Ersen <ersen@noreply.codeberg.org>\n"
"Language-Team: Turkish <https://translate.codeberg.org/projects/pv/pv/tr/>\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.13.2\n"
#: src/main/help.c:300
msgid "show progress bar"
msgstr "ilerleme çubuğunu göster"
#: src/main/help.c:303
msgid "show elapsed time"
msgstr "geçen süreyi göster"
#: src/main/help.c:306
msgid "show estimated time of arrival (completion)"
msgstr "tahmini varış (tamamlanma) zamanını göster"
#: src/main/help.c:309
msgid "show absolute estimated time of arrival (completion)"
msgstr "mutlak tahmini varış (tamamlanma) zamanını göster"
#: src/main/help.c:312
msgid "show data transfer rate counter"
msgstr "veri aktarım oranı sayacını göster"
#: src/main/help.c:315
msgid "show data transfer average rate counter"
msgstr "veri aktarımı ortalama hız sayacını göster"
#: src/main/help.c:318
msgid "show number of bytes transferred"
msgstr "aktarılan bayt sayısını göster"
#: src/main/help.c:321
msgid "show percentage of transfer buffer in use"
msgstr "aktarım tamponunun kullanım yüzdesini göster"
#: src/main/help.c:323
msgid "NUM"
msgstr "NUM"
#: src/main/help.c:324
msgid "show NUM bytes last written"
msgstr "son yazılan NUM baytlarını göster"
#: src/main/help.c:326
msgid "FORMAT"
msgstr "FORMAT"
#: src/main/help.c:327
msgid "set output format to FORMAT"
msgstr "çıktı formatını FORMAT olarak ayarlayın"
#: src/main/help.c:330
msgid "output percentages, not visual information"
msgstr "görsel bilgileri değil, yüzdeleri çıktı olarak yazdır"
#: src/main/help.c:333
msgid "do not output any transfer information at all"
msgstr "hiçbir transfer bilgisini yazdırma"
#: src/main/help.c:337
msgid "show number of bits transferred"
msgstr "aktarılan bit sayısını göster"
#: src/main/help.c:340
msgid "treat suffixes as multiples of 1000 rather than 1024"
msgstr "ekleri 1024 yerine 1000'in katları olarak değerlendir"
#: src/main/help.c:343
msgid "display nothing until first byte transferred"
msgstr "ilk bayt aktarılana kadar hiçbir şey gösterme"
#: src/main/help.c:345 src/main/help.c:360 src/main/help.c:363
msgid "SEC"
msgstr "SEC"
#: src/main/help.c:346
msgid "display nothing until SEC seconds have passed"
msgstr "SEC saniye geçene kadar hiçbir şey gösterme"
#: src/main/help.c:348
msgid "SIZE"
msgstr "BOYUT"
#: src/main/help.c:349
msgid "set estimated data size to SIZE bytes"
msgstr "tahmini veri boyutunu BOYUT bayt olarak ayarlayın"
#: src/main/help.c:352
msgid "if size unknown, show rate vs max rate"
msgstr "boyut bilinmiyorsa, oranı maksimum oranla göster"
#: src/main/help.c:355
msgid "count lines instead of bytes"
msgstr "bayt yerine satır say"
#: src/main/help.c:358
msgid "lines are null-terminated"
msgstr "satırlar boş sonlandırılır"
#: src/main/help.c:361
msgid "update every SEC seconds"
msgstr "her SEC saniyede bir güncelleme"
#: src/main/help.c:364
msgid "compute average rate over past SEC seconds (default 30s)"
msgstr "geçmiş SEC saniyeleri üzerinden ortalama hızı hesapla (varsayılan 30s)"
#: src/main/help.c:366
msgid "WIDTH"
msgstr "GENİŞLİK"
#: src/main/help.c:367
msgid "assume terminal is WIDTH characters wide"
msgstr "terminalin GENİŞLİK karakter genişliğinde olduğunu varsayalım"
#: src/main/help.c:369
msgid "HEIGHT"
msgstr "YÜKSEKLİK"
#: src/main/help.c:370
msgid "assume terminal is HEIGHT rows high"
msgstr "terminalin YÜKSEKLİK sıraları yüksekliğinde olduğunu varsayalım"
#: src/main/help.c:372
msgid "NAME"
msgstr "İSİM"
#: src/main/help.c:373
msgid "prefix visual information with NAME"
msgstr "görsel bilgiyi İSİM ile öne ekle"
#: src/main/help.c:375
msgid "STYLE"
msgstr "BİÇİM"
#: src/main/help.c:376
msgid "set default bar style to STYLE"
msgstr "öntanımlı çubuk biçimini BİÇİM olarak ayarla"
#: src/main/help.c:378
msgid "SPEC"
msgstr "BELİRT"
#: src/main/help.c:379
msgid "also send progress to SPEC"
msgstr "ilerlemeyi BELİRT ögesine de gönder"
#: src/main/help.c:382
msgid "set terminal progress state with OSC 9;4 (ConEmu)"
msgstr ""
#: src/main/help.c:385
msgid "output transfer statistics at the end"
msgstr "transfer istatistiklerini sonda göster"
#: src/main/help.c:388
msgid "output even if standard error is not a terminal"
msgstr "standart hata bir terminal olmasa bile çıktı yazdır"
#: src/main/help.c:391
msgid "use cursor positioning escape sequences"
msgstr "imleç konumlandırma kaçış dizilerini kullan"
#: src/main/help.c:394 src/main/help.c:430 src/main/help.c:449
#: src/main/help.c:459
msgid "FILE"
msgstr "DOSYA"
#: src/main/help.c:395
msgid "write output to FILE instead of stdout"
msgstr "çıktıyı stdout yerine DOSYA'ya yaz"
#: src/main/help.c:397
msgid "RATE"
msgstr "ORAN"
#: src/main/help.c:398
msgid "limit transfer to RATE bytes per second"
msgstr "aktarımı saniye başına ORAN bayt ile sınırlandırın"
#: src/main/help.c:400 src/main/help.c:406 src/main/help.c:412
msgid "BYTES"
msgstr "BAYTLAR"
#: src/main/help.c:401
msgid "use a buffer size of BYTES"
msgstr "BAYTLAR tampon boyutu kullanın"
#: src/main/help.c:404
msgid "never use splice(), always use read/write"
msgstr "splice() kullanma, her zaman read/write kullan"
#: src/main/help.c:407
msgid "set the pipe buffer size to BYTES"
msgstr ""
#: src/main/help.c:410
msgid "skip read errors in input"
msgstr "girdideki okuma hatalarını atla"
#: src/main/help.c:413
msgid "skip errors in BYTES blocks at a time"
msgstr "BAYTLAR blokları halinde hataları atla"
#: src/main/help.c:416
msgid "stop after --size bytes have been transferred"
msgstr "--size bayt transfer edildikten sonra dur"
#: src/main/help.c:419
msgid "flush cache to disk after every write"
msgstr "her yazmadan sonra önbelleği diske boşalt"
#: src/main/help.c:422
msgid "use direct I/O to bypass cache"
msgstr "Önbelleği atlamak için doğrudan I/O kullan"
#: src/main/help.c:425
msgid "try to seek instead of writing null bytes"
msgstr ""
#: src/main/help.c:428
msgid "discard input instead of writing to output"
msgstr "Girdiyi çıktıya yazmak yerine yok say"
#: src/main/help.c:431
msgid "write all input to FILE before writing to output"
msgstr "çıktıya yazmadan önce tüm girdiyi DOSYA'ya yaz"
#: src/main/help.c:434
msgid "PID[:FD]|=NAME|@LISTFILE"
msgstr ""
#: src/main/help.c:435
msgid "watch file FD opened by process PID"
msgstr "FD izleme dosyası PID işlemi tarafından açıldı"
#: src/main/help.c:438 src/main/help.c:441
msgid "PID"
msgstr "PID"
#: src/main/help.c:439
msgid "update settings of process PID"
msgstr "süreç PID ayarlarını güncelle"
#: src/main/help.c:442
msgid "show progress of process PID"
msgstr ""
#: src/main/help.c:446
msgid "run a command and monitor its standard input, output, or both"
msgstr ""
#: src/main/help.c:450
msgid "save process ID in FILE"
msgstr "FILE'da işlem kimliğini (ID) kaydet"
#: src/main/help.c:453
msgid "show this help and exit"
msgstr "bu yardımı göster ve çık"
#: src/main/help.c:456
msgid "show version information and exit"
msgstr "sürüm bilgilerini göster ve çık"
#: src/main/help.c:460
msgid "write debug logs to FILE"
msgstr "Hata ayıklama kayıtlarını DOSYA'ya yaz"
#: src/main/help.c:486
#, c-format
msgid "Usage: %s [OPTION] [FILE]..."
msgstr "Kullanım şekli: %s [AYAR] [DOSYA]..."
#: src/main/help.c:497
msgid ""
"Concatenate FILE(s), or standard input, to standard output, with monitoring."
msgstr ""
"İzleme ile DOSYA(lar)ı veya standart girdiyi standart çıktı ile birleştirin."
#: src/main/help.c:639
msgid "Supported format sequences:"
msgstr "Desteklenen biçim dizileri:"
#: src/main/help.c:653
#, c-format
msgid "Please report any bugs to: %s"
msgstr "Lütfen hataları şu adrese bildirin: %s"
#: src/main/main.c:225
msgid "(input)"
msgstr "(giriş)"
#: src/main/main.c:381 src/main/options.c:1359
msgid "a command to run must be specified"
msgstr ""
#: src/main/main.c:704 src/main/options.c:757 src/main/options.c:777
#: src/pv/display.c:1086 src/pv/state.c:45 src/pv/state.c:902
#: src/pv/state.c:914 src/pv/state.c:950 src/pv/transfer.c:1335
#: src/pv/transfer.c:1451 src/pv/transfer.c:1778
msgid "memory allocation failure"
msgstr "bellek ayırma başarısız"
#: src/main/options.c:418
msgid "list files may not contain @ lines"
msgstr ""
#: src/main/options.c:438 src/main/options.c:440 src/main/options.c:901
msgid "process ID or pid:fd pair expected"
msgstr "süreç kimliği (ID) veya pid:fd çifti bekleniyor"
#: src/main/options.c:449 src/main/options.c:451 src/main/options.c:908
msgid "invalid process ID"
msgstr "geçersiz süreç kimliği (ID)"
#: src/main/options.c:829
msgid "numeric value not understood"
msgstr "sayısal değer anlaşılmadı"
#: src/main/options.c:843
msgid "integer argument expected"
msgstr "tamsayı bağımsız değişkeni bekleniyor"
#: src/main/options.c:853
msgid "numeric argument expected"
msgstr "sayısal bağımsız değişken bekleniyor"
#: src/main/options.c:864
msgid "missing filename"
msgstr ""
#: src/main/options.c:890
msgid "missing process name"
msgstr ""
#: src/main/options.c:1182
msgid "invalid side specification"
msgstr ""
#: src/main/options.c:1197
#, c-format
msgid "Try `%s --help' for more information."
msgstr "Daha fazla bilgi için `%s --help' seçeneğini deneyin."
#: src/main/options.c:1199
#, c-format
msgid "Try `%s -h' for more information."
msgstr "Daha fazla bilgi için `%s -h' seçeneğini deneyin."
#: src/main/options.c:1231
msgid ""
"cannot use line mode or transfer modifier options when watching file "
"descriptors"
msgstr ""
"dosya tanımlayıcılarını izlerken satır modu veya aktarım değiştirici "
"seçeneklerini kullanamaz"
#: src/main/options.c:1239
msgid "cannot use cursor positioning when watching file descriptors"
msgstr "dosya tanımlayıcılarını izlerken imleç konumlandırmayı kullanamaz"
#: src/main/options.c:1247
msgid "cannot use remote control when watching file descriptors"
msgstr "dosya tanımlayıcılarını izlerken uzaktan kumandayı kullanamaz"
#: src/main/options.c:1255
msgid "cannot use remote query when watching file descriptors"
msgstr ""
#: src/main/options.c:1263
msgid "cannot transfer files when watching file descriptors"
msgstr "dosya tanımlayıcıları izlenirken dosya aktarılamıyor"
#: src/main/options.c:1287
msgid "not available on systems without /proc/self/fdinfo"
msgstr "/proc/self/fdinfo olmayan sistemlerde kullanılamaz"
#: src/main/options.c:1298
msgid "cannot use remote control and remote query together"
msgstr ""
#: src/main/options.c:1325
msgid "monitor mode cannot be specified with this option"
msgstr ""
#: src/main/options.c:1337
msgid "monitor mode cannot be used with store-and-forward"
msgstr ""
#: src/main/options.c:1348
msgid "files cannot be specified with this option"
msgstr ""
#: src/main/version.c:28
msgid "License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
msgstr "Lisans: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"
#: src/main/version.c:29
msgid "This is free software: you are free to change and redistribute it."
msgstr ""
"Bu özgür bir yazılımdır: değiştirmekte ve yeniden dağıtmakta özgürsünüz."
#: src/main/version.c:30
msgid "There is NO WARRANTY, to the extent permitted by law."
msgstr "Yasaların izin verdiği ölçüde GARANTİ YOKTUR."
#: src/main/version.c:32
msgid "Project web site"
msgstr "Proje web sitesi"
#: src/pv/cursor.c:108 src/pv/cursor.c:135
msgid "failed to open lock file"
msgstr "lock dosyası açılamadı"
#: src/pv/cursor.c:790 src/pv/cursor.c:792
msgid "interrupted by a signal"
msgstr "bir işaret tarafından kesildi"
#: src/pv/display.c:311
msgid "yzafpnum kMGTPEZY"
msgstr "yzafpnum kMGTPEZY"
#: src/pv/display.c:329
msgid "yzafpnum KMGTPEZY"
msgstr "yzafpnum KMGTPEZY"
#: src/pv/file.c:81
msgid "/dev/null is not usable"
msgstr ""
#: src/pv/file.c:371
msgid "error closing file"
msgstr "dosya kapatılırken hata"
#: src/pv/file.c:438
msgid "input file is also the output"
msgstr "girdi dosyası aynı zamanda çıkış"
#: src/pv/file.c:596
msgid "(none)"
msgstr "(yok)"
#: src/pv/file.c:598
msgid "(stdin)"
msgstr "(stdin)"
#: src/pv/format/averagerate.c:34 src/pv/format/progressbar.c:92
#: src/pv/format/rate.c:36 src/pv/loop.c:181
msgid "b/s"
msgstr "b/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40
msgid "/s"
msgstr "/s"
#: src/pv/format/averagerate.c:38 src/pv/format/progressbar.c:96
#: src/pv/format/rate.c:40 src/pv/loop.c:181
msgid "B/s"
msgstr "B/s"
#: src/pv/format/bytes.c:35
msgid "b"
msgstr "b"
#: src/pv/format/bytes.c:39 src/pv/transfer.c:1284
msgid "B"
msgstr "B"
#: src/pv/format/eta.c:63 src/pv/format/eta.c:67
msgid "ETA"
msgstr "ETA"
#: src/pv/format/fineta.c:93
msgid "FIN"
msgstr "FIN"
#: src/pv/loop.c:180
msgid "rate min/avg/max/mdev"
msgstr "oran min/ortalama/maks/standart sapma"
#: src/pv/loop.c:192
msgid "rate not measured"
msgstr "oran ölçülmedi"
#: src/pv/loop.c:1098 src/pv/loop.c:1114 src/pv/loop.c:1132 src/pv/remote.c:93
#: src/pv/remote.c:188 src/pv/remote.c:536 src/pv/remote.c:582
#: src/pv/watchpid.c:123 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:158 src/pv/watchpid.c:194
#: src/pv/watchpid.c:206 src/pv/watchpid.c:218 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:286 src/pv/watchpid.c:401
#: src/pv/watchpid.c:409 src/pv/watchpid.c:556 src/pv/watchpid.c:565
#: src/pv/watchpid.c:586
msgid "pid"
msgstr "pid"
#: src/pv/loop.c:1132 src/pv/watchpid.c:132 src/pv/watchpid.c:142
#: src/pv/watchpid.c:151 src/pv/watchpid.c:160 src/pv/watchpid.c:268
#: src/pv/watchpid.c:277 src/pv/watchpid.c:288
msgid "fd"
msgstr "fd"
#: src/pv/remote.c:242 src/pv/remote.c:636
msgid "message not received"
msgstr "mesaj alınamadı"
#: src/pv/remote.c:659 src/pv/remote.c:677
msgid "SA_SIGINFO not supported on this system"
msgstr "SA_SIGINFO bu sistemde desteklenmiyor"
#: src/pv/transfer.c:1173
msgid "warning: read errors detected"
msgstr "uyarı: okuma hataları tespit edildi"
#: src/pv/transfer.c:1283
msgid "skipped past read error"
msgstr "geçmiş okuma hatası atlandı"
#: src/pv/transfer.c:1642
msgid "write error"
msgstr "yazma hatası"
#: src/pv/watchpid.c:160 src/pv/watchpid.c:288
msgid "not a regular file or block device"
msgstr "normal bir dosya veya blok aygıtı değil"
#~ msgid "state allocation failed"
#~ msgstr "durum tahsisi başarısız oldu"
#~ msgid "failed to stat file"
#~ msgstr "dosya statüsünde başarısız oldu"
#~ msgid "is a directory"
#~ msgstr "bir dizindir"
#~ msgid "failed to generate sysfs filename"
#~ msgstr "sysfs dosya adı oluşturulamadı"
#~ msgid "failed to read sysfs size file"
#~ msgstr "sysfs boyut dosyası okunamadı"
#~ msgid "failed to open block device"
#~ msgstr "blok aygıtı açılamadı"
#~ msgid "failed to determine size of block device"
#~ msgstr "blok aygıtının boyutu belirlenemedi"
#~ msgid "option structure allocation failed"
#~ msgstr "seçenek yapısı tahsisi başarısız oldu"
#~ msgid "option structure argv allocation failed"
#~ msgstr "seçenek yapısı argv tahsisi başarısız oldu"
#~ msgid "failed to get terminal name"
#~ msgstr "terminal adı alınamadı"
#~ msgid "lock attempt failed"
#~ msgstr "kilit denemesi başarısız oldu"
#~ msgid "failed to open terminal"
#~ msgstr "terminal açılamadı"
#~ msgid "failed to seek to start of output"
#~ msgstr "çıktının başlangıcına ulaşılamadı"
#~ msgid "failed to read file"
#~ msgstr "dosya okunamadı"
#~ msgid "failed to stat output file"
#~ msgstr "çıktı dosyası stat edilemedi"
#~ msgid "history structure allocation failed"
#~ msgstr "geçmiş yapısı tahsisi başarısız oldu"
#~ msgid "file list allocation failed"
#~ msgstr "dosya listesi tahsisi başarısız oldu"
#~ msgid "read failed"
#~ msgstr "okuma başarısız"
#~ msgid "file is not seekable"
#~ msgstr "dosya aranabilir değil"
#~ msgid "failed to seek past error"
#~ msgstr "geçmiş hatayı aramakta başarısız oldu"
#~ msgid "no transfer buffer allocated"
#~ msgstr "aktarım arabelleği ayrılmamış"
#~ msgid "failed to set interval timer"
#~ msgstr "aralık zamanlayıcısı ayarlanamadı"
#~ msgid "failed to clear interval timer"
#~ msgstr "aralık zamanlayıcısı temizlenemedi"
#~ msgid "line position buffer allocation failed"
#~ msgstr "satır konumu arabellek tahsisi başarısız oldu"
#~ msgid "select call failed"
#~ msgstr "seçme çağrısı başarısız oldu"
#~ msgid "process list allocation failed"
#~ msgstr "işlem listesi tahsisi başarısız oldu"
#~ msgid "file descriptor list allocation failed"
#~ msgstr "dosya tanımlayıcı listesi tahsisi başarısız oldu"
#~ msgid "PID[:FD]"
#~ msgstr "PID[:FD]"
+1
View File
@@ -0,0 +1 @@
config.h.in
+23 -2
View File
@@ -3,7 +3,7 @@
* `configure' script. Include this after config.h and before anything
* else.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -44,4 +44,25 @@ typedef bool _Bool;
# define __bool_true_false_are_defined 1
#endif
/* EOF */
/* Whether "--remote" and "--query" should be available. */
#undef PV_REMOTE_CONTROL
#if HAVE_DECL_SA_SIGINFO
# if SIGINFO_PROVIDES_PID
#define PV_REMOTE_CONTROL 1
# endif
#endif
#ifndef SPLINT
/* Remove __attribute__(()) if not using GCC. */
#ifndef __GNUC__
#define __attribute__(x) /* GCC-only feature */
#endif
#endif
/* Support for the fallthrough attribute is not universal. */
/* From https://stackoverflow.com/questions/45349079/how-to-use-attribute-fallthrough-correctly-in-gcc */
#if defined(__GNUC__) && __GNUC__ >= 7
#define FALL_THROUGH __attribute__ ((fallthrough))
#else
#define FALL_THROUGH /*@-noeffect@*/ ((void)0) /*@+noeffect@*/
#endif /* __GNUC__ >= 7 */
-347
View File
@@ -1,347 +0,0 @@
/* src/include/config.h.in. Generated from configure.ac by autoheader. */
/* Debugging support enabled */
#undef ENABLE_DEBUGGING
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
/* Define to 1 if you have the `alarm' function. */
#undef HAVE_ALARM
/* Define to 1 if you have the `basename' function. */
#undef HAVE_BASENAME
/* Define to 1 if you have the Mac OS X function
CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */
#undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES
/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in
the CoreFoundation framework. */
#undef HAVE_CFPREFERENCESCOPYAPPVALUE
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
#undef HAVE_DCGETTEXT
/* Define to 1 if you have the `dup2' function. */
#undef HAVE_DUP2
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `fdatasync' function. */
#undef HAVE_FDATASYNC
/* Define to 1 if you have the `fpathconf' function. */
#undef HAVE_FPATHCONF
/* Define to 1 if you have the `getcwd' function. */
#undef HAVE_GETCWD
/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define to 1 if you have the `getopt_long' function. */
#undef HAVE_GETOPT_LONG
/* Define if the GNU gettext() function is already present or preinstalled. */
#undef HAVE_GETTEXT
/* Define if you have the iconv() function and it works. */
#undef HAVE_ICONV
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* IPC support enabled */
#undef HAVE_IPC
/* Define to 1 if you have the <libgen.h> header file. */
#undef HAVE_LIBGEN_H
/* Define to 1 if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if you have the `memcpy' function. */
#undef HAVE_MEMCPY
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
/* Define to 1 if you have the `memrchr' function. */
#undef HAVE_MEMRCHR
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define to 1 if you have the <minix/config.h> header file. */
#undef HAVE_MINIX_CONFIG_H
/* Define to 1 if you have the `nanosleep' function. */
#undef HAVE_NANOSLEEP
/* Define to 1 if you have the `posix_fadvise' function. */
#undef HAVE_POSIX_FADVISE
/* Define to 1 if you have the `posix_memalign' function. */
#undef HAVE_POSIX_MEMALIGN
/* Define to 1 if you have the `select' function. */
#undef HAVE_SELECT
/* Define to 1 if you have the `setitimer' function. */
#undef HAVE_SETITIMER
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
/* Define to 1 if you have the `shmget' function. */
#undef HAVE_SHMGET
/* Define to 1 if you have the `splice' function. */
#undef HAVE_SPLICE
/* Define to 1 if stdbool.h conforms to C99. */
#undef HAVE_STDBOOL_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strchr' function. */
#undef HAVE_STRCHR
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strlcat' function. */
#undef HAVE_STRLCAT
/* Define to 1 if you have the `strrchr' function. */
#undef HAVE_STRRCHR
/* Define to 1 if you have the `strstr' function. */
#undef HAVE_STRSTR
/* Define to 1 if you have the `strtoul' function. */
#undef HAVE_STRTOUL
/* Define to 1 if `st_blksize' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLKSIZE
/* Define to 1 if you have the `sysconf' function. */
#undef HAVE_SYSCONF
/* Define to 1 if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/ipc.h> header file. */
#undef HAVE_SYS_IPC_H
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* 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
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* 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
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable general extensions on macOS. */
#ifndef _DARWIN_C_SOURCE
# undef _DARWIN_C_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable X/Open compliant socket functions that do not require linking
with -lxnet on HP-UX 11.11. */
#ifndef _HPUX_ALT_XOPEN_SOCKET_API
# undef _HPUX_ALT_XOPEN_SOCKET_API
#endif
/* Identify the host operating system as Minix.
This macro does not affect the system headers' behavior.
A future release of Autoconf may stop defining this macro. */
#ifndef _MINIX
# undef _MINIX
#endif
/* Enable general extensions on NetBSD.
Enable NetBSD compatibility extensions on Minix. */
#ifndef _NETBSD_SOURCE
# undef _NETBSD_SOURCE
#endif
/* Enable OpenBSD compatibility extensions on NetBSD.
Oddly enough, this does nothing on OpenBSD. */
#ifndef _OPENBSD_SOURCE
# undef _OPENBSD_SOURCE
#endif
/* Define to 1 if needed for POSIX-compatible behavior. */
#ifndef _POSIX_SOURCE
# undef _POSIX_SOURCE
#endif
/* Define to 2 if needed for POSIX-compatible behavior. */
#ifndef _POSIX_1_SOURCE
# undef _POSIX_1_SOURCE
#endif
/* Enable POSIX-compatible threading on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */
#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */
#ifndef __STDC_WANT_IEC_60559_BFP_EXT__
# undef __STDC_WANT_IEC_60559_BFP_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */
#ifndef __STDC_WANT_IEC_60559_DFP_EXT__
# undef __STDC_WANT_IEC_60559_DFP_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */
#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__
# undef __STDC_WANT_IEC_60559_FUNCS_EXT__
#endif
/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */
#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__
# undef __STDC_WANT_IEC_60559_TYPES_EXT__
#endif
/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */
#ifndef __STDC_WANT_LIB_EXT2__
# undef __STDC_WANT_LIB_EXT2__
#endif
/* Enable extensions specified by ISO/IEC 24747:2009. */
#ifndef __STDC_WANT_MATH_SPEC_FUNCS__
# undef __STDC_WANT_MATH_SPEC_FUNCS__
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable X/Open extensions. Define to 500 only if necessary
to make mbstate_t available. */
#ifndef _XOPEN_SOURCE
# undef _XOPEN_SOURCE
#endif
/* Version number of package */
#undef VERSION
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define to the type of a signed integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#undef int32_t
/* Define to `int' if <sys/types.h> does not define. */
#undef mode_t
/* Define to `long int' if <sys/types.h> does not define. */
#undef off_t
/* Define as a signed integer type capable of holding a process identifier. */
#undef pid_t
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to `int' if <sys/types.h> does not define. */
#undef ssize_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
#include "config-aux.h"
+71 -26
View File
@@ -1,7 +1,7 @@
/*
* Global program option structure and the parsing function prototype.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -23,9 +23,70 @@ extern "C" {
struct opts_s;
typedef struct opts_s *opts_t;
struct opts_s { /* structure describing run-time options */
/*
* Overall program actions to select.
*/
typedef enum {
PV_ACTION_NOTHING, /* do nothing, and exit */
PV_ACTION_TRANSFER, /* transfer data */
PV_ACTION_STORE_AND_FORWARD, /* store to file, then output from it */
PV_ACTION_WATCHFD, /* watch process file descriptors */
PV_ACTION_REMOTE_CONTROL, /* remotely control another pv */
PV_ACTION_QUERY, /* watch the state of another pv */
PV_ACTION_MONITOR /* run a process, watch its stdin/out */
} pvaction_t;
/*
* Sides of a monitored command to monitor with PV_ACTION_MONITOR.
*/
typedef enum {
PV_SIDE_NONE, /* don't monitor a command */
PV_SIDE_IN, /* monitor only the input side */
PV_SIDE_OUT, /* monitor only the output side */
PV_SIDE_BOTH /* monitor both sides */
} pvside_t;
typedef /*@null@*/ const char * argv_string;
/*
* Structure describing run-time options.
*
* Members are ordered by size to minimise padding.
*/
struct opts_s {
double interval; /* interval between updates */
double delay_start; /* delay before first display */
/*@keep@*/ const char *program_name; /* name the program is running as */
bool do_nothing; /* exit-without-doing-anything flag */
/*@keep@*/ /*@null@*/ char *output; /* fd to write output to */
/*@keep@*/ /*@null@*/ char *name; /* display name, if any */
/*@keep@*/ /*@null@*/ char *name1; /* first name, if two were given */
/*@keep@*/ /*@null@*/ char *default_bar_style; /* default bar style */
/*@keep@*/ /*@null@*/ char *format; /* output format, if any */
/*@keep@*/ /*@null@*/ char *format1; /* first format, if two were given */
/*@keep@*/ /*@null@*/ char *pidfile; /* PID file, if any */
/*@keep@*/ /*@null@*/ char *store_and_forward_file; /* store and forward file, if any */
/*@keep@*/ /*@null@*/ char *extra_display; /* extra display specifier, if any */
/*@keep@*/ /*@null@*/ pid_t *watchfd_pid; /* array of processes to watch fds of */
/*@keep@*/ /*@null@*/ int *watchfd_fd; /* array of fds to watch in each one (0=all) */
/*@keep@*/ /*@null@*/ argv_string *argv; /* array of non-option arguments */
size_t lastwritten; /* show N bytes last written */
long double rate_limit; /* rate limit, in bytes per second */
size_t buffer_size; /* buffer size, in bytes (0=default) */
size_t pipe_buffer_size; /* pipe buffer size, in bytes (0=default) */
off_t size; /* total size of data */
off_t error_skip_block; /* skip block size, 0 for adaptive */
pid_t remote; /* PID of pv to update settings of */
pid_t query; /* PID of pv to query progress of */
unsigned int skip_errors; /* skip read errors counter */
unsigned int average_rate_window; /* time window in seconds for average rate calculations */
unsigned int width; /* screen width */
unsigned int height; /* screen height */
unsigned int argc; /* number of non-option arguments */
unsigned int argv_length; /* allocated array size for non-option arguments */
unsigned int watchfd_count; /* number of watchfd items */
unsigned int watchfd_length; /* allocated watchfd item array size */
pvaction_t action; /* the program action to perform */
pvside_t side; /* which side of the monitored command to monitor */
bool progress; /* progress bar flag */
bool timer; /* timer flag */
bool eta; /* ETA flag */
@@ -36,40 +97,26 @@ struct opts_s { /* structure describing run-time options */
bool bits; /* report transfer size in bits */
bool decimal_units; /* decimal prefix flag */
bool bufpercent; /* transfer buffer percentage flag */
size_t lastwritten; /* show N bytes last written */
bool force; /* force-if-not-terminal flag */
bool cursor; /* whether to use cursor positioning */
bool numeric; /* numeric output only */
bool wait; /* wait for transfer before display */
bool rate_gauge; /* if size unknown, show rate vs max rate */
bool linemode; /* count lines instead of bytes */
bool null_terminated_lines; /* lines are null-terminated */
bool no_display; /* do nothing other than pipe data */
off_t rate_limit; /* rate limit, in bytes per second */
size_t buffer_size; /* buffer size, in bytes (0=default) */
unsigned int remote; /* PID of pv to update settings of */
off_t size; /* total size of data */
bool no_splice; /* flag set if never to use splice */
unsigned int skip_errors; /* skip read errors counter */
off_t error_skip_block; /* skip block size, 0 for adaptive */
bool stop_at_size; /* set if we stop at "size" bytes */
bool sync_after_write; /* set if we sync after every write */
bool direct_io; /* set if O_DIRECT is to be used */
bool discard_input; /* set to write nothing to stdout */
double interval; /* interval between updates */
double delay_start; /* delay before first display */
pid_t watch_pid; /* process to watch fds of */
int watch_fd; /* fd to watch */
unsigned int average_rate_window; /* time window in seconds for average rate calculations */
unsigned int width; /* screen width */
unsigned int height; /* screen height */
bool sparse_output; /* set if we leave holes in the output */
bool discard_input; /* set to write nothing to output */
bool use_osc94; /* set to enable OSC 9;4 sequences */
bool show_stats; /* set to write statistics at the end */
bool width_set_manually; /* width was set manually, not detected */
bool height_set_manually; /* height was set manually, not detected */
/*@keep@*/ /*@null@*/ char *name; /* display name, if any */
/*@keep@*/ /*@null@*/ char *format; /* output format, if any */
/*@keep@*/ /*@null@*/ char *pidfile; /* PID file, if any */
unsigned int argc; /* number of non-option arguments */
/*@keep@*/ /*@null@*/ const char **argv; /* array of non-option arguments */
unsigned int argv_length; /* allocated array size */
bool rate_limit_specified; /* whether a rate limit value was given */
bool rate_limit_active; /* whether rate limiting is in effect (>0) */
};
/*@-exportlocal@*/
@@ -84,5 +131,3 @@ extern bool opts_add_file(opts_t, const char *);
#endif
#endif /* _OPTIONS_H */
/* EOF */
+497 -155
View File
@@ -1,7 +1,7 @@
/*
* Functions internal to the PV library. Include "config.h" first.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -9,6 +9,9 @@
#ifndef _PV_INTERNAL_H
#define _PV_INTERNAL_H 1
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#include <stdlib.h>
#include <signal.h>
#include <time.h>
@@ -20,131 +23,241 @@
extern "C" {
#endif
/*
* Types of display component that make up an output string.
*/
typedef enum {
PV_COMPONENT_STRING, /* fixed string */
PV_COMPONENT_PROGRESS, /* progress bar, with percentage if known */
PV_COMPONENT_BYTES, /* number of bytes transferred */
PV_COMPONENT_TIMER, /* elapsed time */
PV_COMPONENT_RATE, /* current transfer rate */
PV_COMPONENT_AVERAGERATE, /* average transfer rate */
PV_COMPONENT_ETA, /* estimated time remaining until completion */
PV_COMPONENT_FINETA, /* estimated time of completion */
PV_COMPONENT_NAME, /* name prefix */
PV_COMPONENT_BUFPERCENT, /* percentage of buffer used */
PV_COMPONENT_OUTPUTBUF, /* recent bytes in output buffer */
PV_COMPONENT__MAX
} pv_display_component;
#define PV_SIZEOF_COMPONENT_STR 1024 /* size of buffer for each component */
#define RATE_GRANULARITY 100000000 /* nsec between -L rate chunks */
#define RATE_BURST_WINDOW 5 /* rate burst window (multiples of rate) */
#define REMOTE_INTERVAL 100000000 /* nsec between checks for -R */
#define RATE_BURST_WINDOW 5.0 /* rate burst window (multiples of rate) */
#define REMOTE_INTERVAL 100000000 /* nsec between checks for -R and -Q */
#define MONITOR_EXCHANGE_INTERVAL 100000000 /* nsec between "-M both" data exchanges */
#define BUFFER_SIZE (size_t) 409600 /* default transfer buffer size */
#define BUFFER_SIZE_MAX (size_t) 524288 /* max auto transfer buffer size */
#define MAX_READ_AT_ONCE (size_t) 524288 /* max to read() in one go */
#define MAX_WRITE_AT_ONCE (size_t) 524288 /* max to write() in one go */
#define MAX_SPLICE_AT_ONCE 1048576 /* max to splice() in one go */
#define MAX_CFR_AT_ONCE 1073741824 /* max to copy_file_range() in one go */
#define TRANSFER_READ_TIMEOUT 0.09L /* seconds to time reads out at */
#define TRANSFER_WRITE_TIMEOUT 0.9L /* seconds to time writes out at */
#define MAX_LINE_POSITIONS 100000 /* number of lines to remember positions of */
/*
* Whether to always try to use the whole transfer buffer, reducing the
* number of reads and writes at the expense of moving bytes around.
*/
#define MAXIMISE_BUFFER_FILL 1
#define PV_SIZEOF_DEFAULT_FORMAT 512
#define PV_SIZEOF_CWD 4096
#define PV_SIZEOF_LASTOUTPUT_BUFFER 256
#define PV_FORMAT_ARRAY_MAX 100
#define PV_SIZEOF_CRS_LOCK_FILE 1024
/* Sizes for various statically sized buffers. */
#define PV_SIZEOF_FILE_FDINFO 4096
#define PV_SIZEOF_FILE_FD 4096
#define PV_SIZEOF_FILE_FDPATH 4096
#define PV_SIZEOF_DEFAULT_FORMAT 512
#define PV_SIZEOF_LASTWRITTEN_BUFFER 256
#define PV_SIZEOF_PREVLINE_BUFFER 1024
#define PV_FORMAT_ARRAY_MAX 100
#define PV_SIZEOF_FORMAT_SEGMENTS_BUF 4096
#define PV_SIZEOF_DISPLAY_NAME 512
#define PV_BARSTYLE_MAX 4 /* number of different styles allowed in a format */
#define PV_BARSTYLE_SIZEOF_STRING 10 /* max length of a bar constituent component in bytes */
#define PV_BARSTYLE_MAX_FILLERS 10 /* max number of bar filler strings */
/* Bit values for the extra displays bitmap. */
#define PV_DISPLAY_WINDOWTITLE 1
#define PV_DISPLAY_PROCESSTITLE 2
/*
* Structure for data shared between multiple "pv -c" instances.
*/
struct pvcursorstate_s {
struct pvipccursorstate_s {
int y_topmost; /* terminal row of topmost "pv" instance */
bool tty_tostop_added; /* whether any instance had to set TOSTOP on the terminal */
bool tty_echoctl_cleared; /* whether any instance had to clear ECHOCTL on the terminal */
};
/*
* Types of transfer count - bytes, decimal bytes or lines.
*/
typedef enum {
PV_TRANSFERCOUNT_BYTES,
PV_TRANSFERCOUNT_DECBYTES,
PV_TRANSFERCOUNT_LINES
} pvtransfercount_t;
/* Methods used to transfer bytes from input to output. */
typedef enum {
PV_TRANSFERMETHOD_READWRITE, /* read() + write() */
PV_TRANSFERMETHOD_SPLICE, /* splice() */
PV_TRANSFERMETHOD_SPLICE_INTERMEDIATE, /* splice() through an intermediate input pipe */
PV_TRANSFERMETHOD_COPY_FILE_RANGE, /* copy_file_range() */
PV_TRANSFERMETHOD__UNSET
} pvtransfermethod_t;
/*
* Structure describing a short string used as part of a progress bar, whose
* width in display characters may not be the same as its length in bytes.
*/
struct pvbarstring_spec_s {
char string[PV_BARSTYLE_SIZEOF_STRING];
uint8_t width;
uint8_t bytes;
};
/*
* Structure describing a style of progress bar.
*
* The part that moves back and forth when the size isn't known, such as
* "<=>", is "indicator".
*
* The string used to populate the rest of the bar is one of "filler", which
* contains "filler_entries" array items. The first item "filler[0]" is
* used for an empty part such as " ". The last item
* "filler[filler_entries-1]" is used for a 100% full part, such as "=".
*
* If there are more than the minimum of 2 entries, then the intervening
* entries are used for partial fills.
*
* When there are only 2 entries and the bar isn't completely empty or full,
* the last filled portion of the bar is filled with "tip" instead of the
* last filler item to indicate the tip of the bar, such as ">".
*
* Note that only the indicator is expected to ever be wider than 1 display
* character. All other items are expected to have a width of 0 or 1.
*
* The "style_id" is an opaque identifier that should only be used to
* determine whether two styles are the same. It is always nonzero.
*/
struct pvbarstyle_s {
uint8_t style_id;
uint8_t filler_entries;
struct pvbarstring_spec_s indicator;
struct pvbarstring_spec_s tip;
struct pvbarstring_spec_s filler[PV_BARSTYLE_MAX_FILLERS];
};
typedef struct pvbarstyle_s *pvbarstyle_t;
/* Display format component type, -1 for static string. */
typedef int8_t pvdisplay_component_t;
#define PVDISPLAY_COMPONENT_MAX (127) /* INT8_MAX */
/* Byte count of a part of the display. */
typedef uint16_t pvdisplay_bytecount_t;
#define PVDISPLAY_BYTECOUNT_MAX (65535) /* UINT16_MAX */
/* Width of a part of the display. */
typedef uint16_t pvdisplay_width_t;
#define PVDISPLAY_WIDTH_MAX (65535) /* UINT16_MAX */
/*
* Structure defining the current state of a single watched file descriptor.
*/
struct pvwatchfd_s;
typedef /*@null@*/ struct pvwatchfd_s *pvwatchfd_t;
/* String pointer, that is the only pointer to this resource, that can be null. */
typedef /*@only@*/ /*@null@*/ char * nullable_only_string_t;
/*
* Structure for holding PV internal state. Opaque outside the PV library.
*
* In general, members are ordered by size, to minimise padding.
*/
struct pvstate_s {
/******************
* Program status *
******************/
struct {
/*@only@*/ char *program_name; /* program name for error reporting */
char cwd[PV_SIZEOF_CWD]; /* current working directory for relative path */
struct pvprogramstatus_s {
nullable_only_string_t cwd; /* for relative paths in --watchfd */
int current_input_file; /* index of current file being read */
int exit_status; /* exit status to give (0=OK) */
bool terminal_supports_utf8; /* whether the terminal supports UTF-8 */
bool terminal_supports_colour; /* whether the terminal supports colour */
bool checked_colour_support; /* whether we have checked colour support yet */
bool current_input_is_pipe; /* whether the current input file is a pipe */
bool current_input_is_file; /* whether the current input is a regular file */
bool output_is_pipe; /* whether the output is a pipe */
bool output_is_file; /* whether the output is a regular file */
} status;
/***************
* Input files *
***************/
struct {
struct pvinputfiles_s {
/*@only@*/ /*@null@*/ nullable_only_string_t *filename; /* input filenames */
unsigned int file_count; /* number of input files */
/*@only@*/ /*@null@*/ char **filename; /* input filenames */
} files;
/*********************************
* Items to watch with --watchfd *
*********************************/
struct {
/*@only@*/ /*@null@*/
struct pvwatcheditem_s { /* array of PID or PID:FD items */
pid_t pid; /* watched PID */
int fd; /* watched fd, or -1 for all */
pvwatchfd_t info_array; /* watch information for each fd */
int array_length; /* length of watch info array */
bool finished; /* "PID:FD": fd closed; or PID gone */
} *watching;
unsigned int count; /* number of items in these arrays */
bool multiple_pids; /* true if more than one distinct PID */
} watchfd;
/*******************
* Program control *
*******************/
struct {
struct pvcontrol_s {
char default_format[PV_SIZEOF_DEFAULT_FORMAT]; /* default format string */
double interval; /* interval between updates */
double delay_start; /* delay before first display */
/*@only@*/ /*@null@*/ char *name; /* display name */
/*@only@*/ /*@null@*/ char *format_string; /* output format string */
/*@only@*/ /*@null@*/ char *extra_display_spec; /* full spec for extra displays */
/*@only@*/ /*@null@*/ char *extra_format_string; /* extra format string alone */
/*@null@*/ char *output_name; /* name of the output, for diagnostics */
/*@null@*/ char *default_bar_style; /* which bar style to use by default */
off_t error_skip_block; /* skip block size, 0 for adaptive */
long double rate_limit; /* rate limit, in bytes per second */
size_t target_buffer_size; /* transfer buffer size (0=default) */
size_t pipe_buffer_size; /* pipe buffer size (0=default) */
off_t size; /* total size of data */
unsigned int skip_errors; /* skip read errors counter */
int output_fd; /* fd to write output to */
pid_t othermonitor_pid; /* pid of the other monitor, in "-M both" mode */
int othermonitor_read_fd; /* fd to read transfer counts from other monitor */
int othermonitor_write_fd; /* fd to write transfer counts to other monitor */
unsigned int average_rate_window; /* time window in seconds for average rate calculations */
unsigned int history_interval; /* seconds between each average rate calc history entry */
pvdisplay_width_t width; /* screen width */
unsigned int height; /* screen height */
unsigned int extra_displays; /* bitmask of extra display destinations */
pvformatoptions_s format_option; /* non "--format" format options (used by -R) */
bool force; /* display even if not on terminal */
bool cursor; /* use cursor positioning */
bool numeric; /* numeric output only */
bool wait; /* wait for data before display */
bool rate_gauge; /* if size unknown, show rate vs max rate */
bool linemode; /* count lines instead of bytes */
bool bits; /* report bits instead of bytes */
bool decimal_units; /* use decimal prefixes */
bool null_terminated_lines; /* lines are null-terminated */
bool no_display; /* do nothing other than pipe data */
unsigned int skip_errors; /* skip read errors counter */
off_t error_skip_block; /* skip block size, 0 for adaptive */
bool stop_at_size; /* set if we stop at "size" bytes */
bool sync_after_write; /* set if we sync after every write */
bool direct_io; /* set if O_DIRECT is to be used */
bool direct_io_changed; /* set when direct_io is changed */
bool no_splice; /* never use splice() */
bool stop_at_size; /* transfer is to stop at "size" bytes */
bool sync_after_write; /* sync after every write */
bool direct_io; /* use O_DIRECT */
bool direct_io_changed; /* set when direct_io is changed mid-transfer */
bool sparse_output; /* convert runs of null bytes into holes */
bool discard_input; /* write nothing to stdout */
off_t rate_limit; /* rate limit, in bytes per second */
size_t target_buffer_size; /* buffer size (0=default) */
off_t size; /* total size of data */
double interval; /* interval between updates */
double delay_start; /* delay before first display */
pid_t watch_pid; /* process to watch fds of */
int watch_fd; /* fd to watch */
unsigned int average_rate_window; /* time window in seconds for average rate calculations */
unsigned int width; /* screen width */
unsigned int height; /* screen height */
bool show_stats; /* show statistics on exit */
bool use_osc94; /* enable OSC 9;4 sequences */
bool width_set_manually; /* width was set manually, not detected */
bool height_set_manually; /* height was set manually, not detected */
/*@only@*/ /*@null@*/ char *name; /* display name */
char default_format[PV_SIZEOF_DEFAULT_FORMAT]; /* default format string */
/*@only@*/ /*@null@*/ char *format_string; /* output format string */
bool rate_limit_specified; /* whether a rate limit value was given */
bool rate_limit_active; /* whether a rate limit is in effect (>0) */
} control;
/*******************
* Signal handling *
*******************/
struct {
int old_stderr; /* see pv_sig_ttou() */
bool pv_tty_tostop_added; /* whether we had to set TOSTOP on the terminal */
struct timespec tstp_time; /* see pv_sig_tstp() / __cont() */
struct timespec toffset; /* total time spent stopped */
#ifdef SA_SIGINFO
volatile sig_atomic_t rxusr2; /* whether SIGUSR2 was received */
volatile pid_t sender; /* PID of sending process for SIGUSR2 */
#endif
struct pvsignal_s {
/* old signal handlers to restore in pv_sig_fini(). */
struct sigaction old_sigpipe;
struct sigaction old_sigttou;
@@ -154,85 +267,149 @@ struct pvstate_s {
struct sigaction old_sigint;
struct sigaction old_sighup;
struct sigaction old_sigterm;
#ifdef SA_SIGINFO
#ifdef PV_REMOTE_CONTROL
struct sigaction old_sigusr2;
struct sigaction old_sigusr1;
#endif
struct sigaction old_sigalrm;
struct timespec when_tstp_arrived; /* see pv_sig_tstp() / __cont() */
struct timespec total_stoppage_time; /* total time spent stopped */
#ifdef PV_REMOTE_CONTROL
volatile sig_atomic_t rxusr2; /* whether SIGUSR2 was received */
volatile pid_t sender_usr2; /* PID of sending process for SIGUSR2 */
volatile sig_atomic_t rxusr1; /* whether SIGUSR1 was received */
volatile pid_t sender_usr1; /* PID of sending process for SIGUSR1 */
#endif
} signal;
/*******************
* Transient flags *
*******************/
struct {
struct pvtransientflags_s {
volatile sig_atomic_t reparse_display; /* whether to re-check format string */
volatile sig_atomic_t terminal_resized; /* whether we need to get term size again */
volatile sig_atomic_t trigger_exit; /* whether we need to abort right now */
} flag;
volatile sig_atomic_t terminal_resized; /* whether terminal size needs re-reading */
volatile sig_atomic_t trigger_exit; /* whether an immediate abort is required */
volatile sig_atomic_t terminating_signal; /* signal number that triggered an exit */
volatile sig_atomic_t clear_tty_tostop_on_exit; /* whether to clear tty TOSTOP on exit */
volatile sig_atomic_t set_tty_echoctl_on_exit; /* whether to set tty ECHOCTL on exit */
volatile sig_atomic_t suspend_stderr; /* whether writing to stderr is suspended */
volatile sig_atomic_t skip_next_sigcont; /* whether to ignore the next SIGCONT */
volatile sig_atomic_t pipe_closed; /* whether the output pipe was closed */
} flags;
/*****************
* Display state *
*****************/
struct {
/*@only@*/ /*@null@*/ char *display_buffer; /* buffer for display string */
size_t display_buffer_size; /* size allocated to display buffer */
size_t display_string_len; /* length of string in display buffer */
unsigned int prev_screen_width; /* screen width last time we were called */
bool display_visible; /* set once anything written to terminal */
struct pvdisplay_s {
int percentage; /* transfer percentage completion */
struct pvdisplay_segment_s { /* format string broken into segments */
/* See pv__format_init() for more details. */
/*@dependent@*/ /*@null@*/ const char *string_parameter; /* parameter after colon in %{x:} */
pvdisplay_bytecount_t string_parameter_bytes; /* number of bytes in string_parameter */
pvdisplay_component_t type; /* component type, -1 for static string */
int8_t parameter; /* component parameter, such as bar style index */
pvdisplay_width_t chosen_size; /* "n" from %<n>A, or 0 */
pvdisplay_bytecount_t offset; /* start offset of this segment in the build buffer */
pvdisplay_bytecount_t bytes; /* length of segment in bytes in the build buffer */
pvdisplay_width_t width; /* displayed width of segment */
} format[PV_FORMAT_ARRAY_MAX];
struct pvbarstyle_s barstyle[PV_BARSTYLE_MAX];
/* The last-written "n" bytes. */
char lastwritten_buffer[PV_SIZEOF_LASTWRITTEN_BUFFER];
/* The most recently output complete line. */
char previous_line[PV_SIZEOF_PREVLINE_BUFFER];
/* The line being received now. */
char next_line[PV_SIZEOF_PREVLINE_BUFFER];
/*@only@*/ /*@null@*/ char *display_buffer; /* buffer for display string */
off_t initial_offset; /* offset when first opened (when watching fds) */
size_t next_line_len; /* length of currently receiving line so far */
size_t format_segment_count; /* number of format string segments */
pvtransfercount_t count_type; /* type of count for transfer, rate, etc */
pvdisplay_width_t prev_screen_width; /* screen width last time pv_display() was called */
pvdisplay_bytecount_t display_buffer_size; /* size allocated to display buffer */
pvdisplay_bytecount_t display_string_bytes; /* byte length of string in display buffer */
pvdisplay_width_t display_string_width; /* displayed width of string in display buffer */
pvdisplay_bytecount_t lastwritten_bytes; /* largest number of last-written bytes to show */
bool showing_timer; /* set if showing timer */
bool showing_bytes; /* set if showing byte/line count */
bool showing_ratio; /* set if showing monitoring in:out ratio */
bool showing_rate; /* set if showing transfer rate */
bool showing_last_written; /* set if displaying the last few bytes written */
bool showing_previous_line; /* set if displaying the previously output line */
bool format_uses_colour; /* set if the format string uses colours */
bool colour_permitted; /* whether colour is permitted for this display */
bool sgr_code_active; /* set while SGR code is active in a display line */
bool using_osc94; /* set if the format contains an OSC 9;4 code */
bool final_update; /* set internally on the final update */
bool output_produced; /* set once anything written to terminal */
} display;
/* Extra display for alternate outputs like a window title. */
struct pvdisplay_s extra_display;
/************************************
* Calculated state of the transfer *
************************************/
struct pvtransfercalc_s {
long double transfer_rate; /* calculated transfer rate */
long double average_rate; /* calculated average transfer rate */
long double prev_elapsed_sec; /* elapsed sec at which rate last calculated */
long double prev_rate; /* last calculated instantaneous transfer rate */
long double prev_trans; /* bytes transferred since last rate calculation */
long double prev_trans; /* amount transferred since last rate calculation */
long double current_avg_rate; /* current average rate over last history intervals */
long double rate_min; /* minimum measured transfer rate */
long double rate_max; /* maximum measured transfer rate */
long double rate_sum; /* sum of all measured transfer rates */
long double ratesquared_sum; /* sum of the squares of each transfer rate */
unsigned long measurements_taken; /* how many times the rate was measured */
/* Keep track of progress over last intervals to compute current average rate. */
/*@null@*/ struct { /* state at previous intervals (circular buffer) */
long double elapsed_sec; /* time since start of transfer */
off_t total_bytes; /* amount transferred by that time */
off_t transferred; /* amount transferred by that time */
} *history;
size_t history_len; /* total size of history array */
int history_interval; /* seconds between each history entry */
size_t history_first; /* index of oldest entry */
size_t history_last; /* index of newest entry */
long double current_avg_rate; /* current average rate over last history intervals */
off_t initial_offset; /* offset when first opened (when watching fds) */
off_t prev_transferred; /* total amount transferred when called last time */
size_t lastoutput_length; /* number of last-output bytes to show */
char lastoutput_buffer[PV_SIZEOF_LASTOUTPUT_BUFFER];
size_t format_segment_count; /* number of format string segments */
struct { /* format string broken into display components */
pv_display_component type; /* type of display component */
size_t str_start; /* for strings: start offset */
size_t str_length; /* for strings: length */
} format[PV_FORMAT_ARRAY_MAX];
struct { /* display components */
bool required; /* true if included in format */
char content[PV_SIZEOF_COMPONENT_STR]; /* string to display */
size_t length; /* number of bytes in string */
} component[PV_COMPONENT__MAX];
} display;
double percentage; /* transfer percentage completion */
} calc;
/********************
* Cursor/IPC state *
********************/
struct {
struct pvcursorstate_s {
/*@only@*/ /*@null@*/ char *lock_file; /* terminal lock filename */
#ifdef HAVE_IPC
int shmid; /* ID of our shared memory segment */
/*@keep@*/ /*@null@*/ struct pvipccursorstate_s *shared; /* data shared between instances */
int shmid; /* ID of the shared memory segment */
int pvcount; /* number of `pv' processes in total */
int pvmax; /* highest number of `pv's seen */
/*@keep@*/ /*@null@*/ struct pvcursorstate_s *shared; /* data shared between instances */
int y_lastread; /* last value of _y_top seen */
int y_offset; /* our Y offset from this top position */
int needreinit; /* counter if we need to reinit cursor pos */
bool noipc; /* set if we can't use IPC */
int needreinit; /* counter for reinitialising cursor position */
#endif /* HAVE_IPC */
int lock_fd; /* fd of lockfile, -1 if none open */
char lock_file[PV_SIZEOF_CRS_LOCK_FILE];
int y_start; /* our initial Y coordinate */
#ifdef HAVE_IPC
bool noipc; /* set if IPC can't be used */
#endif /* HAVE_IPC */
bool disable; /* set if cursor positioning can't be used */
} cursor;
/*******************
@@ -242,108 +419,275 @@ struct pvstate_s {
* The transfer buffer is used for moving data from the input files
* to the output when splice() is not available.
*
* If buffer_size is smaller than pv__target_bufsize, then
* If buffer_size is smaller than control.target_buffer_size, then
* pv_transfer() will try to reallocate transfer_buffer to make
* buffer_size equal to pv__target_bufsize.
* buffer_size equal to control.target_buffer_size.
*
* Data from the input files is read into the buffer; read_position
* is the offset in the buffer that we've read data up to.
* is the offset in the buffer that data has been read up to.
*
* Data is written to the output from the buffer, and write_position
* is the offset in the buffer that we've written data up to. It
* is the offset in the buffer that data has been written up to. It
* will always be less than or equal to read_position.
*/
struct {
struct pvtransferstate_s {
long double elapsed_seconds; /* how long the transfer has been running for */
/*@only@*/ /*@null@*/ char *transfer_buffer; /* data transfer buffer */
size_t buffer_size; /* size of buffer */
size_t read_position; /* amount of data in buffer */
size_t write_position; /* buffered data written */
ssize_t to_write; /* max to write this time around */
ssize_t written; /* bytes sent to stdout this time */
size_t written_but_not_consumed; /* bytes in the output pipe, unread */
off_t total_bytes_read; /* total bytes read */
off_t total_written; /* total bytes or lines written */
off_t transferred; /* amount transferred (written - unconsumed) */
off_t otherside_transferred; /* amount transferred by the other side ("-M both") */
/* Keep track of line positions to backtrack written_but_not_consumed. */
/*@only@*/ /*@null@*/ off_t *line_positions; /* line separator write positions (circular buffer) */
size_t line_positions_capacity; /* total size of line position array */
size_t line_positions_length; /* number of positions stored in array */
size_t line_positions_head; /* index to use for next position */
off_t last_output_position; /* write position last sent to output */
/*
* While reading from a file descriptor we keep track of how
* many times in a row we've seen errors
* (read_errors_in_a_row), and whether or not we have put a
* warning on stderr about read errors on this fd
* While reading from a file descriptor, a count is kept of
* how many times in a row there have been errors
* (read_errors_in_a_row), and whether or not a warning has
* been written to stderr about read errors on this fd
* (read_error_warning_shown).
*
* Whenever the active file descriptor changes from
* last_read_skip_fd, we reset read_errors_in_a_row to 0 and
* read_error_warning_shown to false for the new file
* descriptor and set last_read_skip_fd to the new fd
* number.
* last_read_skip_fd, the read_errors_in_a_row is reset to 0
* and read_error_warning_shown is set to false for the new
* file descriptor, and last_read_skip_fd is set to the new
* fd number.
*
* This way, we're treating each input file separately.
* This allows each input file to be treated separately.
*/
int last_read_skip_fd;
off_t read_errors_in_a_row;
bool read_error_warning_shown;
int last_read_skip_fd;
/* read_error_warning_shown is defined below. */
#ifdef HAVE_SPLICE
/*
* These variables are used to keep track of whether
* splice() was used; splice_failed_fd is the file
* descriptor that splice() last failed on, so that we don't
* keep trying to use it on an fd that doesn't support it,
* and splice_used is set to true if splice() was used this
* time within pv_transfer().
* File descriptors for an intermediate pipe, used when
* neither input nor output are pipes; the size of the pipe
* buffer; and how much input data is in the intermediate
* pipe waiting to be passed to the output.
*/
int intermediate_pipe[2];
int intermediate_pipe_buffer_size;
int intermediate_pipe_buffer_used;
/* File descriptor to /dev/null for splicing with -X. */
int discard_fd;
/*
* splice_failed_fd is the input file descriptor that
* splice() last failed on, to avoid continuing to try using
* it on a file descriptor that doesn't support it.
*/
int splice_failed_fd;
bool splice_used;
#endif
ssize_t to_write; /* max to write this time around */
ssize_t written; /* bytes sent to stdout this time */
#ifdef HAVE_COPY_FILE_RANGE
/*
* copy_file_range_failed_fd is the input file descriptor
* that copy_file_range() last failed on, to avoid
* continuing to try using it on a file descriptor that
* doesn't support it.
*/
int copy_file_range_failed_fd;
#endif
pvtransfermethod_t method; /* method used for most recent transfer */
bool read_error_warning_shown;
bool output_not_seekable; /* set if lseek() fails on output */
} transfer;
};
typedef struct pvprogramstatus_s *pvprogramstatus_t;
typedef struct pvinputfiles_s *pvinputfiles_t;
typedef struct pvcontrol_s *pvcontrol_t;
typedef struct pvsignal_s *pvsignal_t;
typedef struct pvtransientflags_s *pvtransientflags_t;
typedef struct pvdisplay_s *pvdisplay_t;
typedef struct pvdisplay_segment_s *pvdisplay_segment_t;
typedef struct pvtransfercalc_s *pvtransfercalc_t;
typedef struct pvcursorstate_s *pvcursorstate_t;
typedef struct pvtransferstate_s *pvtransferstate_t;
/*
* Structure defining the current state of a single watched file descriptor.
* The full definition needs to go here as it refers to sub-structures of
* the main state, defined above.
*/
struct pvwatchfd_s {
pid_t watch_pid; /* PID to watch */
int watch_fd; /* fd to watch, -1 = not displayed */
struct pvtransientflags_s flags; /* transient flags */
struct pvtransferstate_s transfer; /* transfer state */
struct pvtransfercalc_s calc; /* calculated transfer state */
struct pvdisplay_s display; /* display data */
#ifdef __APPLE__
#else
char file_fdinfo[PV_SIZEOF_FILE_FDINFO]; /* path to /proc fdinfo file */
char file_fd[PV_SIZEOF_FILE_FD]; /* path to /proc fd symlink */
nullable_string_ptr file_fdinfo; /* path to /proc fdinfo file */
nullable_string_ptr file_fdsymlink; /* path to /proc fd symlink */
#endif
char file_fdpath[PV_SIZEOF_FILE_FDPATH]; /* path to file that was opened */
char display_name[PV_SIZEOF_DISPLAY_NAME]; /* name to show on progress bar */
nullable_string_ptr file_fdpath; /* path to file that was opened */
/*@keep@ */ char display_name[PV_SIZEOF_DISPLAY_NAME]; /* name to show on progress bar */
struct stat sb_fd; /* stat of fd symlink */
struct stat sb_fd_link; /* lstat of fd symlink */
off_t size; /* size of whole file, 0 if unknown */
off_t position; /* position last seen at */
struct timespec start_time; /* time we started watching the fd */
/*@null@*/ pvstate_t state; /* state object for flags and display */
struct timespec start_time; /* time the watch of this fd began */
struct timespec end_time; /* time the fd was marked as closed */
struct timespec total_stoppage_time; /* total time spent stopped */
pid_t watch_pid; /* PID the fd belongs to */
int watch_fd; /* fd to watch */
bool closed; /* true once the fd is closed */
bool displayable; /* false if not displayable */
bool unused; /* true if free for re-use */
};
typedef struct pvwatchfd_s *pvwatchfd_t;
void pv_error(pvstate_t, char *, ...);
/*
* Read-only counterparts to the above structure pointers, to be used in
* function declarations where the function definitely shouldn't be altering
* the contents of the structure.
*/
typedef const struct pvprogramstatus_s * readonly_pvprogramstatus_t;
typedef const struct pvinputfiles_s * readonly_pvinputfiles_t;
typedef const struct pvcontrol_s * readonly_pvcontrol_t;
typedef const struct pvsignal_s * readonly_pvsignal_t;
typedef const struct pvtransientflags_s * readonly_pvtransientflags_t;
typedef const struct pvdisplay_s * readonly_pvdisplay_t;
typedef const struct pvdisplay_segment_s * readonly_pvdisplay_segment_t;
typedef const struct pvtransfercalc_s * readonly_pvtransfercalc_t;
typedef const struct pvcursorstate_s * readonly_pvcursorstate_t;
typedef const struct pvtransferstate_s * readonly_pvtransferstate_t;
/*
* Structure containing the parameters used by formatters.
*/
struct pvformatter_args_s {
/*@dependent@*/ pvdisplay_t display; /* the display being updated */
/*@dependent@*/ pvdisplay_segment_t segment; /* the segment of the display */
/*@dependent@*/ readonly_pvprogramstatus_t status; /* program status */
/*@dependent@*/ readonly_pvcontrol_t control; /* control settings */
/*@dependent@*/ readonly_pvtransferstate_t transfer; /* transfer state */
/*@dependent@*/ readonly_pvtransfercalc_t calc; /* calculated transfer state */
/*@dependent@*/ char *buffer; /* buffer to write formatted segments into */
pvdisplay_bytecount_t buffer_size; /* size of the buffer */
pvdisplay_bytecount_t offset; /* current write position in the buffer */
};
typedef struct pvformatter_args_s *pvformatter_args_t;
/* Pointer to a formatter function. */
typedef pvdisplay_bytecount_t (*pvdisplay_formatter_t)(pvformatter_args_t);
/*
* Structure defining a format string sequence following a %.
*/
struct pvdisplay_component_s {
/*@null@ */ const char *match; /* string to match */
/*@null@ */ pvdisplay_formatter_t function; /* function to call */
bool dynamic; /* whether it can scale with screen size */
};
int pv_main_loop(pvstate_t);
void pv_display(pvstate_t, long double, off_t, off_t);
void pv_calculate_transfer_rate(pvtransfercalc_t, readonly_pvtransferstate_t, readonly_pvcontrol_t, readonly_pvdisplay_t, bool);
long pv_seconds_remaining(const off_t, const off_t, const long double);
void pv_si_prefix(long double *, char *, const long double, pvtransfercount_t);
void pv_describe_amount(char *, size_t, const char *, long double, char *, char *, pvtransfercount_t);
int8_t pv_display_barstyle_index(pvformatter_args_t, const char *);
pvdisplay_bytecount_t pv_formatter_segmentcontent(char *, pvformatter_args_t);
/*
* Formatting functions.
*
* Each formatting function takes a state, the current display, and the
* segment it's for; it also takes a buffer, with a particular size, and an
* offset at which to start writing to the buffer.
*
* If the component is dynamically sized (such as a progress bar with no
* chosen_size constraint), the segment's "width" is expected to have
* already been populated by the caller, with the target width.
*
* The function writes the appropriate string to the buffer at the offset,
* and updates the segment's "offset" and "bytes". The number of bytes
* written ("bytes") is also returned; it will be 0 if the string would not
* fit into the buffer.
*
* The caller is expected to update the segment's "width".
*
* If called with a buffer size of 0, only the side effects occur (such as
* setting flags like display->showing_timer).
*/
pvdisplay_bytecount_t pv_formatter_progress(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_progress_bar_only(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_progress_amount_only(pvformatter_args_t);
size_t pv_osc94_format(char *, size_t, readonly_pvcontrol_t, readonly_pvtransfercalc_t);
pvdisplay_bytecount_t pv_formatter_progress_conemu(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_bar_default(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_bar_plain(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_bar_block(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_bar_granular(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_bar_shaded(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_timer(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_eta(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_fineta(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_rate(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_average_rate(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_bytes(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_ratio(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_buffer_percent(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_last_written(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_previous_line(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_name(pvformatter_args_t);
pvdisplay_bytecount_t pv_formatter_sgr(pvformatter_args_t);
void pv_display (pvprogramstatus_t, readonly_pvcontrol_t, pvtransientflags_t,
readonly_pvtransferstate_t, pvtransfercalc_t,
pvcursorstate_t, pvdisplay_t, /*@null@ */ pvdisplay_t, bool);
ssize_t pv_transfer(pvstate_t, int, bool *, bool *, off_t, long *);
int pv_next_file(pvstate_t, unsigned int, int);
/*@out@*/ const char *pv_current_file_name(pvstate_t);
/*@keep@*/ const char *pv_current_file_name(pvstate_t);
unsigned int pv_update_calc_average_rate_window(pvtransfercalc_t, unsigned int);
void pv_reset_calc(pvtransfercalc_t);
void pv_reset_transfer(pvtransferstate_t);
void pv_reset_flags(pvtransientflags_t);
void pv_reset_display(pvdisplay_t);
void pv_freecontents_display(pvdisplay_t);
void pv_freecontents_transfer(pvtransferstate_t);
void pv_freecontents_calc(pvtransfercalc_t);
void pv_freecontents_watchfd(pvwatchfd_t);
void pv_freecontents_watchfd_items(struct pvwatcheditem_s *, unsigned int);
void pv_write_retry(int, const char *, size_t);
void pv_tty_write(readonly_pvtransientflags_t, const char *, size_t);
void pv_crs_fini(pvstate_t);
void pv_crs_init(pvstate_t);
void pv_crs_update(pvstate_t, const char *);
void pv_crs_fini(pvcursorstate_t, readonly_pvcontrol_t, pvtransientflags_t);
void pv_crs_init(pvcursorstate_t, readonly_pvcontrol_t, pvtransientflags_t);
void pv_crs_update(pvcursorstate_t, readonly_pvcontrol_t, pvtransientflags_t, const char *);
#ifdef HAVE_IPC
void pv_crs_needreinit(pvstate_t);
void pv_crs_needreinit(pvcursorstate_t);
#endif
void pv_sig_allowpause(void);
void pv_sig_checkbg(void);
void pv_sig_nopause(void);
void pv_remote_init(pvstate_t);
void pv_remote_check(pvstate_t);
void pv_remote_fini(pvstate_t);
int pv_remote_set(pvstate_t);
bool pv_remote_check(pvstate_t);
int pv_watchfd_info(pvstate_t, pvwatchfd_t, bool);
bool pv_watchfd_changed(pvwatchfd_t);
off_t pv_watchfd_position(pvwatchfd_t);
int pv_watchpid_scanfds(pvstate_t, pid_t, int *, pvwatchfd_t *, int *);
int pv_watchpid_scanfds(pvstate_t, pid_t, int, int *, pvwatchfd_t *);
void pv_watchpid_setname(pvstate_t, pvwatchfd_t);
#ifdef __cplusplus
@@ -351,5 +695,3 @@ void pv_watchpid_setname(pvstate_t, pvwatchfd_t);
#endif
#endif /* _PV_INTERNAL_H */
/* EOF */
+171 -38
View File
@@ -1,7 +1,7 @@
/*
* Functions used across the program.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -13,6 +13,7 @@
#include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <signal.h>
@@ -23,6 +24,19 @@
extern "C" {
#endif
/*
* Exit status bitmask values.
*/
#define PV_ERROREXIT_REMOTE_OR_PID 1
#define PV_ERROREXIT_SAF 1 /* store and forward error */
#define PV_ERROREXIT_MONITOR 1 /* monitor mode error */
#define PV_ERROREXIT_ACCESS 2
#define PV_ERROREXIT_OUROBOROS 4
#define PV_ERROREXIT_TRANSITION 8
#define PV_ERROREXIT_TRANSFER 16
#define PV_ERROREXIT_SIGNAL 32
#define PV_ERROREXIT_MEMORY 64
/*
* Opaque structure for PV internal state.
*/
@@ -33,8 +47,9 @@ typedef struct pvstate_s *pvstate_t;
* Valid number types for pv_getnum_check().
*/
typedef enum {
PV_NUMTYPE_INTEGER,
PV_NUMTYPE_DOUBLE
PV_NUMTYPE_ANY_WITH_SUFFIX,
PV_NUMTYPE_BARE_INTEGER,
PV_NUMTYPE_BARE_DOUBLE
} pv_numtype;
@@ -43,40 +58,63 @@ typedef enum {
*/
/*
* Return the given string converted to a double, for use as a time
* Return true if the character is an ASCII digit.
*/
extern bool pv_isdigit(char);
/*
* Return the numeric value of a string representing a positive decimal time
* interval.
*/
extern double pv_getnum_interval(const char *);
/*
* Return the given string converted to an off_t, for use as a size,
* optionally interpreting suffixes in decimal units (multiples of 1000)
* instead of multiples of 1024.
* Return the numeric value of a string representing a size, interpreting
* suffixes in decimal units (multiples of 1000) instead of multiples of
* 1024 if the second argument is true.
*
* Optionally also places the result in a long double.
*/
extern off_t pv_getnum_size(const char *, bool);
extern off_t pv_getnum_size(const char *, bool, /*@null@ */ long double *);
/*
* Return the given string converted to an unsigned integer, for use as a
* count such as screen width.
* Return the numeric value of a string representing a count such as screen
* width, interpreting it the same way as pv_getnum_size().
*/
extern unsigned int pv_getnum_count(const char *, bool);
/*
* Return true if the given string is a number of the given type. NB an
* integer is both a valid integer and a valid double.
* Return true if the given string is a number of the given type. Note that
* an integer is both a valid integer and a valid double.
*/
extern bool pv_getnum_check(const char *, pv_numtype);
/*
* Return a value representing the first amount as a percentage of the
* second total, i.e. 100*amount/total. If the second value, the total, is
* zero or less, return 0.
*/
extern double pv_percentage(off_t, const off_t);
/*
* String handling wrappers.
*/
/* String pointer that can be null. */
typedef /*@null@*/ char * nullable_string_ptr;
/*
* Wrapper for sprintf(), falling back to sprintf() on systems without that
* Wrapper for snprintf(), falling back to sprintf() on systems without that
* function.
*/
extern int pv_snprintf(char *, size_t, const char *, ...);
/*
* Wrapper for asprintf(), providing an equivalent on systems without that
* function.
*/
extern int pv_asprintf(nullable_string_ptr *, const char *, ...);
/*
* Implementation of strlcat() where it is unavailable: append a string to a
* buffer, constraining the buffer to a particular size and ensuring
@@ -88,7 +126,7 @@ extern size_t pv_strlcat(char *, const char *, size_t);
* Allocate and return a duplicate of a \0-terminated string, ensuring that
* the duplicate is also \0-terminated. Returns NULL on error.
*/
/*@null@ */ /*@only@ */ extern char *pv_strdup(const char *);
/*@null@ */ /*@only@ */ extern char *pv_strdup(const /*@null@ */ char *);
/*
* Return a pointer to the last matching character in the buffer, or NULL if
@@ -96,6 +134,16 @@ extern size_t pv_strlcat(char *, const char *, size_t);
*/
/*@null@ */ /*@temp@ */ extern void *pv_memrchr(const void *, int, size_t);
/*
* Return the displayed width of a string.
*/
extern size_t pv_strwidth(const char *, size_t);
/*
* Return true if the character is printable 7-bit ASCII.
*/
extern bool pv_isprint(char);
/*
* Functions relating to elapsed time.
*/
@@ -108,7 +156,7 @@ extern size_t pv_strlcat(char *, const char *, size_t);
*/
void pv_elapsedtime_read(struct timespec *);
/* Set the time in the given timespec to zero. */
/* Set the time in the timespec to zero. */
void pv_elapsedtime_zero(struct timespec *);
/* Copy the second timespec into the first. Analogous to strcpy(3). */
@@ -123,7 +171,7 @@ int pv_elapsedtime_compare(const struct timespec *, const struct timespec *);
/* Add the latter two timespecs and store them in the first timespec. */
void pv_elapsedtime_add(struct timespec *, const struct timespec *, const struct timespec *);
/* Add a number of nanoseconds to the given timespec. */
/* Add a number of nanoseconds to a timespec. */
void pv_elapsedtime_add_nsec(struct timespec *, long long);
/* Set the first timespec to the second minus the third. */
@@ -141,29 +189,73 @@ void pv_nanosleep(long long);
*/
/*
* Create a new state structure, and return it, or 0 (NULL) on error.
* Set the error message prefix. If the new prefix is NULL, the current
* prefix is cleared.
*/
extern /*@null@*/ /*@only@*/ pvstate_t pv_state_alloc(const char *);
extern void pv_set_error_prefix(/*@null@ */ const char *);
/*
* Set the formatting string, given a set of old-style formatting options.
* Output an error message. If anything has been sent to the terminal
* already, then put a newline before the message, to avoid writing over
* what was sent earlier.
*/
extern 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,
size_t lastwritten,
/*@null@*/ const char *name);
extern void pv_error(char *, ...);
/*
* Output an error message, like pv_error(), but following the message with
* a colon, a space, and the result of strerror(errno).
*/
extern void pv_perror(char *, ...);
/*
* Check that a file descriptor is open on /dev/null, returning true if so.
* Otherwise return false; if the second argument is true, reports the
* problem with pv_error() before returning.
*/
extern bool pv_fd_is_dev_null(int, bool);
/*
* Create a new state structure, and return it, or 0 (NULL) on error.
*/
extern /*@null@*/ /*@only@*/ pvstate_t pv_state_alloc(void);
/*
* Clear the calculated parts of a state structure.
*/
extern void pv_state_reset(pvstate_t state);
/*
* Set the format options and use them to build a default formatting string.
* The default string is used if no format string is explicitly set.
*/
typedef struct {
size_t lastwritten; /* --last-written (amount) */
bool progress; /* --progress */
bool timer; /* --timer */
bool eta; /* --eta */
bool fineta; /* --fineta */
bool rate; /* --rate */
bool average_rate; /* --average-rate */
bool bytes; /* --bytes */
bool bufpercent; /* --buffer-percent */
} pvformatoptions_s;
extern void pv_state_set_format_options(pvstate_t, pvformatoptions_s);
/* Append a string to the default format, and trigger a format reparse. */
void pv_state_append_to_default_format(pvstate_t, /*@null@ */ const char *);
/*
* Set the various options.
*/
extern void pv_state_force_set(pvstate_t, bool);
extern void pv_state_cursor_set(pvstate_t, bool);
extern void pv_state_use_osc94_set(pvstate_t, bool);
extern void pv_state_show_stats_set(pvstate_t, bool);
extern void pv_state_numeric_set(pvstate_t, bool);
extern void pv_state_wait_set(pvstate_t, bool);
extern void pv_state_delay_start_set(pvstate_t, double);
extern void pv_state_rate_gauge_set(pvstate_t, bool);
extern void pv_state_linemode_set(pvstate_t, bool);
extern void pv_state_bits_set(pvstate_t, bool);
extern void pv_state_decimal_units_set(pvstate_t, bool);
@@ -174,29 +266,37 @@ extern void pv_state_error_skip_block_set(pvstate_t, off_t);
extern void pv_state_stop_at_size_set(pvstate_t, bool);
extern void pv_state_sync_after_write_set(pvstate_t, bool);
extern void pv_state_direct_io_set(pvstate_t, bool);
extern void pv_state_rate_limit_set(pvstate_t, off_t);
extern void pv_state_sparse_output_set(pvstate_t, bool);
extern void pv_state_rate_limit_set(pvstate_t, long double, bool, bool);
extern void pv_state_target_buffer_size_set(pvstate_t, size_t);
extern void pv_state_no_splice_set(pvstate_t, bool);
extern void pv_state_pipe_buffer_size_set(pvstate_t, size_t);
extern void pv_state_discard_input_set(pvstate_t, bool);
extern void pv_state_size_set(pvstate_t, off_t);
extern void pv_state_interval_set(pvstate_t, double);
extern void pv_state_width_set(pvstate_t, unsigned int, bool);
extern void pv_state_height_set(pvstate_t, unsigned int, bool);
extern void pv_state_name_set(pvstate_t, /*@null@*/ const char *);
extern void pv_state_default_bar_style_set(pvstate_t, /*@null@ */ const char *);
extern void pv_state_format_string_set(pvstate_t, /*@null@*/ const char *);
extern void pv_state_watch_pid_set(pvstate_t, pid_t);
extern void pv_state_watch_fd_set(pvstate_t, int);
extern void pv_state_extra_display_set(pvstate_t, /*@null@*/ const char *);
extern void pv_state_output_set(pvstate_t, int, const char *);
extern void pv_state_average_rate_window_set(pvstate_t, unsigned int);
extern void pv_state_set_terminal_supports_utf8(pvstate_t, bool);
extern void pv_state_othermonitor_set(pvstate_t, pid_t, int, int);
extern void pv_state_cancel_output_if_empty_format_string(pvstate_t);
extern void pv_state_inputfiles(pvstate_t, unsigned int, const char **);
extern void pv_state_watchfds(pvstate_t, unsigned int, const pid_t *, const int *);
/*
* Work out whether we are in the foreground.
* Return true if either this is the foreground process on the terminal, or
* if the output is not a terminal; false otherwise.
*/
extern bool pv_in_foreground(void);
/*
* Work out the terminal size.
* Populate *width and *height with the current terminal size.
*/
extern void pv_screensize(unsigned int *width, unsigned int *height);
@@ -210,27 +310,53 @@ extern off_t pv_calc_total_size(pvstate_t);
*/
extern void pv_sig_init(pvstate_t);
#ifdef SA_SIGINFO
#ifdef PV_REMOTE_CONTROL
/*
* Return true if SIGUSR2 has been received, and indicate the sender.
*/
extern bool pv_sigusr2_received(pvstate_t, pid_t *);
/*
* Return true if SIGUSR1 has been received, and indicate the sender.
*/
extern bool pv_sigusr1_received(pvstate_t, pid_t *);
#endif
/*
* Return a stream pointer for a control file associated with a particular
* process ID and signal.
*/
/*@null@ */
/*@dependent@ */
extern FILE *pv_open_controlfile(char *, size_t, pid_t, int, bool);
/*
* Enter the main transfer loop, transferring all input files to the output.
*/
extern int pv_main_loop(pvstate_t);
/*
* Watch the selected file descriptor of the selected process.
* Watch the selected file descriptors of the selected processes.
*/
extern int pv_watchfd_loop(pvstate_t);
/*
* Watch the selected process.
* Watch the progress of another pv process.
*/
extern int pv_watchpid_loop(pvstate_t);
extern int pv_query_loop(pvstate_t, pid_t);
/*
* Set the options of another pv process.
*/
int pv_remote_set(pvstate_t, pid_t);
/*
* Query another pv process for its elapsed transfer time, amount
* transferred, and total size, and update the local state with those
* values. Optionally also return the total size separately. Reports
* errors unless "silent" is true.
*/
int pv_remote_transferstate_fetch(pvstate_t state, pid_t query, /*@null@ */ off_t *sizeptr, bool silent);
/*
* Shut down signal handlers after running the main loop.
@@ -242,6 +368,15 @@ extern void pv_sig_fini(pvstate_t);
*/
extern void pv_state_free(/*@only@*/ pvstate_t);
/*
* Return a string listing all supported format sequences.
*/
/*@null@*/ char *pv_format_sequences(void);
#if ! HAVE_SETPROCTITLE
void initproctitle(int, char **);
void setproctitle(const char *, ...);
#endif
#ifdef ENABLE_DEBUGGING
# if __STDC_VERSION__ < 199901L && !defined(__func__)
@@ -253,7 +388,7 @@ extern void pv_state_free(/*@only@*/ pvstate_t);
# endif
# define debug(x,...) debugging_output(__func__, __FILE__, __LINE__, x, __VA_ARGS__)
#else
# define debug(x,...) do { } while (0)
# define debug(x,...) /*@-noeffect@*/ do { } while (0) /*@+noeffect@*/
#endif
/*
@@ -272,5 +407,3 @@ void debugging_output(const char *, const char *, int, const char *, ...);
#endif
#endif /* _PV_H */
/* EOF */
+23 -16
View File
@@ -1,7 +1,7 @@
/*
* Output debugging information.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -39,21 +39,21 @@ void debugging_output(const char *function, const char *file, int line, const ch
static FILE *debugfptr = NULL;
va_list ap;
time_t t;
struct tm *tm;
const struct tm *tm;
char tbuf[128]; /* flawfinder: ignore */
/*
* flawfinder note: tbuf is only written to by strftime() which
* takes its size, and we enforce string termination.
* takes its size, and string termination is enforced.
*/
if (false == tried_open) {
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.
* flawfinder note: the caller directly controls the
* filename, so using append mode is the safest
* option.
*/
}
tried_open = true;
@@ -63,13 +63,22 @@ void debugging_output(const char *function, const char *file, int line, const ch
return;
}
/*
* Note gmtime() is used rather than localtime(). Testing with
* "strace" showed many cases where "pv </dev/zero | cat >/dev/null"
* being paused and backgrounded would cause pv to be stuck in
* futex_wait() inside a pv_sig_alrm() inside a pv_sig_cont(). The
* backtrace mentioned many time zone conversion steps, and all of
* that goes away with gmtime().
*/
(void) time(&t);
tm = localtime(&t);
tm = gmtime(&t);
tbuf[0] = '\0';
if (0 == strftime(tbuf, sizeof(tbuf), "%Y-%m-%d %H:%M:%S", tm)) {
tbuf[0] = '\0';
}
tbuf[sizeof(tbuf) - 1] = '\0'; /* enforce termination */
tbuf[sizeof(tbuf) - 1] = '\0'; /* enforce termination. */
(void) fprintf(debugfptr, "[%s] (%d) %s (%s:%d): ", tbuf, getpid(), function, file, line);
@@ -79,7 +88,7 @@ void debugging_output(const char *function, const char *file, int line, const ch
/*
* flawfinder note: vfprintf format is explicitly controlled by the
* caller of this function - no mitigation possible or desirable.
* caller of this function - no mitigation is possible or desirable.
*/
(void) fprintf(debugfptr, "\n");
@@ -91,7 +100,7 @@ void debugging_output(const char *function, const char *file, int line, const ch
/*
* Stub debugging destination function.
*/
void debugging_output_destination( __attribute__((unused))
void debugging_output_destination( /*@unused@ */ __attribute__((unused))
const char *filename)
{
}
@@ -99,14 +108,12 @@ void debugging_output_destination( __attribute__((unused))
/*
* 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( /*@unused@ */ __attribute__((unused))
const char *function, /*@unused@ */ __attribute__((unused))
const char *file, /*@unused@ */ __attribute__((unused))
int line, /*@unused@ */ __attribute__((unused))
const char *format, ...)
{
}
#endif /* ENABLE_DEBUGGING */
/* EOF */
+179 -113
View File
@@ -1,7 +1,7 @@
/*
* Output command-line help to stdout.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -22,77 +22,26 @@
/*
* 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.
* Return the number of display columns needed to show the given
* null-terminated string.
*
* 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;
size_t bytes;
if (NULL == string)
return 0;
/*@-nullpass@ */
bytes = strlen(string); /* flawfinder: ignore */
/*
* splint note: mbstowcs() manual page on Linux explicitly says it
* takes NULL.
* flawfinder rationale: it is explicitly required of the caller to
* provide a null-terminated string.
*/
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;
return pv_strwidth(string, bytes);
}
@@ -100,95 +49,147 @@ static size_t display_width(const char *string)
* 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)
static void display_word_wrap_7bit(const char *string, size_t display_width, size_t first_line_start,
size_t left_margin)
{
const char *start;
const char *end;
size_t wrap_at_width;
if (NULL == string)
return;
start = string;
wrap_at_width = display_width;
if (wrap_at_width > first_line_start)
wrap_at_width -= first_line_start;
while (strlen(start) > display_width) { /* flawfinder: ignore */
/* Wrap lines that are too long. */
while (strlen(start) > wrap_at_width) { /* flawfinder: ignore */
/* flawfinder rationale: see above. */
end = start + display_width;
/*
* Find the last space before the end of the display line,
* or if there isn't one, behave as if there was one at the
* end of the display line.
*/
end = start + wrap_at_width;
while ((end > start) && (end[0] != ' '))
end--;
if (end == start) {
end = start + display_width;
end = start + wrap_at_width;
} else {
end++;
}
/* Display the string up to that space. */
printf("%.*s", (int) (end - start), start);
if (end == start)
end++;
start = end;
if (start[0] != '\0')
/*
* If there's more text left, start a new display line and
* pad it with spaces to the left margin, and change the
* wrap width to the display width minus the left margin.
*/
if (start[0] != '\0') {
printf("\n%*s", (int) left_margin, "");
if (display_width > left_margin) {
wrap_at_width = display_width - left_margin;
} else {
wrap_at_width = 1;
}
}
}
/* Display the remainder of the string. */
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.
* Output a null-terminated string to standard output, word wrapping to
* "display_width" display character positions, assuming that the first line
* starts with the cursor already at "first_line_start" display character
* positions from the left, 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)
static void display_word_wrap(const char *string, size_t display_width, size_t first_line_start, size_t left_margin)
{
#if defined(ENABLE_NLS) && defined(HAVE_WCHAR_H)
size_t wrap_at_width;
size_t wide_char_count;
size_t wide_string_buffer_size;
wchar_t *wide_string;
size_t start_idx, end_idx, chars_remaining;
size_t start_idx, chars_remaining;
debug("[%s], display_width=%d, first_line_start=%d, left_margin=%d", string, (int) display_width,
(int) first_line_start, (int) left_margin);
if (NULL == string)
return;
/* Calculate how many wide characters are in the multibyte string. */
/*@-nullpass@ */
/* splint note: see earlier mbstowcs() call. */
/* splint note: see mbstowcs() call in pv_strwidth(). */
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);
display_word_wrap_7bit(string, display_width, first_line_start, left_margin);
return;
}
/*
* Allocate a buffer in which to convert the multibyte string to a
* wide-character string, plus one character for zero padding.
*/
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);
display_word_wrap_7bit(string, display_width, first_line_start, left_margin);
return;
}
memset(wide_string, 0, wide_string_buffer_size);
/* Convert the multibyte string to a wide-character string. */
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);
display_word_wrap_7bit(string, display_width, first_line_start, left_margin);
return;
}
start_idx = 0;
wrap_at_width = display_width;
if (wrap_at_width > first_line_start)
wrap_at_width -= first_line_start;
chars_remaining = wide_char_count;
while (chars_remaining > 0 && wcswidth(&(wide_string[start_idx]), chars_remaining) > display_width) {
size_t next_idx;
/* Wrap lines that are too long. */
end_idx = start_idx + display_width;
/*@-unrecog@ *//* splint doesn't see the prototype for wcswidth(). */
while (chars_remaining > 0 && wcswidth(&(wide_string[start_idx]), chars_remaining) > (int) wrap_at_width) {
/*@+unrecog@ */
size_t next_idx, end_idx;
/*
* Find the last space before the end of the display line,
* or if there isn't one, behave as if there was one at the
* end of the display line.
*/
end_idx = start_idx + wrap_at_width;
while ((end_idx > start_idx) && (!iswspace(wide_string[end_idx])))
end_idx--;
if (end_idx == start_idx) {
end_idx = start_idx + display_width;
end_idx = start_idx + wrap_at_width;
} else {
end_idx++;
}
@@ -197,12 +198,13 @@ static void display_word_wrap(const char *string, size_t display_width, size_t l
if (end_idx == start_idx)
next_idx++;
/* Display the string up to that space, a character at a time. */
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
* flawfinder rationale: the array is explicitly
* cleared, large enough according to the wctomb()
* manual, and we explicitly terminate the string.
* manual, and the string is explicitly terminated.
*/
memset(multi_byte_string, 0, MB_CUR_MAX + 1);
if (wctomb(multi_byte_string, wide_string[start_idx]) >= 0) {
@@ -213,12 +215,26 @@ static void display_word_wrap(const char *string, size_t display_width, size_t l
}
start_idx = next_idx;
if (start_idx < wide_char_count)
/*
* If there's more text left, start a new display line and
* pad it with spaces to the left margin, and change the
* wrap width to the display width minus the left margin.
*/
if (start_idx < wide_char_count) {
printf("\n%*s", (int) left_margin, "");
chars_remaining = wide_char_count - start_idx;
if (display_width > left_margin) {
wrap_at_width = display_width - left_margin;
} else {
wrap_at_width = 1;
}
chars_remaining = wide_char_count - start_idx;
} else {
/* Explicitly set to 0 to avoid underflow. */
chars_remaining = 0;
}
}
/* Display the remainder of the string, a character at a time. */
while (start_idx < wide_char_count) {
char multi_byte_string[MB_CUR_MAX + 1]; /* flawfinder: ignore */
/* flawfinder rationale as above. */
@@ -233,7 +249,7 @@ static void display_word_wrap(const char *string, size_t display_width, size_t l
free(wide_string);
#else /* ! defined(ENABLE_NLS) && defined(HAVE_WCHAR_H) */
display_word_wrap_7bit(string, display_width, left_margin);
display_word_wrap_7bit(string, display_width, first_line_start, left_margin);
#endif /* defined(ENABLE_NLS) && defined(HAVE_WCHAR_H) */
}
@@ -298,18 +314,9 @@ void display_help(void)
{ "-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} },
{ "-k", "--si", NULL,
N_("treat suffixes as multiples of 1000 rather than 1024"),
{ 0, 0, 0, 0} },
{ "-T", "--buffer-percent", NULL,
N_("show percentage of transfer buffer in use"),
{ 0, 0, 0, 0} },
@@ -326,6 +333,12 @@ void display_help(void)
N_("do not output any transfer information at all"),
{ 0, 0, 0, 0} },
{ "", NULL, NULL, NULL, { 0, 0, 0, 0} },
{ "-8", "--bits", NULL,
N_("show number of bits transferred"),
{ 0, 0, 0, 0} },
{ "-k", "--si", NULL,
N_("treat suffixes as multiples of 1000 rather than 1024"),
{ 0, 0, 0, 0} },
{ "-W", "--wait", NULL,
N_("display nothing until first byte transferred"),
{ 0, 0, 0, 0} },
@@ -335,6 +348,9 @@ void display_help(void)
{ "-s", "--size", N_("SIZE"),
N_("set estimated data size to SIZE bytes"),
{ 0, 0, 0, 0} },
{ "-g", "--gauge", NULL,
N_("if size unknown, show rate vs max rate"),
{ 0, 0, 0, 0} },
{ "-l", "--line-mode", NULL,
N_("count lines instead of bytes"),
{ 0, 0, 0, 0} },
@@ -344,6 +360,9 @@ void display_help(void)
{ "-i", "--interval", N_("SEC"),
N_("update every SEC seconds"),
{ 0, 0, 0, 0} },
{ "-m", "--average-rate-window", N_("SEC"),
N_("compute average rate over past SEC seconds (default 30s)"),
{ 0, 0, 0, 0} },
{ "-w", "--width", N_("WIDTH"),
N_("assume terminal is WIDTH characters wide"),
{ 0, 0, 0, 0} },
@@ -353,6 +372,18 @@ void display_help(void)
{ "-N", "--name", N_("NAME"),
N_("prefix visual information with NAME"),
{ 0, 0, 0, 0} },
{ "-u", "--bar-style", N_("STYLE"),
N_("set default bar style to STYLE"),
{ 0, 0, 0, 0} },
{ "-x", "--extra-display", N_("SPEC"),
N_("also send progress to SPEC"),
{ 0, 0, 0, 0} },
{ "-9", "--conemu", NULL,
N_("set terminal progress state with OSC 9;4 (ConEmu)"),
{ 0, 0, 0, 0} },
{ "-v", "--stats", NULL,
N_("output transfer statistics at the end"),
{ 0, 0, 0, 0} },
{ "-f", "--force", NULL,
N_("output even if standard error is not a terminal"),
{ 0, 0, 0, 0} },
@@ -360,6 +391,9 @@ void display_help(void)
N_("use cursor positioning escape sequences"),
{ 0, 0, 0, 0} },
{ "", NULL, NULL, NULL, { 0, 0, 0, 0} },
{ "-o", "--output", N_("FILE"),
N_("write output to FILE instead of stdout"),
{ 0, 0, 0, 0} },
{ "-L", "--rate-limit", N_("RATE"),
N_("limit transfer to RATE bytes per second"),
{ 0, 0, 0, 0} },
@@ -369,6 +403,9 @@ void display_help(void)
{ "-C", "--no-splice", NULL,
N_("never use splice(), always use read/write"),
{ 0, 0, 0, 0} },
{ "-J", "--pipe-buffer-size", N_("BYTES"),
N_("set the pipe buffer size to BYTES"),
{ 0, 0, 0, 0} },
{ "-E", "--skip-errors", NULL,
N_("skip read errors in input"),
{ 0, 0, 0, 0} },
@@ -384,23 +421,34 @@ void display_help(void)
{ "-K", "--direct-io", NULL,
N_("use direct I/O to bypass cache"),
{ 0, 0, 0, 0} },
{ "-O", "--sparse", NULL,
N_("try to seek instead of writing null bytes"),
{ 0, 0, 0, 0} },
{ "-X", "--discard", NULL,
N_("discard input instead of writing to output"),
{ 0, 0, 0, 0} },
#ifdef SA_SIGINFO
{ "-U", "--store-and-forward", N_("FILE"),
N_("write all input to FILE before writing to output"),
{ 0, 0, 0, 0} },
{ "", NULL, NULL, NULL, { 0, 0, 0, 0} },
{ "-d", "--watchfd", N_("PID[:FD]|=NAME|@LISTFILE"),
N_("watch file FD opened by process PID"),
{ 0, 0, 0, 0} },
#ifdef PV_REMOTE_CONTROL
{ "-R", "--remote", N_("PID"),
N_("update settings of process PID"),
{ 0, 0, 0, 0} },
#endif /* SA_SIGINFO */
{ "-Q", "--query", N_("PID"),
N_("show progress of process PID"),
{ 0, 0, 0, 0} },
#endif /* PV_REMOTE_CONTROL */
{ "-M", "--monitor", "in|0|out|1|both|2",
N_("run a command and monitor its standard input, output, or both"),
{ 0, 0, 0, 0} },
{ "", 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} },
@@ -421,6 +469,7 @@ void display_help(void)
size_t right_margin = 77;
const char *program_description;
const char *bug_report_note;
char *format_sequences = NULL;
unsigned int terminal_width = 0, terminal_height = 0;
pv_screensize(&terminal_width, &terminal_height);
@@ -443,11 +492,11 @@ void display_help(void)
/*
* 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.
* fact that each string is only translated 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);
display_word_wrap(program_description, right_margin, 0, 0);
printf("\n");
}
@@ -457,8 +506,8 @@ void display_help(void)
* 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.
* the "option" width. The widest one is used 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;
@@ -502,7 +551,8 @@ void display_help(void)
*
* " <short>, <long> <arg> <description>"
*
* If we don't have getopt_long() then ", <long>" is omitted.
* If getopt_long() is unavailable then ", <long>" is
* omitted.
*/
option_width += 2 + definition->width.opt_short; /* " short" */
#ifdef HAVE_GETOPT_LONG
@@ -520,9 +570,12 @@ void display_help(void)
* 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.
* "min_description_width" characters of description. If there's
* not even room for that, set the left margin to 2.
*/
description_left_margin = right_margin - min_description_width;
description_left_margin = 2;
if (right_margin > (min_description_width + 2))
description_left_margin = right_margin - min_description_width;
if (widest_option_width < description_left_margin) {
description_left_margin = widest_option_width;
}
@@ -563,23 +616,38 @@ void display_help(void)
}
/*
* 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 the option (with 2 trailing spaces) is too wide, start
* a new line for the description. Either way, pad with
* spaces up to the description left margin.
*/
if (option_width > description_left_margin) {
if ((option_width + 2) > 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,
display_word_wrap(definition->opt_description, right_margin, description_left_margin,
description_left_margin);
printf("\n");
}
format_sequences = pv_format_sequences();
if (NULL != format_sequences) {
const char *format_sequence_header;
format_sequence_header = _("Supported format sequences:");
if (NULL != format_sequence_header) {
printf("\n");
display_word_wrap(format_sequence_header, right_margin, 0, 0);
printf("\n");
}
printf("\n ");
display_word_wrap(format_sequences, right_margin, 2, 2);
free(format_sequences);
printf("\n");
}
printf("\n");
bug_report_note = _("Please report any bugs to: %s");
@@ -595,5 +663,3 @@ void display_help(void)
printf("\n");
}
/* EOF */
+794 -158
View File
File diff suppressed because it is too large Load Diff
+883 -109
View File
File diff suppressed because it is too large Load Diff
-436
View File
@@ -1,436 +0,0 @@
/*
* Remote-control functions.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "options.h"
#include "pv.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#ifdef SA_SIGINFO
void pv_error(pvstate_t, char *, ...);
struct remote_msg {
bool progress; /* progress bar flag */
bool timer; /* timer flag */
bool eta; /* ETA flag */
bool fineta; /* absolute ETA flag */
bool rate; /* rate counter flag */
bool average_rate; /* average rate counter flag */
bool bytes; /* bytes transferred flag */
bool bufpercent; /* transfer buffer percentage flag */
size_t lastwritten; /* last-written bytes count */
off_t rate_limit; /* rate limit, in bytes per second */
size_t buffer_size; /* buffer size, in bytes (0=default) */
off_t size; /* total size of data */
double interval; /* interval between updates */
unsigned int width; /* screen width */
unsigned int height; /* screen height */
bool width_set_manually; /* width was set manually, not detected */
bool height_set_manually; /* height was set manually, not detected */
char name[256]; /* flawfinder: ignore */
char format[256]; /* flawfinder: ignore */
};
/*
* flawfinder rationale: name and format are always explicitly zeroed and
* bounded to one less than their size so they are always \0 terminated.
*/
/*
* Return a stream pointer, and populate the filename buffer, for a control
* file associated with a particular process ID; it will be opened for
* writing if "sender" is true. Returns NULL on error.
*/
static FILE *pv__control_file(char *filename, size_t bufsize, pid_t control_pid, bool sender)
{
int open_flags, open_mode, control_fd;
FILE *control_fptr;
open_flags = O_RDONLY;
#ifdef O_NOFOLLOW
open_flags += O_NOFOLLOW;
#endif
if (sender)
open_flags = O_WRONLY | O_CREAT | O_EXCL;
open_mode = 0644;
(void) pv_snprintf(filename, bufsize, "/run/user/%lu/pv.remote.%lu", (unsigned long) geteuid(),
(unsigned long) control_pid);
control_fd = open(filename, open_flags, open_mode); /* flawfinder: ignore */
/*
* If /run/user/<uid> wasn't usable, try $HOME/.pv instead.
*/
if (control_fd < 0) {
char *home_dir;
home_dir = getenv("HOME"); /* flawfinder: ignore */
if (NULL == home_dir)
return NULL;
if ('\0' == home_dir[0])
return NULL;
/*
* flawfinder rationale: null and zero-size values are
* rejected, and the destination buffer is bounded.
*/
(void) pv_snprintf(filename, bufsize, "%s/.pv/remote.%lu", home_dir, (unsigned long) control_pid);
control_fd = open(filename, open_flags, open_mode); /* flawfinder: ignore */
/*
* If the open failed, try creating the $HOME/.pv directory
* first.
*/
if (control_fd < 0) {
(void) pv_snprintf(filename, bufsize, "%s/.pv", home_dir);
(void) mkdir(filename, 0700);
/* In case of weird umask, explicitly chmod the dir. */
(void) chmod(filename, 0700); /* flawfinder: ignore */
(void) pv_snprintf(filename, bufsize, "%s/.pv/remote.%lu", home_dir,
(unsigned long) control_pid);
control_fd = open(filename, open_flags, open_mode); /* flawfinder: ignore */
}
}
/*
* flawfinder rationale: the files are in a directory whose parents
* cannot be manipulated, and we are not allowing the final
* component to be a symbolic link. We are checking that $HOME is
* not NULL, and it's bounded by pv_snprintf() so it can't overshoot
* the filename buffer. When we chmod $HOME/.pv, we assume that an
* attacker is unlikely to be able to manipulate $HOME's contents to
* make use of us setting $HOME/.pv to mode 700.
*/
if (control_fd < 0)
return NULL;
debug("%s: %s", "control filename", filename);
control_fptr = fdopen(control_fd, sender ? "wb" : "rb");
return control_fptr;
}
/*
* Set the options of a remote process by writing them to a file, sending a
* signal to the receiving process, and waiting for the message to be
* consumed by the remote process.
*
* Returns nonzero on error.
*/
int pv_remote_set(opts_t opts, pvstate_t state)
{
char control_filename[4096]; /* flawfinder: ignore */
FILE *control_fptr;
struct remote_msg msgbuf;
pid_t signal_sender;
long timeout;
bool received;
/*
* flawfinder rationale: buffer is large enough, explicitly zeroed,
* and always bounded properly as we are only writing to it with
* pv_snprintf().
*/
/*
* Check that the remote process exists.
*/
if (kill((pid_t) (opts->remote), 0) != 0) {
pv_error(state, "%u: %s", opts->remote, strerror(errno));
return 1;
}
/*
* Make sure parameters are within sensible bounds.
*/
if (opts->width < 1)
opts->width = 80;
if (opts->height < 1)
opts->height = 25;
if (opts->width > 999999)
opts->width = 999999;
if (opts->height > 999999)
opts->height = 999999;
if ((opts->interval > 0) && (opts->interval < 0.1))
opts->interval = 0.1;
if (opts->interval > 600)
opts->interval = 600;
/*
* Copy parameters into message buffer.
*/
memset(&msgbuf, 0, sizeof(msgbuf));
msgbuf.progress = opts->progress;
msgbuf.timer = opts->timer;
msgbuf.eta = opts->eta;
msgbuf.fineta = opts->fineta;
msgbuf.rate = opts->rate;
msgbuf.average_rate = opts->average_rate;
msgbuf.bytes = opts->bytes;
msgbuf.bufpercent = opts->bufpercent;
msgbuf.lastwritten = opts->lastwritten;
msgbuf.rate_limit = opts->rate_limit;
msgbuf.buffer_size = opts->buffer_size;
msgbuf.size = opts->size;
msgbuf.interval = opts->interval;
msgbuf.width = opts->width;
msgbuf.height = opts->height;
msgbuf.width_set_manually = opts->width_set_manually;
msgbuf.height_set_manually = opts->height_set_manually;
if (opts->name != NULL) {
strncpy(msgbuf.name, opts->name, sizeof(msgbuf.name) - 1); /* flawfinder: ignore */
}
if (opts->format != NULL) {
strncpy(msgbuf.format, opts->format, sizeof(msgbuf.format) - 1); /* flawfinder: ignore */
}
/*
* flawfinder rationale: both name and format are explicitly bounded
* to 1 less than the size of their buffer and the buffer is \0
* terminated by memset() earlier.
*/
/*
* Get the filename and file stream to use for remote control.
*/
memset(control_filename, 0, sizeof(control_filename));
control_fptr = pv__control_file(control_filename, sizeof(control_filename), getpid(), true);
if (NULL == control_fptr) {
pv_error(state, "%s", strerror(errno));
return 1;
}
/*
* Write the message buffer to the remote control file, and close
* it.
*/
if (1 != fwrite(&msgbuf, sizeof(msgbuf), 1, control_fptr)) {
pv_error(state, "%s", strerror(errno));
(void) fclose(control_fptr);
(void) remove(control_filename);
return 1;
}
if (0 != fclose(control_fptr)) {
pv_error(state, "%s", strerror(errno));
(void) remove(control_filename);
return 1;
}
/*
* Send a SIGUSR2 signal to the remote process, to tell it a message
* is ready to read, after clearing our own "SIGUSR2 received" flag.
*/
signal_sender = 0;
(void) pv_sigusr2_received(state, &signal_sender);
if (kill((pid_t) (opts->remote), SIGUSR2) != 0) {
pv_error(state, "%u: %s", opts->remote, strerror(errno));
(void) remove(control_filename);
return 1;
}
debug("%s", "message sent");
/*
* Wait for a signal from the remote process to say it has received
* the message.
*/
timeout = 1100000;
received = false;
while (timeout > 10000 && !received) {
struct timeval tv;
memset(&tv, 0, sizeof(tv));
tv.tv_sec = 0;
tv.tv_usec = 10000;
/*@-nullpass@ *//* splint: NULL is OK with select() */
(void) select(0, NULL, NULL, NULL, &tv);
/*@+nullpass@ */
timeout -= 10000;
if (pv_sigusr2_received(state, &signal_sender)) {
if (signal_sender == opts->remote) {
debug("%s", "message received");
received = true;
}
}
}
/*
* Remove the remote control file.
*/
if (0 != remove(control_filename)) {
pv_error(state, "%s", strerror(errno));
}
/*
* Return 0 if the message was received.
*/
if (received)
return 0;
/*@-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.
*/
pv_error(state, "%u: %s", opts->remote, _("message not received"));
return 1;
/*@+mustfreefresh @ */
}
/*
* Check for a remote control message and, if there is one, replace the
* current process's options with those being passed in.
*
* NB relies on pv_state_set_format() causing the output format to be
* reparsed.
*/
void pv_remote_check(pvstate_t state)
{
pid_t signal_sender;
char control_filename[4096]; /* flawfinder: ignore */
FILE *control_fptr;
struct remote_msg msgbuf;
/* flawfinder rationale: as above. */
/*
* Return early if a SIGUSR2 signal has not been received.
*/
signal_sender = 0;
if (!pv_sigusr2_received(state, &signal_sender))
return;
memset(control_filename, 0, sizeof(control_filename));
control_fptr = pv__control_file(control_filename, sizeof(control_filename), signal_sender, false);
if (NULL == control_fptr) {
pv_error(state, "%s", strerror(errno));
return;
}
/*
* Read the message buffer from the remote control file, and close
* it.
*/
if (1 != fread(&msgbuf, sizeof(msgbuf), 1, control_fptr)) {
pv_error(state, "%s", strerror(errno));
(void) fclose(control_fptr);
return;
}
if (0 != fclose(control_fptr)) {
pv_error(state, "%s", strerror(errno));
return;
}
/*
* Send a SIGUSR2 signal to the sending process, to tell it the
* message has been received.
*/
if (kill(signal_sender, SIGUSR2) != 0) {
debug("%u: %s", signal_sender, strerror(errno));
}
debug("%s", "received remote message");
pv_state_format_string_set(state, NULL);
pv_state_name_set(state, NULL);
msgbuf.name[sizeof(msgbuf.name) - 1] = '\0';
msgbuf.format[sizeof(msgbuf.format) - 1] = '\0';
pv_state_set_format(state, msgbuf.progress, msgbuf.timer,
msgbuf.eta, msgbuf.fineta, msgbuf.rate,
msgbuf.average_rate,
msgbuf.bytes, msgbuf.bufpercent,
msgbuf.lastwritten, '\0' == msgbuf.name[0] ? NULL : msgbuf.name);
if (msgbuf.rate_limit > 0)
pv_state_rate_limit_set(state, msgbuf.rate_limit);
if (msgbuf.buffer_size > 0) {
pv_state_target_buffer_size_set(state, msgbuf.buffer_size);
}
if (msgbuf.size > 0)
pv_state_size_set(state, msgbuf.size);
if (msgbuf.interval > 0)
pv_state_interval_set(state, msgbuf.interval);
if (msgbuf.width > 0 && msgbuf.width_set_manually)
pv_state_width_set(state, msgbuf.width, msgbuf.width_set_manually);
if (msgbuf.height > 0 && msgbuf.height_set_manually)
pv_state_height_set(state, msgbuf.height, msgbuf.height_set_manually);
if (msgbuf.format[0] != '\0')
pv_state_format_string_set(state, msgbuf.format);
}
/*
* Initialise remote message reception handling.
*/
void pv_remote_init(void)
{
}
/*
* Clean up after remote message reception handling.
*/
void pv_remote_fini(void)
{
}
#else /* !SA_SIGINFO */
/*
* Dummy stubs for remote control when we don't have SA_SIGINFO.
*/
void pv_remote_init(void)
{
}
void pv_remote_check( /*@unused@ */ __attribute__((unused)) pvstate_t state)
{
}
void pv_remote_fini(void)
{
}
int pv_remote_set( /*@unused@ */
__attribute__((unused)) opts_t opts, /*@unused@ */ __attribute__((unused)) pvstate_t state)
{
/*@-mustfreefresh@ *//* splint - see above */
fprintf(stderr, "%s\n", _("SA_SIGINFO not supported on this system"));
/*@+mustfreefresh@ */
return 1;
}
#endif /* SA_SIGINFO */
/* EOF */
+7 -9
View File
@@ -1,7 +1,7 @@
/*
* Output version information to stdout.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -18,18 +18,16 @@ void display_version(void)
/*
* 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.
* fact that each string is only translated once.
*/
/* GNU standard first line format: program and version only */
/* GNU standard first line format: program and version only. */
printf("%s %s\n", PACKAGE_NAME, PACKAGE_VERSION);
/* GNU standard second line format - "Copyright" always in English */
printf("Copyright %s %s\n", "2023", "Andrew Wood");
/* GNU standard license line and free software notice */
/* GNU standard second line format - "Copyright" always in English. */
printf("Copyright %s %s\n", "2026", "Andrew Wood");
/* GNU standard license line and free software notice. */
printf("%s\n", _("License: GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.html>"));
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 */
/* Project web site link. */
printf("\n%s: <%s>\n", _("Project web site"), PACKAGE_URL);
}
/* EOF */
+180
View File
@@ -0,0 +1,180 @@
/*
* Functions for updating the calculated state of the transfer.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
/*
* Update the current average rate, using a ring buffer of past transfer
* positions - if this is the first entry, use the provided instantaneous
* rate, otherwise calculate the average rate from the difference between
* the current position + elapsed time pair, and the oldest pair in the
* buffer. The current elapsed time and amount transferred (both from
* "transfer") are added to the buffer.
*/
static void pv__update_average_rate_history(pvtransfercalc_t calc, readonly_pvtransferstate_t transfer,
unsigned int history_interval, long double rate)
{
size_t first = calc->history_first;
size_t last = calc->history_last;
long double last_elapsed;
if (NULL == calc->history)
return;
last_elapsed = calc->history[last].elapsed_sec;
/*
* Do nothing if this is not the first call but not enough time has
* elapsed since the previous call yet.
*/
if ((last_elapsed > 0.0)
&& (transfer->elapsed_seconds < (last_elapsed + history_interval)))
return;
/*
* If this is not the first call, add a new entry to the ring
* buffer.
*/
if (last_elapsed > 0.0) {
size_t len = calc->history_len;
last = (last + 1) % len;
calc->history_last = last;
if (last == first) {
first = (first + 1) % len;
calc->history_first = first;
}
}
calc->history[last].elapsed_sec = transfer->elapsed_seconds;
calc->history[last].transferred = transfer->transferred;
if (first == last) {
calc->current_avg_rate = rate;
} else {
off_t bytes = (calc->history[last].transferred - calc->history[first].transferred);
long double sec = (calc->history[last].elapsed_sec - calc->history[first].elapsed_sec);
/* Safety check to avoid division by zero. */
if (sec < 0.000001 && sec > -0.000001)
sec = 0.000001;
calc->current_avg_rate = (long double) bytes / sec;
}
}
/*
* Update all calculated transfer state in calc (usually from state->calc).
*
* If "final" is true, this is the final update, so calc->transfer_rate and
* calc->average_rate are given as an average over the whole transfer;
* otherwise they are the current transfer rate and current average rate.
*
* The value of calc->percentage will reflect the percentage completion if
* control->size is greater than zero, otherwise it will increase by 2 each
* call and wrap at 200.
*/
void pv_calculate_transfer_rate(pvtransfercalc_t calc, readonly_pvtransferstate_t transfer,
readonly_pvcontrol_t control, readonly_pvdisplay_t display, bool final)
{
off_t bytes_since_last;
long double time_since_last, transfer_rate, average_rate;
/* Quick safety checks for null pointers. */
if (NULL == calc)
return;
if (NULL == transfer)
return;
if (NULL == control)
return;
if (NULL == display)
return;
bytes_since_last = 0;
if (transfer->transferred >= 0) {
bytes_since_last = transfer->transferred - calc->prev_transferred;
calc->prev_transferred = transfer->transferred;
}
/*
* When the time since the last update is very small, keep track of
* the amount transferred since the last update, and just keep
* adding to that until a reasonable amount of time has passed to
* avoid rate spikes or division by zero.
*/
time_since_last = transfer->elapsed_seconds - calc->prev_elapsed_sec;
if (time_since_last <= 0.01) {
transfer_rate = calc->prev_rate;
calc->prev_trans += bytes_since_last;
} else {
long double measured_rate;
transfer_rate = ((long double) bytes_since_last + calc->prev_trans) / time_since_last;
measured_rate = transfer_rate;
calc->prev_elapsed_sec = transfer->elapsed_seconds;
calc->prev_trans = 0;
if ((calc->measurements_taken < 1) || (measured_rate < calc->rate_min)) {
calc->rate_min = measured_rate;
}
if (measured_rate > calc->rate_max) {
calc->rate_max = measured_rate;
}
calc->rate_sum += measured_rate;
calc->ratesquared_sum += (measured_rate * measured_rate);
calc->measurements_taken++;
}
calc->prev_rate = transfer_rate;
/* Update the history and current average rate. */
pv__update_average_rate_history(calc, transfer, control->history_interval, transfer_rate);
average_rate = calc->current_avg_rate;
/*
* If this is the final update at the end of the transfer,
* recalculate the rate - and the average rate - across the whole
* period of the transfer.
*/
if (final) {
long double total_elapsed_seconds = (long double) (transfer->elapsed_seconds);
/* Safety check to avoid division by zero. */
if (total_elapsed_seconds < 0.000001)
total_elapsed_seconds = 0.000001;
average_rate =
(((long double) (transfer->transferred)) -
((long double) display->initial_offset)) / total_elapsed_seconds;
transfer_rate = average_rate;
}
calc->transfer_rate = transfer_rate;
calc->average_rate = average_rate;
if (control->size <= 0) {
/*
* If the total size of the incoming data is unknown, then
* for a percentage, gradually increase the percentage
* completion as data arrives, to a maximum of 200, then
* reset it. This means that the numeric percentage output
* will go 0%-100%, 100%-0%, 0%-100%, and so on.
*/
if (transfer_rate > 0)
calc->percentage += 2;
if (calc->percentage > 199)
calc->percentage = 0;
} else {
calc->percentage = pv_percentage(transfer->transferred, control->size);
}
/* Ensure the percentage is never negative or huge. */
if (calc->percentage < 0.0)
calc->percentage = 0.0;
if (calc->percentage > 100000.0)
calc->percentage = 100000.0;
}
+304 -222
View File
@@ -7,10 +7,10 @@
* first `pv' process.
*
* However, some OSes (FreeBSD and MacOS X so far) don't allow locking of a
* terminal, so we try to use a lockfile if terminal locking doesn't work,
* and finally abort if even that is unavailable.
* terminal - so if terminal locking doesn't work, a separate lock file is
* used, and cursor positioning is abandoned if that also fails.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -44,53 +44,45 @@
/*
* Write the given buffer to the given file descriptor, retrying until all
* bytes have been written or an error has occurred.
* Flag to allow reporting of "interrupted by signal" errors - cleared in
* secondary instances in a pipeline, so that only one will report them.
*/
void pv_write_retry(int fd, const char *buf, size_t count)
{
while (count > 0) {
ssize_t nwritten;
nwritten = write(fd, buf, count);
if (nwritten < 0) {
if ((EINTR == errno) || (EAGAIN == errno)) {
continue;
}
return;
}
if (nwritten < 1)
return;
count -= nwritten;
buf += nwritten;
}
}
static bool pv__allow_signal_interrupt_reporting = true;
/*
* Create a per-euid, per-tty, lockfile in ${TMPDIR:-${TMP:-/tmp}} for the
* Create a per-euid, per-tty, lock file in ${TMPDIR:-${TMP:-/tmp}} for the
* tty on the given file descriptor.
*/
static void pv_crs_open_lockfile(pvstate_t state, int fd)
static void pv_crs_open_lockfile(pvcursorstate_t cursor, readonly_pvcontrol_t control, int fd)
{
char *ttydev;
char *tmpdir;
int openflags;
state->cursor.lock_fd = -1;
cursor->lock_fd = -1;
ttydev = ttyname(fd);
if (!ttydev) {
if (!state->control.force) {
pv_error(state, "%s: %s", _("failed to get terminal name"), strerror(errno));
/*
* Note that a copy is made of result of ttyname(), so it's not in a
* static buffer, because basename() may modify it.
*/
ttydev = pv_strdup(ttyname(fd));
if (NULL == ttydev) {
if (!control->force) {
/*
* Error not translated as this should never be
* reached, since ttyname() will have been called
* earlier, and if it failed, cursor positioning
* would have been turned off.
*/
pv_perror("%s", "ttyname");
}
/*
* If we don't know our terminal name, we can neither do IPC
* nor make a lock file, so turn off cursor positioning.
* If the terminal name is unknown, then neither IPC nor a
* lock file are feasible, so turn off cursor positioning.
*/
state->control.cursor = 0;
cursor->disable = true;
debug("%s", "ttyname failed - cursor positioning disabled");
return;
}
@@ -106,9 +98,20 @@ static void pv_crs_open_lockfile(pvstate_t state, int fd)
* $TMP are rejected, and the destination buffer is bounded.
*/
memset(state->cursor.lock_file, 0, PV_SIZEOF_CRS_LOCK_FILE);
(void) pv_snprintf(state->cursor.lock_file,
PV_SIZEOF_CRS_LOCK_FILE, "%s/pv-%s-%i.lock", tmpdir, basename(ttydev), (int) geteuid());
if (NULL != cursor->lock_file) {
free(cursor->lock_file);
cursor->lock_file = NULL;
}
(void) pv_asprintf(&(cursor->lock_file), "%s/pv-%s-%i.lock", tmpdir, basename(ttydev), (int) geteuid());
if (NULL == cursor->lock_file) {
pv_perror("%s: %s", ttydev, _("failed to open lock file"));
free(ttydev);
cursor->disable = true;
return;
}
free(ttydev);
/*
* Pawel Piatek - not everyone has O_NOFOLLOW, e.g. AIX doesn't.
@@ -119,18 +122,18 @@ static void pv_crs_open_lockfile(pvstate_t state, int fd)
openflags = O_RDWR | O_CREAT;
#endif
state->cursor.lock_fd = open(state->cursor.lock_file, openflags, 0600); /* flawfinder: ignore */
cursor->lock_fd = open(cursor->lock_file, openflags, 0600); /* flawfinder: ignore */
/*
* flawfinder rationale: we aren't truncating the lock file, we
* don't change its contents, and we are attempting to use
* O_NOFOLLOW where possible to avoid symlink attacks, so this
* open() is as safe as we can make it.
* flawfinder rationale: the file isn't being truncated and its
* contents won't be changed, and O_NOFOLLOW will be used if
* available (to avoid symlink attacks), so this open() has been made
* as safe as possible.
*/
if (state->cursor.lock_fd < 0) {
pv_error(state, "%s: %s: %s", state->cursor.lock_file, _("failed to open lock file"), strerror(errno));
state->control.cursor = 0;
if (cursor->lock_fd < 0) {
pv_perror("%s: %s", cursor->lock_file, _("failed to open lock file"));
cursor->disable = true;
return;
}
}
@@ -138,16 +141,16 @@ static void pv_crs_open_lockfile(pvstate_t state, int fd)
/*
* Lock the terminal on the given file descriptor, falling back to using a
* lockfile if the terminal itself cannot be locked.
* lock file if the terminal itself cannot be locked.
*/
static void pv_crs_lock(pvstate_t state, int fd)
static void pv_crs_lock(pvcursorstate_t cursor, readonly_pvcontrol_t control, int fd)
{
struct flock lock;
int lock_fd;
lock_fd = fd;
if (state->cursor.lock_fd >= 0)
lock_fd = state->cursor.lock_fd;
if (cursor->lock_fd >= 0)
lock_fd = cursor->lock_fd;
memset(&lock, 0, sizeof(lock));
lock.l_type = (short) F_WRLCK;
@@ -156,20 +159,21 @@ static void pv_crs_lock(pvstate_t state, int fd)
lock.l_len = 1;
while (fcntl(lock_fd, F_SETLKW, &lock) < 0) {
if (errno != EINTR) {
if (state->cursor.lock_fd == -2) {
pv_crs_open_lockfile(state, fd);
if (state->cursor.lock_fd >= 0) {
lock_fd = state->cursor.lock_fd;
if (cursor->lock_fd == -2) {
pv_crs_open_lockfile(cursor, control, fd);
if (cursor->lock_fd >= 0) {
lock_fd = cursor->lock_fd;
}
} else {
pv_error(state, "%s: %s", _("lock attempt failed"), strerror(errno));
pv_perror("%s", NULL == cursor->lock_file ? "(tty)" : cursor->lock_file);
return;
}
}
}
if (state->cursor.lock_fd >= 0) {
debug("%s: %s", state->cursor.lock_file, "terminal lockfile acquired");
if (cursor->lock_fd >= 0) {
debug("%s: %s", NULL == cursor->lock_file ? "(null)" : cursor->lock_file,
"terminal lock file acquired");
} else {
debug("%s", "terminal lock acquired");
}
@@ -178,16 +182,16 @@ static void pv_crs_lock(pvstate_t state, int fd)
/*
* Unlock the terminal on the given file descriptor. If pv_crs_lock used
* lockfile locking, unlock the lockfile.
* lock file locking, unlock the lock file.
*/
static void pv_crs_unlock(pvstate_t state, int fd)
static void pv_crs_unlock(pvcursorstate_t cursor, int fd)
{
struct flock lock;
int lock_fd;
lock_fd = fd;
if (state->cursor.lock_fd >= 0)
lock_fd = state->cursor.lock_fd;
if (cursor->lock_fd >= 0)
lock_fd = cursor->lock_fd;
memset(&lock, 0, sizeof(lock));
lock.l_type = (short) F_UNLCK;
@@ -196,8 +200,9 @@ static void pv_crs_unlock(pvstate_t state, int fd)
lock.l_len = 1;
(void) fcntl(lock_fd, F_SETLK, &lock);
if (state->cursor.lock_fd >= 0) {
debug("%s: %s", state->cursor.lock_file, "terminal lockfile released");
if (cursor->lock_fd >= 0) {
debug("%s: %s", NULL == cursor->lock_file ? "(null)" : cursor->lock_file,
"terminal lock file released");
} else {
debug("%s", "terminal lock released");
}
@@ -208,23 +213,23 @@ static void pv_crs_unlock(pvstate_t state, int fd)
/*
* Get the current number of processes attached to our shared memory
* segment, i.e. find out how many `pv' processes in total are running in
* cursor mode (including us), and store it in pv_crs_pvcount. If this is
* larger than pv_crs_pvmax, update pv_crs_pvmax.
* cursor mode (including this process), and store it in pv_crs_pvcount. If
* this is larger than pv_crs_pvmax, update pv_crs_pvmax.
*/
static void pv_crs_ipccount(pvstate_t state)
static void pv_crs_ipccount(pvcursorstate_t cursor)
{
struct shmid_ds buf;
memset(&buf, 0, sizeof(buf));
buf.shm_nattch = 0;
(void) shmctl(state->cursor.shmid, IPC_STAT, &buf);
state->cursor.pvcount = (int) (buf.shm_nattch);
(void) shmctl(cursor->shmid, IPC_STAT, &buf);
cursor->pvcount = (int) (buf.shm_nattch);
if (state->cursor.pvcount > state->cursor.pvmax)
state->cursor.pvmax = state->cursor.pvcount;
if (cursor->pvcount > cursor->pvmax)
cursor->pvmax = cursor->pvcount;
debug("%s: %d", "pvcount", state->cursor.pvcount);
debug("%s: %d", "pvcount", cursor->pvcount);
}
#endif /* HAVE_IPC */
@@ -265,7 +270,7 @@ static int pv_crs_get_ypos(int terminalfd)
memset(cpr, 0, sizeof(cpr));
#ifdef CURSOR_ANSWERBACK_BYTE_BY_BYTE
/* Read answerback byte by byte - fails on AIX */
/* Read answerback byte by byte - fails on AIX. */
for (got = 0, r = 0; got < (int) (sizeof(cpr) - 2); got += r) {
r = read(terminalfd, cpr + got, 1); /* flawfinder: ignore */
/* flawfinder rationale: bounded to buffer size by "for" */
@@ -282,9 +287,9 @@ static int pv_crs_get_ypos(int terminalfd)
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 */
/* Read answerback in one big lump - may fail on Solaris. */
r = read(terminalfd, cpr, sizeof(cpr) - 2); /* flawfinder: ignore */
/* flawfinder rationale: bounded to buffer size */
/* flawfinder rationale: bounded to buffer size. */
if (r <= 0) {
debug("r=%d: %s", r, strerror(errno));
} else {
@@ -311,23 +316,24 @@ static int pv_crs_get_ypos(int terminalfd)
/*
* Initialise the IPC data, returning nonzero on error.
*
* To do this, we attach to the shared memory segment (creating it if it
* does not exist). If we are the only process attached to it, then we
* initialise it with the current cursor position.
* Attaches to the shared memory segment (creating it if it does not exist).
* If this is the only process attached to it, then the memory is
* initialised with the current cursor position.
*
* There is a race condition here: another process could attach before we've
* had a chance to check, such that no process ends up getting an "attach
* count" of one, and so no initialisation occurs. So, we lock the terminal
* with pv_crs_lock() while we are attaching and checking.
* To avoid a race condition, this function locks the terminal with
* pv_crs_lock() while attaching and checking. The race condition is that
* another process could attach before this one checks, such that no process
* ends up getting an "attach count" of one, and so no initialisation
* occurs.
*/
static int pv_crs_ipcinit(pvstate_t state, char *ttyfile, int terminalfd)
static int pv_crs_ipcinit(pvcursorstate_t cursor, readonly_pvcontrol_t control, char *ttyfile, int terminalfd)
{
key_t key;
/*
* Base the key for the shared memory segment on our current tty, so
* we don't end up interfering in any way with instances of `pv'
* running on another terminal.
* Base the key for the shared memory segment on the current tty, to
* avoid interfering in any way with instances of `pv' running on
* another terminal.
*/
key = ftok(ttyfile, (int) 'p');
if (-1 == key) {
@@ -335,55 +341,63 @@ static int pv_crs_ipcinit(pvstate_t state, char *ttyfile, int terminalfd)
return 1;
}
pv_crs_lock(state, terminalfd);
if (!state->control.cursor) {
pv_crs_lock(cursor, control, terminalfd);
if ((!control->cursor) || (cursor->disable)) {
debug("%s", "early return - cursor has been disabled");
return 1;
}
state->cursor.shmid = shmget(key, sizeof(struct pvcursorstate_s), 0600 | IPC_CREAT);
if (state->cursor.shmid < 0) {
cursor->shmid = shmget(key, sizeof(struct pvipccursorstate_s), 0600 | IPC_CREAT);
if (cursor->shmid < 0) {
debug("%s: %s", "shmget failed", strerror(errno));
pv_crs_unlock(state, terminalfd);
pv_crs_unlock(cursor, terminalfd);
return 1;
}
/*@-nullpass@ */
/* splint doesn't know shmaddr can be NULL */
state->cursor.shared = shmat(state->cursor.shmid, NULL, 0);
/* splint doesn't know shmaddr can be NULL. */
cursor->shared = shmat(cursor->shmid, NULL, 0);
/*@+nullpass@ */
pv_crs_ipccount(state);
pv_crs_ipccount(cursor);
/*
* If nobody else is attached to the shared memory segment, we're
* the first, so we need to initialise the shared memory with our
* If no other process is attached to the shared memory segment,
* this one is the first, so initialise the shared memory with the
* current Y cursor co-ordinate and with an initial false value for
* the TOSTOP-added flag.
*/
if (state->cursor.pvcount < 2) {
state->cursor.y_start = pv_crs_get_ypos(terminalfd);
state->cursor.shared->y_topmost = state->cursor.y_start;
state->cursor.shared->tty_tostop_added = false;
state->cursor.y_lastread = state->cursor.y_start;
if (cursor->pvcount < 2) {
cursor->y_start = pv_crs_get_ypos(terminalfd);
cursor->shared->y_topmost = cursor->y_start;
cursor->shared->tty_tostop_added = false;
cursor->y_lastread = cursor->y_start;
debug("%s", "we are the first to attach");
} else {
/*
* Another process was first, so prevent the current
* instance from reporting "interrupted by signal" errors
* since the first one will do that.
*/
debug("%s", "not the first to attach - clearing pv__allow_signal_interrupt_reporting");
pv__allow_signal_interrupt_reporting = false;
}
state->cursor.y_offset = state->cursor.pvcount - 1;
if (state->cursor.y_offset < 0)
state->cursor.y_offset = 0;
cursor->y_offset = cursor->pvcount - 1;
if (cursor->y_offset < 0)
cursor->y_offset = 0;
/*
* If anyone else had attached to the shared memory segment, we need
* to read the top Y co-ordinate from it.
* If any other process had attached to the shared memory segment
* already, read the top Y co-ordinate from it.
*/
if (state->cursor.pvcount > 1) {
state->cursor.y_start = state->cursor.shared->y_topmost;
state->cursor.y_lastread = state->cursor.y_start;
debug("%s: %d", "not the first to attach - got top y", state->cursor.y_start);
if (cursor->pvcount > 1) {
cursor->y_start = cursor->shared->y_topmost;
cursor->y_lastread = cursor->y_start;
debug("%s: %d", "not the first to attach - got top y", cursor->y_start);
}
pv_crs_unlock(state, terminalfd);
pv_crs_unlock(cursor, terminalfd);
return 0;
}
@@ -393,15 +407,18 @@ static int pv_crs_ipcinit(pvstate_t state, char *ttyfile, int terminalfd)
/*
* Initialise the terminal for cursor positioning.
*/
void pv_crs_init(pvstate_t state)
void pv_crs_init(pvcursorstate_t cursor, readonly_pvcontrol_t control, pvtransientflags_t flags)
{
char *ttyfile;
int terminalfd;
state->cursor.lock_fd = -2;
state->cursor.lock_file[0] = '\0';
cursor->lock_fd = -2;
if (NULL != cursor->lock_file) {
free(cursor->lock_file);
cursor->lock_file = NULL;
}
if (!state->control.cursor)
if ((!control->cursor) || (cursor->disable))
return;
debug("%s", "init");
@@ -409,64 +426,76 @@ void pv_crs_init(pvstate_t state)
ttyfile = ttyname(STDERR_FILENO);
if (NULL == ttyfile) {
debug("%s: %s", "disabling cursor positioning because ttyname failed", strerror(errno));
state->control.cursor = false;
cursor->disable = true;
return;
}
terminalfd = open(ttyfile, O_RDWR); /* flawfinder: ignore */
/*
* flawfinder rationale: the file we open won't be truncated but
* could be corrupted by writes attempting to get the current Y
* position; but we get the filename from ttyname() and it could be
* a symbolic link, so we can't do much more than trust it.
* flawfinder rationale: the file won't be truncated but could be
* corrupted by writes attempting to get the current Y position; but
* the filename is from ttyname() and it could be a symbolic link,
* so O_NOFOLLOW isn't feasible and it has to be trusted as-is.
*/
if (terminalfd < 0) {
pv_error(state, "%s: %s: %s", _("failed to open terminal"), ttyfile, strerror(errno));
state->control.cursor = false;
pv_perror("%s", ttyfile);
cursor->disable = true;
return;
}
#ifdef HAVE_IPC
if (pv_crs_ipcinit(state, ttyfile, terminalfd) != 0) {
if (pv_crs_ipcinit(cursor, control, ttyfile, terminalfd) != 0) {
debug("%s", "ipcinit failed, setting noipc flag");
state->cursor.noipc = true;
cursor->noipc = true;
}
/*
* If we have already set the terminal TOSTOP attribute, set the
* flag in shared memory to let the other instances know.
* If the terminal TOSTOP attribute was already set by this process,
* set the flag in shared memory to let the other instances know.
*/
if ((!state->cursor.noipc) && state->signal.pv_tty_tostop_added && (NULL != state->cursor.shared)) {
debug("%s", "propagating local pv_tty_tostop_added true value to shared flag");
state->cursor.shared->tty_tostop_added = true;
if ((!cursor->noipc) && (1 == flags->clear_tty_tostop_on_exit) && (NULL != cursor->shared)) {
debug("%s", "propagating local clear_tty_tostop_on_exit true value to shared tty_tostop_added flag");
cursor->shared->tty_tostop_added = true;
}
#ifdef ECHOCTL
/*
* If we are not using IPC, then we need to get the current Y
* co-ordinate. If we are using IPC, then the pv_crs_ipcinit()
* function takes care of this in a more multi-process-friendly way.
* If the terminal ECHOCTL attribute was already cleared by this
* process, set the flag in shared memory to let the other instances
* know.
*/
if (state->cursor.noipc) {
if ((!cursor->noipc) && (1 == flags->set_tty_echoctl_on_exit) && (NULL != cursor->shared)) {
debug("%s", "propagating local set_tty_echoctl_on_exit true value to shared tty_echoctl_cleared flag");
cursor->shared->tty_echoctl_cleared = true;
}
#endif
/*
* If IPC is not being used, the current Y needs to be determined.
* If IPC is being used, then the pv_crs_ipcinit() function takes
* care of this in a more multi-process-friendly way.
*/
if (cursor->noipc) {
#else /* ! HAVE_IPC */
if (1) {
#endif /* HAVE_IPC */
/*
* Get current cursor position + 1.
*/
pv_crs_lock(state, terminalfd);
state->cursor.y_start = pv_crs_get_ypos(terminalfd);
pv_crs_lock(cursor, control, terminalfd);
cursor->y_start = pv_crs_get_ypos(terminalfd);
/*
* Move down a line while the terminal is locked, so that
* other processes in the pipeline will get a different
* initial ypos.
*/
if (state->cursor.y_start > 0)
pv_write_retry(STDERR_FILENO, "\n", 1);
pv_crs_unlock(state, terminalfd);
if (cursor->y_start > 0)
pv_tty_write(flags, "\n", 1);
pv_crs_unlock(cursor, terminalfd);
if (state->cursor.y_start < 1)
state->control.cursor = 0;
if (cursor->y_start < 1)
cursor->disable = true;
}
(void) close(terminalfd);
@@ -475,47 +504,52 @@ void pv_crs_init(pvstate_t state)
#ifdef HAVE_IPC
/*
* Set the "we need to reinitialise cursor positioning" flag.
* Set the "need to reinitialise cursor positioning" flag.
*/
void pv_crs_needreinit(pvstate_t state)
void pv_crs_needreinit(pvcursorstate_t cursor)
{
state->cursor.needreinit += 2;
if (state->cursor.needreinit > 3)
state->cursor.needreinit = 3;
cursor->needreinit += 2;
if (cursor->needreinit > 3)
cursor->needreinit = 3;
}
#endif
#ifdef HAVE_IPC
/*
* Reinitialise the cursor positioning code (called if we are backgrounded
* then foregrounded again).
* Reinitialise the cursor positioning code (called if the process is
* backgrounded then foregrounded again).
*/
static void pv_crs_reinit(pvstate_t state)
static void pv_crs_reinit(pvcursorstate_t cursor, readonly_pvcontrol_t control, pvtransientflags_t flags)
{
debug("%s", "reinit");
pv_crs_lock(state, STDERR_FILENO);
if (1 == flags->suspend_stderr) {
debug("%s", "reinit abandoned - stderr is suspended");
return;
}
state->cursor.needreinit--;
if (state->cursor.y_offset < 1)
state->cursor.needreinit = 0;
pv_crs_lock(cursor, control, STDERR_FILENO);
if (state->cursor.needreinit > 0) {
pv_crs_unlock(state, STDERR_FILENO);
cursor->needreinit--;
if (cursor->y_offset < 1)
cursor->needreinit = 0;
if (cursor->needreinit > 0) {
pv_crs_unlock(cursor, STDERR_FILENO);
return;
}
debug("%s", "reinit full");
state->cursor.y_start = pv_crs_get_ypos(STDERR_FILENO);
cursor->y_start = pv_crs_get_ypos(STDERR_FILENO);
if ((state->cursor.y_offset < 1) && (NULL != state->cursor.shared)) {
state->cursor.shared->y_topmost = state->cursor.y_start;
if ((cursor->y_offset < 1) && (NULL != cursor->shared)) {
cursor->shared->y_topmost = cursor->y_start;
}
state->cursor.y_lastread = state->cursor.y_start;
cursor->y_lastread = cursor->y_start;
pv_crs_unlock(state, STDERR_FILENO);
pv_crs_unlock(cursor, STDERR_FILENO);
}
#endif
@@ -524,16 +558,21 @@ static void pv_crs_reinit(pvstate_t state)
* Output a single-line update (\0-terminated), using the ECMA-48 CSI "CUP"
* sequence to move the cursor to the correct position to do so.
*/
void pv_crs_update(pvstate_t state, const char *output_line)
void pv_crs_update(pvcursorstate_t cursor, readonly_pvcontrol_t control, pvtransientflags_t flags,
const char *output_line)
{
char cup_cmd[32]; /* flawfinder: ignore */
size_t cup_cmd_length, output_line_length;
int y;
/* Early return if cursor positioning was disabled. */
if (cursor->disable)
return;
/*
* flawfinder rationale: the "cup_cmd" buffer is always zeroed
* before each use, and is only written to by pv_snprintf() bounded
* by its size; also, that function explictly zero-terminates the
* by its size; also, that function explicitly zero-terminates the
* string it writes. The write() call is also bounded.
*/
@@ -541,72 +580,72 @@ void pv_crs_update(pvstate_t state, const char *output_line)
/* flawfinder - output_line is explictly expected to be \0-terminated. */
#ifdef HAVE_IPC
if (!state->cursor.noipc) {
if (state->cursor.needreinit > 0)
pv_crs_reinit(state);
if (!cursor->noipc) {
if (cursor->needreinit > 0)
pv_crs_reinit(cursor, control, flags);
pv_crs_ipccount(state);
if (NULL != state->cursor.shared) {
if (state->cursor.y_lastread != state->cursor.shared->y_topmost) {
state->cursor.y_start = state->cursor.shared->y_topmost;
state->cursor.y_lastread = state->cursor.y_start;
pv_crs_ipccount(cursor);
if (NULL != cursor->shared) {
if (cursor->y_lastread != cursor->shared->y_topmost) {
cursor->y_start = cursor->shared->y_topmost;
cursor->y_lastread = cursor->y_start;
}
}
if (state->cursor.needreinit > 0)
if (cursor->needreinit > 0)
return;
}
#endif /* HAVE_IPC */
y = state->cursor.y_start;
y = cursor->y_start;
#ifdef HAVE_IPC
/*
* If the screen has scrolled, or is about to scroll, due to
* multiple `pv' instances taking us near the bottom of the screen,
* scroll the screen (only if we're the first `pv'), and then move
* our initial Y co-ordinate up.
* scroll the screen (only if this is the first `pv'), and then move
* the initial Y co-ordinate up.
*/
if (((state->cursor.y_start + state->cursor.pvmax) > (int) (state->control.height))
&& (!state->cursor.noipc)
if (((cursor->y_start + cursor->pvmax) > (int) (control->height))
&& (!cursor->noipc)
) {
int offs;
offs = ((state->cursor.y_start + state->cursor.pvmax) - state->control.height);
offs = ((cursor->y_start + cursor->pvmax) - control->height);
state->cursor.y_start -= offs;
if (state->cursor.y_start < 1)
state->cursor.y_start = 1;
cursor->y_start -= offs;
if (cursor->y_start < 1)
cursor->y_start = 1;
debug("%s: %d", "scroll offset", offs);
/*
* Scroll the screen if we're the first `pv'.
* Scroll the screen if this is the first `pv'.
*/
if (0 == state->cursor.y_offset) {
pv_crs_lock(state, STDERR_FILENO);
if (0 == cursor->y_offset) {
pv_crs_lock(cursor, control, STDERR_FILENO);
memset(cup_cmd, 0, sizeof(cup_cmd));
(void) pv_snprintf(cup_cmd, sizeof(cup_cmd), "\033[%u;1H", state->control.height);
(void) pv_snprintf(cup_cmd, sizeof(cup_cmd), "\033[%u;1H", control->height);
cup_cmd_length = strlen(cup_cmd); /* flawfinder: ignore */
pv_write_retry(STDERR_FILENO, cup_cmd, cup_cmd_length);
pv_tty_write(flags, cup_cmd, cup_cmd_length);
for (; offs > 0; offs--) {
pv_write_retry(STDERR_FILENO, "\n", 1);
pv_tty_write(flags, "\n", 1);
}
pv_crs_unlock(state, STDERR_FILENO);
pv_crs_unlock(cursor, STDERR_FILENO);
debug("%s", "we are the first - scrolled screen");
}
}
if (!state->cursor.noipc)
y = state->cursor.y_start + state->cursor.y_offset;
if (!cursor->noipc)
y = cursor->y_start + cursor->y_offset;
#endif /* HAVE_IPC */
/*
* Keep the Y co-ordinate within sensible bounds, so we can never
* overflow the "cup_cmd" buffer.
* Clamp the Y co-ordinate to sensible bounds, to avoid overflowing
* the "cup_cmd" buffer.
*/
if ((y < 1) || (y > 999999))
y = 1;
@@ -622,39 +661,39 @@ void pv_crs_update(pvstate_t state, const char *output_line)
* pv_snprintf() fails to run the string will be of zero length.
*/
pv_crs_lock(state, STDERR_FILENO);
pv_crs_lock(cursor, control, STDERR_FILENO);
pv_write_retry(STDERR_FILENO, cup_cmd, cup_cmd_length);
pv_write_retry(STDERR_FILENO, output_line, output_line_length);
pv_tty_write(flags, cup_cmd, cup_cmd_length);
pv_tty_write(flags, output_line, output_line_length);
pv_crs_unlock(state, STDERR_FILENO);
pv_crs_unlock(cursor, STDERR_FILENO);
}
/*
* Reposition the cursor to a final position.
*/
void pv_crs_fini(pvstate_t state)
void pv_crs_fini(pvcursorstate_t cursor, readonly_pvcontrol_t control, pvtransientflags_t flags)
{
char cup_cmd[32]; /* flawfinder: ignore */
unsigned int y;
/* flawfinder - "cup_cmd" is zeroed, and only written by pv_snprintf() */
/* flawfinder - "cup_cmd" is zeroed, and only written by pv_snprintf(). */
debug("%s", "fini");
y = (unsigned int) (state->cursor.y_start);
y = (unsigned int) (cursor->y_start);
#ifdef HAVE_IPC
if ((state->cursor.pvmax > 0) && (!state->cursor.noipc))
y += state->cursor.pvmax - 1;
if ((cursor->pvmax > 0) && (!cursor->noipc))
y += cursor->pvmax - 1;
#endif /* HAVE_IPC */
if (y > state->control.height)
y = state->control.height;
if (y > control->height)
y = control->height;
/*
* Absolute bounds check.
* Clamp to reasonable values.
*/
if ((y < 1) || (y > 999999))
y = 1;
@@ -662,52 +701,95 @@ void pv_crs_fini(pvstate_t state)
memset(cup_cmd, 0, sizeof(cup_cmd));
(void) pv_snprintf(cup_cmd, sizeof(cup_cmd), "\033[%u;1H\n", y);
pv_crs_lock(state, STDERR_FILENO);
pv_crs_lock(cursor, control, STDERR_FILENO);
pv_write_retry(STDERR_FILENO, cup_cmd, strlen(cup_cmd)); /* flawfinder: ignore */
if (!cursor->disable) {
pv_tty_write(flags, cup_cmd, strlen(cup_cmd)); /* flawfinder: ignore */
}
/* flawfinder - pv_snprintf() always \0-terminates (see above). */
#ifdef HAVE_IPC
/*
* If any other "pv -c" instances have set the terminal TOSTOP
* attribute, set our local flag so pv_sig_fini() will know about
* attribute, set the local flag so pv_sig_fini() will know about
* it.
*/
if ((!state->cursor.noipc) && (NULL != state->cursor.shared) && state->cursor.shared->tty_tostop_added) {
if (!state->signal.pv_tty_tostop_added) {
debug("%s", "propagating shared tty_tostop_added true value to local flag");
state->signal.pv_tty_tostop_added = true;
if ((!cursor->noipc) && (NULL != cursor->shared) && cursor->shared->tty_tostop_added) {
if (0 == flags->clear_tty_tostop_on_exit) {
debug("%s",
"propagating shared tty_tostop_added true value to local clear_tty_tostop_on_exit flag");
flags->clear_tty_tostop_on_exit = 1;
}
}
pv_crs_ipccount(state);
if (NULL != state->cursor.shared) {
(void) shmdt(state->cursor.shared);
#ifdef ECHOCTL
/*
* If any other "pv -c" instances have cleared the terminal ECHOCTL
* attribute, set the local flag so pv_sig_fini() will know about
* it.
*/
if ((!cursor->noipc) && (NULL != cursor->shared) && cursor->shared->tty_echoctl_cleared) {
if (0 == flags->set_tty_echoctl_on_exit) {
debug("%s",
"propagating shared tty_echoctl_cleared true value to local set_tty_echoctl_on_exit flag");
flags->set_tty_echoctl_on_exit = 1;
}
}
state->cursor.shared = NULL;
#endif /* ECHOCTL */
pv_crs_ipccount(cursor);
if (NULL != cursor->shared) {
(void) shmdt(cursor->shared);
}
cursor->shared = NULL;
/*
* If we are the last instance detaching from the shared memory,
* If this is the last instance detaching from the shared memory,
* delete it so it's not left lying around.
*/
if (state->cursor.pvcount < 2) {
if (cursor->pvcount < 2) {
struct shmid_ds shm_buf;
memset(&shm_buf, 0, sizeof(shm_buf));
(void) shmctl(state->cursor.shmid, IPC_RMID, &shm_buf);
(void) shmctl(cursor->shmid, IPC_RMID, &shm_buf);
}
#endif /* HAVE_IPC */
pv_crs_unlock(state, STDERR_FILENO);
pv_crs_unlock(cursor, STDERR_FILENO);
if (state->cursor.lock_fd >= 0) {
(void) close(state->cursor.lock_fd);
if (cursor->lock_fd >= 0) {
(void) close(cursor->lock_fd);
/*
* We can get away with removing this on exit because all
* the other PVs will be finishing at the same sort of time.
* Since all PVs in a pipeline are likely to finish around
* the same time, the lock file can be removed without
* further co-ordination.
*/
(void) remove(state->cursor.lock_file);
if (NULL != cursor->lock_file) {
(void) remove(cursor->lock_file);
free(cursor->lock_file);
cursor->lock_file = NULL;
}
}
}
/* EOF */
/*
* Report a signal interrupt, unless the flag allowing it has been cleared
* due to another instance already taking responsibility.
*/
void pv_report_signal_interrupt(int signum)
{
if (pv__allow_signal_interrupt_reporting) {
char *signal_name = NULL;
#ifdef HAVE_STRSIGNAL
/*@-unrecog @ *//* splint doesn't know strsignal(). */
signal_name = strsignal(signum);
/*@+unrecog @ */
#endif
if (NULL != signal_name) {
pv_error("%s: %s", _("interrupted by a signal"), signal_name);
} else {
pv_error("%s", _("interrupted by a signal"));
}
}
}
+922 -846
View File
File diff suppressed because it is too large Load Diff
+21 -26
View File
@@ -1,7 +1,7 @@
/*
* Functions relating to elapsed time.
*
* Copyright 2023-2024 Andrew Wood
* Copyright 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -16,20 +16,20 @@
/*
* Read the current elapsed time, relative to an unspecified point in the
* past, and store it in the given timespec buffer. The time is guaranteed
* to not go backwards and does not count time when the system was
* suspended. See clock_gettime(2) with CLOCK_MONOTONIC.
* past, and store it in "return_time". The time is guaranteed to not go
* backwards and does not count time when the system was suspended. See
* clock_gettime(2) with CLOCK_MONOTONIC.
*
* The read should not fail; if it does, the program is aborted with exit
* status 16.
* status 16 (transfer error).
*/
void pv_elapsedtime_read(struct timespec *return_time)
{
/*@-unrecog@ *//* splint doesn't know clock_gettime */
/*@-unrecog@ *//* splint doesn't know clock_gettime. */
if (0 != clock_gettime(CLOCK_MONOTONIC, return_time)) {
fprintf(stderr, "%s: %s: %s\n", PACKAGE_NAME, "clock_gettime", strerror(errno));
/*@-exitarg@ *//* we explicitly want a special exit status */
exit(16);
pv_perror("%s", "clock_gettime");
/*@-exitarg@ *//* The special exit status is explicitly chosen. */
exit(PV_ERROREXIT_TRANSFER);
/*@+exitarg@ */
}
/*@+unrecog@ */
@@ -37,7 +37,7 @@ void pv_elapsedtime_read(struct timespec *return_time)
/*
* Set the time in the given timespec to zero.
* Set the time in the timespec to zero.
*/
void pv_elapsedtime_zero(struct timespec *zero_time)
{
@@ -132,19 +132,16 @@ void pv_elapsedtime_add(struct timespec *return_time, const struct timespec *fir
/*@+type@ */
/*
* splint rationale: we know the types are different but should be
* large enough and are relying on the compiler to do the casting
* correctly, since the manual for timespec(3) states the types are
* implementation-defined.
*
* TODO: review this to make sure that this isn't just an elaborate
* excuse for "it's hard to fix and I don't know how".
* splint rationale: the manual for timespec(3) states that its
* types are implementation-defined, so the best option is to use
* types that are the most likely to be large enough, and let the
* compiler do the casting.
*/
}
/*
* Add a number of nanoseconds to the given timespec.
* Add a number of nanoseconds to a timespec.
*/
void pv_elapsedtime_add_nsec(struct timespec *return_time, long long add_nanoseconds)
{
@@ -159,7 +156,7 @@ void pv_elapsedtime_add_nsec(struct timespec *return_time, long long add_nanosec
seconds += nanoseconds / 1000000000;
nanoseconds = nanoseconds % 1000000000;
/*@-type@ *//* see above */
/*@-type@ *//* See above. */
return_time->tv_sec = seconds;
return_time->tv_nsec = nanoseconds;
/*@+type@ */
@@ -198,7 +195,7 @@ void pv_elapsedtime_subtract(struct timespec *return_time, const struct timespec
nanoseconds = 1000000000 + nanoseconds;
}
/*@-type@ *//* see above */
/*@-type@ *//* See above. */
return_time->tv_sec = seconds;
return_time->tv_nsec = nanoseconds;
/*@+type@ */
@@ -236,20 +233,18 @@ void pv_nanosleep(long long nanoseconds)
sleep_for.tv_sec = 0;
/*@-type@ */
sleep_for.tv_nsec = nanoseconds;
/*@+type@ *//* splint rationale - best effort */
/*@+type@ *//* splint rationale - best effort. */
/*@-unrecog@ */
(void) nanosleep(&sleep_for, &time_remaining);
/*@+unrecog@ *//* splint rationale - doesn't know of nanosleep() */
/*@+unrecog@ *//* splint doesn't know of nanosleep(). */
#else
struct timeval tv;
tv.tv_sec = 0;
/*@-type@ */
tv.tv_usec = nanoseconds / 1000;
/*@+type@ *//* splint rationale - best effort */
/*@+type@ *//* splint rationale - best effort. */
/*@-null@ */
(void) select(0, NULL, NULL, NULL, &tv);
/*@+null@ *//* splint doesn't know about select() */
/*@+null@ *//* splint doesn't know about select(). */
#endif
}
/* EOF */
+355 -89
View File
@@ -1,7 +1,7 @@
/*
* Functions for opening and closing files, and calculating their size.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -18,18 +18,80 @@
#include <unistd.h>
#include <fcntl.h>
#include <limits.h>
#include <sys/utsname.h>
/*@-type@*/
/* splint has trouble with off_t and mode_t throughout this file. */
/*
* Check that a file descriptor is open on /dev/null, returning true if so.
* Otherwise return false; if the second argument is true, reports the
* problem with pv_error() before returning.
*
* No error is reported if the file descriptor is less than zero.
*/
bool pv_fd_is_dev_null(int fd, bool report_error)
{
struct stat sb;
struct utsname uts;
unsigned long expected_rdev;
bool is_dev_null;
if (fd < 0)
return false;
memset(&sb, 0, sizeof(sb));
if (fstat(fd, &sb) < 0) {
if (report_error)
pv_perror("%s", "/dev/null");
return false;
}
expected_rdev = 0x0103; /* device 1,3 on Linux. */
is_dev_null = true;
if (!S_ISCHR(sb.st_mode)) {
debug("%s", "/dev/null: not a character device");
is_dev_null = false;
}
memset(&uts, 0, sizeof(uts));
if (uname(&uts) >= 0) {
if (0 == strncmp(uts.sysname, "OpenBSD", 7)) {
expected_rdev = 0x0202;
} else if (0 == strncmp(uts.sysname, "FreeBSD", 7)) {
expected_rdev = 0x0022;
} else if (0 == strncmp(uts.sysname, "NetBSD", 6)) {
expected_rdev = 0x0202;
} else if (0 == strncmp(uts.sysname, "Darwin", 6)) {
expected_rdev = 0x03000002;
}
}
if ((unsigned long) (sb.st_rdev) != expected_rdev) {
debug("/dev/null: fd is %08lx, expected %08lx", sb.st_rdev, expected_rdev);
is_dev_null = false;
}
if (is_dev_null)
return true;
if (report_error)
pv_error("%s", _("/dev/null is not usable"));
return false;
}
/*
* Calculate the total number of bytes to be transferred by adding up the
* sizes of all input files. If any of the input files are of indeterminate
* size (such as if they are a pipe), the total size is set to zero.
*
* Any files that cannot be stat()ed or that access() says we can't read
* will be skipped, and the total size will be set to zero.
* If there are any files that cannot be stat()ed, or that access() says are
* not readable, they will be skipped, and the total size will be set to
* zero.
*
* Returns the total size, or 0 if it is unknown.
*/
@@ -54,6 +116,10 @@ static off_t pv_calc_total_bytes(pvstate_t state)
for (file_idx = 0; file_idx < state->files.file_count; file_idx++) {
int rc;
/* Skip any NULL entries, though they should be impossible. */
if (NULL == state->files.filename[file_idx])
continue;
if (0 == strcmp(state->files.filename[file_idx], "-")) {
rc = fstat(STDIN_FILENO, &sb);
if (rc != 0) {
@@ -65,15 +131,16 @@ static off_t pv_calc_total_bytes(pvstate_t state)
if (0 == rc) {
rc = access(state->files.filename[file_idx], R_OK); /* flawfinder: ignore */
/*
* flawfinder rationale: we're not really
* using access() to do permissions checks,
* but to zero the total if we might be
* unable to read the file later, so if an
* attacker redirected one of the input
* files in between this part and the actual
* reading, the outcome would be that the
* total byte count would be wrong or
* missing, nothing useful.
* flawfinder rationale: access() can lead
* to TOCTOU issues but here it isn't being
* used to check permissions, only to zero
* the total if the file is likely to be
* unreadable later. If an attacker
* redirected one of the input files in
* between this part and the actual reading,
* the outcome would be that the total byte
* count would be wrong or missing, nothing
* otherwise exploitable.
*/
}
}
@@ -95,10 +162,10 @@ static off_t pv_calc_total_bytes(pvstate_t state)
fd = open("/dev/stdin", O_RDONLY); /* flawfinder: ignore */
/*
* flawfinder rationale: "/dev/stdin" may be
* a symlink, so can't use O_NOFOLLOW, and
* so we have to assume that it being under
* "/dev" means the path is less likely to
* be under the control of someone else.
* a symlink, so O_NOFOLLOW is not suitable;
* in mitigation, a path under "/dev" is
* unlikely to be under the control of
* someone else.
*/
} else {
fd = open(state->files.filename[file_idx], O_RDONLY); /* flawfinder: ignore */
@@ -123,36 +190,36 @@ static off_t pv_calc_total_bytes(pvstate_t state)
}
/*
* Patch from Peter Samuelson: if we cannot work out the size of the
* input, but we are writing to a block device, then use the size of
* the output block device.
* Patch from Peter Samuelson: if the input size can't be
* determined, but the output is being written to a block device,
* then use the size of the output block device.
*
* Further modified to check that stdout is not in append-only mode
* and that we can seek back to the start after getting the size.
* Further modified to check that output is not in append-only mode,
* such that it is possible to seek back to the start after getting
* the size.
*/
if (total < 1) {
int rc;
rc = fstat(STDOUT_FILENO, &sb);
rc = fstat(state->control.output_fd, &sb);
if ((0 == rc) && S_ISBLK(sb.st_mode)
&& (0 == (fcntl(STDOUT_FILENO, F_GETFL) & O_APPEND))) {
&& (0 == (fcntl(state->control.output_fd, F_GETFL) & O_APPEND))) {
off_t end_position;
end_position = lseek(STDOUT_FILENO, 0, SEEK_END);
end_position = lseek(state->control.output_fd, 0, SEEK_END);
total = 0;
if (end_position > 0) {
total = end_position;
}
if (lseek(STDOUT_FILENO, 0, SEEK_SET) != 0) {
pv_error(state, "%s: %s: %s", "(stdout)",
_("failed to seek to start of output"), strerror(errno));
state->status.exit_status |= 2;
if (lseek(state->control.output_fd, 0, SEEK_SET) != 0) {
pv_perror("%s",
NULL == state->control.output_name ? "(null)" : state->control.output_name);
state->status.exit_status |= PV_ERROREXIT_ACCESS;
}
/*
* If we worked out a size, then set the
* stop-at-size flag to prevent a "no space left on
* device" error when we reach the end of the output
* device.
* If a size was found, then set the stop-at-size
* flag to prevent a "no space left on device" error
* when the end of the output device is reached.
*/
if (total > 0) {
state->control.stop_at_size = true;
@@ -169,8 +236,9 @@ static off_t pv_calc_total_bytes(pvstate_t state)
* input files. If any of the inputs are not regular files (such as if they
* are a pipe or a block device), the total size is set to zero.
*
* Any files that cannot be stat()ed or that access() says we can't read
* will be skipped, and the total size will be set to zero.
* If there are any files that cannot be stat()ed, or that access() says are
* not readable, they will be skipped, and the total size will be set to
* zero.
*
* Returns the total size, or 0 if it is unknown.
*/
@@ -186,6 +254,10 @@ static off_t pv_calc_total_lines(pvstate_t state)
int fd = -1;
int rc = 0;
/* Skip any NULL entries, though they should be impossible. */
if (NULL == state->files.filename[file_idx])
continue;
if (0 == strcmp(state->files.filename[file_idx], "-")) {
rc = fstat(STDIN_FILENO, &sb);
if ((rc != 0) || (!S_ISREG(sb.st_mode))) {
@@ -209,7 +281,7 @@ static off_t pv_calc_total_lines(pvstate_t state)
return total;
}
#if HAVE_POSIX_FADVISE
/* Advise the OS that we will only be reading sequentially. */
/* Advise the OS that all reads will be sequential. */
(void) posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL);
#endif
@@ -221,14 +293,13 @@ static off_t pv_calc_total_lines(pvstate_t state)
numread = read(fd, scanbuf, sizeof(scanbuf)); /* flawfinder: ignore */
/*
* flawfinder rationale: each time around the loop
* we are always reading into the start of the
* buffer, not moving along it, so the bounding is
* OK.
* flawfinder rationale: every read is reading into
* the start of the buffer, not moving along it, so
* the bounding is OK.
*/
if (numread < 0) {
pv_error(state, "%s: %s", state->files.filename[file_idx], strerror(errno));
state->status.exit_status |= 2;
pv_perror("%s", state->files.filename[file_idx]);
state->status.exit_status |= PV_ERROREXIT_ACCESS;
break;
} else if (0 == numread) {
break;
@@ -245,8 +316,8 @@ static off_t pv_calc_total_lines(pvstate_t state)
}
if (0 != lseek(fd, 0, SEEK_SET)) {
pv_error(state, "%s: %s", state->files.filename[file_idx], strerror(errno));
state->status.exit_status |= 2;
pv_perror("%s", state->files.filename[file_idx]);
state->status.exit_status |= PV_ERROREXIT_ACCESS;
}
(void) close(fd);
@@ -277,86 +348,115 @@ off_t pv_calc_total_size(pvstate_t state)
* Close the given file descriptor and open the next one, whose number in
* the list is "filenum", returning the new file descriptor (or negative on
* error). It is an error if the next input file is the same as the file
* stdout is pointing to.
* the output is pointing to.
*
* Updates state->status.current_input_file in the process.
* Updates state->status.current_input_file and
* state->status.current_input_is_pipe.
*
* If the input is not a pipe, and state->status.output_is_pipe is false,
* and state->control.no_splice is false, also creates a pipe and populates
* state->transfer.intermediate_pipe[] with its file descriptors, if a pipe
* had not already been created (i.e. that array contained [-1,-1]).
*/
int pv_next_file(pvstate_t state, unsigned int filenum, int oldfd)
{
struct stat isb;
struct stat osb;
int fd;
bool input_file_is_stdout;
bool input_file_is_output;
char *next_filename;
if (oldfd >= 0) {
if (0 != close(oldfd)) {
pv_error(state, "%s: %s", _("failed to close file"), strerror(errno));
state->status.exit_status |= 8;
pv_perror("%s: %s", pv_current_file_name(state), _("error closing file"));
state->status.exit_status |= PV_ERROREXIT_TRANSITION;
return -1;
}
}
if (filenum >= state->files.file_count) {
debug("%s: %d >= %d", "filenum too large", filenum, state->files.file_count);
state->status.exit_status |= 8;
state->status.exit_status |= PV_ERROREXIT_TRANSITION;
return -1;
}
if ((NULL == state->files.filename) || (0 == strcmp(state->files.filename[filenum], "-"))) {
next_filename = NULL;
if (NULL != state->files.filename) {
next_filename = state->files.filename[filenum];
if (NULL == next_filename) {
debug("%s: @%d, max %d", "unexpected null filename", filenum, state->files.file_count);
state->status.exit_status |= PV_ERROREXIT_TRANSITION;
return -1;
}
}
if ((NULL == next_filename) || (0 == strcmp(next_filename, "-"))) {
fd = STDIN_FILENO;
} else {
fd = open(state->files.filename[filenum], O_RDONLY); /* flawfinder: ignore */
fd = open(next_filename, O_RDONLY); /* flawfinder: ignore */
/*
* flawfinder rationale: the input file list is under the
* control of the operator by its nature, so we can't refuse
* to open symlinks etc as that would be counterintuitive.
* control of the operator by its nature, so refusing to
* open symlinks would be counterintuitive.
*/
if (fd < 0) {
pv_error(state, "%s: %s: %s",
_("failed to read file"), state->files.filename[filenum], strerror(errno));
state->status.exit_status |= 2;
pv_perror("%s", next_filename);
state->status.exit_status |= PV_ERROREXIT_ACCESS;
return -1;
}
}
if (0 != fstat(fd, &isb)) {
pv_error(state, "%s: %s: %s", _("failed to stat file"),
NULL == state->files.filename ? "-" : state->files.filename[filenum], strerror(errno));
pv_perror("%s", NULL == next_filename ? "-" : next_filename);
(void) close(fd);
state->status.exit_status |= 2;
state->status.exit_status |= PV_ERROREXIT_ACCESS;
return -1;
}
if (0 != fstat(STDOUT_FILENO, &osb)) {
pv_error(state, "%s: %s", _("failed to stat output file"), strerror(errno));
if (0 != fstat(state->control.output_fd, &osb)) {
pv_perror("%s", NULL == state->control.output_name ? "(null)" : state->control.output_name);
(void) close(fd);
state->status.exit_status |= 2;
state->status.exit_status |= PV_ERROREXIT_ACCESS;
return -1;
}
/*
* Check that this new input file is not the same as stdout's
* destination. This restriction is ignored for anything other
* than a regular file or block device.
* If the input file is a regular file or a block device, check that
* it is not the same as the output's destination.
*/
input_file_is_stdout = true;
input_file_is_output = true;
if (isb.st_dev != osb.st_dev)
input_file_is_stdout = false;
input_file_is_output = false;
if (isb.st_ino != osb.st_ino)
input_file_is_stdout = false;
input_file_is_output = false;
if (0 != isatty(fd))
input_file_is_stdout = false;
input_file_is_output = false;
if ((!S_ISREG(isb.st_mode)) && (!S_ISBLK(isb.st_mode)))
input_file_is_stdout = false;
input_file_is_output = false;
if (input_file_is_stdout) {
pv_error(state, "%s: %s", _("input file is output file"),
NULL == state->files.filename ? "-" : state->files.filename[filenum]);
if (input_file_is_output) {
pv_error("%s: %s", NULL == next_filename ? "-" : next_filename, _("input file is also the output"));
(void) close(fd);
state->status.exit_status |= 4;
state->status.exit_status |= PV_ERROREXIT_OUROBOROS;
return -1;
}
/*
* Detect whether the input file is a pipe, a regular file, or
* neither. This is used later, in pv__transfer_read(), when
* determining the transfer method - read/write, splice(),
* copy_file_range().
*/
state->status.current_input_is_pipe = false;
state->status.current_input_is_file = false;
if ((isb.st_mode & S_IFMT) == S_IFIFO) {
state->status.current_input_is_pipe = true;
debug("%s (fd %d)", "input is a pipe", fd);
} else if ((isb.st_mode & S_IFMT) == S_IFREG) {
state->status.current_input_is_file = true;
debug("%s (fd %d)", "input is a regular file", fd);
}
state->status.current_input_file = filenum;
#ifdef O_DIRECT
/*
@@ -366,19 +466,106 @@ int pv_next_file(pvstate_t state, unsigned int filenum, int oldfd)
/*@-compdef@ */
/*
* splint - passed or returned storage is undefined - but at
* this point we know the input file list is been populated,
* so that's OK.
* this point, the input file list has been populated, so
* that's OK.
*/
debug("%s: %s: %s", pv_current_file_name(state), "fcntl", strerror(errno));
/*@+compdef@ */
}
/*
* We don't clear direct_io_changed here, to avoid race conditions
* that could cause the input and output settings to differ.
* Don't clear direct_io_changed here, to avoid race conditions that
* could cause the input and output settings to differ.
*/
#endif /* O_DIRECT */
debug("%s: %d: %s: fd=%d", "next file opened", filenum, pv_current_file_name(state), fd);
debug("%s: %d: %s: fd=%d, is_pipe=%s, is_file=%s", "next file opened", filenum, pv_current_file_name(state), fd,
state->status.current_input_is_pipe ? "true" : "false",
state->status.current_input_is_file ? "true" : "false");
#ifdef HAVE_SPLICE
if (state->control.discard_input && !state->control.no_splice && state->transfer.discard_fd < 0) {
/*
* Open a file descriptor to /dev/null, so that input can be
* spliced to it to implement -X.
*
* If this fails, transfer.discard_fd will be left at -1,
* which means the transfer functions will not use splice().
*/
state->transfer.discard_fd = open("/dev/null", O_WRONLY); /* flawfinder: ignore */
/* flawfinder: /dev/null is trusted. */
if (state->transfer.discard_fd < 0) {
debug("%s: %s", "/dev/null", strerror(errno));
state->transfer.discard_fd = -1;
}
if (!pv_fd_is_dev_null(state->transfer.discard_fd, false)) {
if (state->transfer.discard_fd >= 0)
(void) close(state->transfer.discard_fd);
state->transfer.discard_fd = -1;
}
debug("%s: %d", "discard_fd", state->transfer.discard_fd);
/*
* If discard_fd was successfully opened, it will be used as
* the output, so set the output status flags appropriately.
*/
if (state->transfer.discard_fd >= 0) {
state->status.output_is_pipe = false;
state->status.output_is_file = false;
}
}
if (!(state->status.output_is_pipe || state->status.current_input_is_pipe || state->control.no_splice)
&& (-1 == state->transfer.intermediate_pipe[0])) {
/*
* Create an intermediate pipe to allow the input to be used
* with splice() even though neither it nor the output are
* themselves pipes.
*/
state->transfer.intermediate_pipe_buffer_used = 0;
if (pipe(state->transfer.intermediate_pipe) < 0) {
debug("%s: %s", "pipe()", strerror(errno));
state->transfer.intermediate_pipe[0] = -1;
state->transfer.intermediate_pipe[1] = -1;
} else {
state->transfer.intermediate_pipe_buffer_size = 64 * 1024;
#if defined F_SETPIPE_SZ && defined F_GETPIPE_SZ
{
size_t target_pipe_buffer_size = state->control.pipe_buffer_size;
int new_size;
/* If no pipe buffer size was set, try for 1MiB. */
if (0 == target_pipe_buffer_size)
target_pipe_buffer_size = 1024 * 1024;
/*
* Try to set the pipe buffer size, halving
* repeatedly on failure.
*/
new_size = -1;
while (new_size < 0 && target_pipe_buffer_size >= 4096) {
new_size =
fcntl(state->transfer.intermediate_pipe[1], F_SETPIPE_SZ,
(int) target_pipe_buffer_size);
if (new_size < 0)
target_pipe_buffer_size = target_pipe_buffer_size / 2;
}
/* If all attempts failed, read the current size. */
if (new_size < 0) {
new_size = fcntl(state->transfer.intermediate_pipe[1], F_GETPIPE_SZ);
/* If unable to read, assume 64KiB. */
if (new_size < 0) {
new_size = 64 * 1024;
}
}
state->transfer.intermediate_pipe_buffer_size = new_size;
}
#endif /* defined F_SETPIPE_SZ && defined F_GETPIPE_SZ */
}
debug("%s: [%d,%d]", "intermediate pipe fds", state->transfer.intermediate_pipe[0],
state->transfer.intermediate_pipe[1]);
debug("%s: %d", "intermediate pipe buffer size", state->transfer.intermediate_pipe_buffer_size);
}
#endif /* HAVE_SPLICE */
return fd;
}
@@ -389,7 +576,7 @@ int pv_next_file(pvstate_t state, unsigned int filenum, int oldfd)
* internal state and must not be passed to free() or used after "state" is
* freed.
*/
/*@out@*/ const char *pv_current_file_name(pvstate_t state)
/*@keep@*/ const char *pv_current_file_name(pvstate_t state)
{
static char *str_none = NULL;
static char *str_stdin = NULL;
@@ -399,12 +586,10 @@ int pv_next_file(pvstate_t state, unsigned int filenum, int oldfd)
/*@-onlytrans@ */
/*@-statictrans@ */
/*
* Here we are doing bad things with regards to whether the returned
* string is an allocated string from the state->files.filename array,
* a constant string, or a returned string from gettext(), but it
* has no impact. We explicitly document, above, that the returned
* string expires with the state, and hence switch off the
* associated splint warnings.
* The returned string could be an allocated string from the
* state->files.filename array, a constant string, or a returned
* string from gettext(). The documentation, above, explains that
* the returned string expires with the state.
*/
if (NULL == str_none)
@@ -437,8 +622,8 @@ int pv_next_file(pvstate_t state, unsigned int filenum, int oldfd)
return input_file_name;
/*@+compdef@ */
/*
* splint warns about state->files.filename being undefined, but we
* know it's been populated fully by the time this function is
* splint warns about state->files.filename being undefined, but it
* has definitely been fully populated by the time this function is
* called.
*/
@@ -447,4 +632,85 @@ int pv_next_file(pvstate_t state, unsigned int filenum, int oldfd)
/*@+observertrans@ */
}
/* EOF */
/*
* Return a stream pointer, and populate the filename buffer, for a control
* file associated with a particular process ID, for the given signal
* number; it will be opened for writing if "sender" is true. Returns NULL
* on error.
*/
/*@null@ */
/*@dependent@ */
FILE *pv_open_controlfile(char *filename, size_t bufsize, pid_t control_pid, int signum, bool sender)
{
int open_flags, open_mode, control_fd;
/*@dependent@ */ FILE *control_fptr = NULL;
open_flags = O_RDONLY;
#ifdef O_NOFOLLOW
open_flags += O_NOFOLLOW;
#endif
if (sender)
open_flags = O_WRONLY | O_CREAT | O_EXCL;
open_mode = 0644;
(void) pv_snprintf(filename, bufsize, "/run/user/%lu/pv.remote.%d.%lu", (unsigned long) geteuid(), signum,
(unsigned long) control_pid);
control_fd = open(filename, open_flags, open_mode); /* flawfinder: ignore */
/*
* If /run/user/<uid> wasn't usable, try $HOME/.pv instead.
*/
if (control_fd < 0) {
char *home_dir;
home_dir = getenv("HOME"); /* flawfinder: ignore */
if (NULL == home_dir)
return NULL;
if ('\0' == home_dir[0])
return NULL;
/*
* flawfinder rationale: null and zero-size values are
* rejected, and the destination buffer is bounded.
*/
(void) pv_snprintf(filename, bufsize, "%s/.pv/remote.%d.%lu", home_dir, signum,
(unsigned long) control_pid);
control_fd = open(filename, open_flags, open_mode); /* flawfinder: ignore */
/*
* If the open failed, try creating the $HOME/.pv directory
* first.
*/
if (control_fd < 0) {
(void) pv_snprintf(filename, bufsize, "%s/.pv", home_dir);
(void) mkdir(filename, 0700);
/* In case of weird umask, explicitly chmod the dir. */
(void) chmod(filename, 0700); /* flawfinder: ignore */
(void) pv_snprintf(filename, bufsize, "%s/.pv/remote.%d.%lu", home_dir, signum,
(unsigned long) control_pid);
control_fd = open(filename, open_flags, open_mode); /* flawfinder: ignore */
}
}
/*
* flawfinder rationale: the files are in a directory whose parents
* cannot be manipulated, and the final component is not allowed to
* be a symbolic link. $HOME is checked for a NULL value, and the
* filename is bounded by pv_snprintf() so it can't overshoot the
* filename buffer. When chmod() is called on $HOME/.pv, an
* attacker is assumed to be unlikely to be able to manipulate
* $HOME's contents to make use of $HOME/.pv's mode of 700.
*/
if (control_fd < 0)
return NULL;
debug("%s: %s", "control filename", filename);
control_fptr = fdopen(control_fd, sender ? "wb" : "rb");
return control_fptr;
}
+44
View File
@@ -0,0 +1,44 @@
/*
* Formatter function for average rate.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
/*
* Average transfer rate.
*/
pvdisplay_bytecount_t pv_formatter_average_rate(pvformatter_args_t args)
{
char content[128]; /* flawfinder: ignore - always bounded */
content[0] = '\0';
if (0 == args->buffer_size)
return 0;
/*@-mustfreefresh@ */
if (args->control->numeric) {
/* Numeric - raw value without suffix. */
(void) pv_snprintf(content, sizeof(content),
"%.4Lf", ((args->control->bits ? 8.0 : 1.0) * args->calc->average_rate));
} else if (args->control->bits && !args->control->linemode) {
/* Bits per second. */
pv_describe_amount(content, sizeof(content),
"(%s)", 8 * args->calc->average_rate, "", _("b/s"), args->display->count_type);
} else {
/* Bytes or lines per second. */
pv_describe_amount(content,
sizeof(content), "(%s)", args->calc->average_rate, _("/s"), _("B/s"),
args->display->count_type);
}
/*@+mustfreefresh@ *//* splint - false positive from gettext(). */
return pv_formatter_segmentcontent(content, args);
}
+204
View File
@@ -0,0 +1,204 @@
/*
* Formatter functions for styled progress bars.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
#include <string.h>
#if defined(ENABLE_NLS) && defined(HAVE_WCHAR_H)
#include <wchar.h>
#if defined(HAVE_WCTYPE_H)
#include <wctype.h>
#endif
#endif
/*
* Populate "style" with the named bar style, falling back to plain if the
* name was not recognised. Returns true if the named style was found.
*
* Note that strings are copied into the structure, rather than just
* updating pointers, to maintain separation of concern between different
* parts of the code - and because on 64-bit architectures, the sizes of the
* data types and their associated alignment padding tend to outweigh the
* memory savings from using pointers and shared strings.
*/
static bool pv_barstyle(pvformatter_args_t args, pvbarstyle_t style, const char *name)
{
#define populate_string(item, str, w) { \
item.width = w; \
item.bytes = strlen(str); /* flawfinder: ignore */ \
if (item.bytes > 0 && item.bytes <= PV_BARSTYLE_SIZEOF_STRING) \
memcpy(item.string, str, item.bytes); /* flawfinder: ignore */ \
}
/*
* flawfinder - strlen() on null-terminated static strings is OK,
* and with the memcpy(), the buffer size has been checked.
*/
memset(style, 0, sizeof(*style));
if (args->status->terminal_supports_utf8 && 0 == strcmp(name, "block")) {
style->style_id = 2;
populate_string(style->indicator, "◀▶", 2);
populate_string(style->tip, "", 0);
populate_string(style->filler[0], " ", 1);
populate_string(style->filler[1], "", 1);
style->filler_entries = 2;
return true;
} else if (args->status->terminal_supports_utf8 && 0 == strcmp(name, "granular")) {
style->style_id = 3;
populate_string(style->indicator, "◀▶", 2);
populate_string(style->tip, "", 0);
populate_string(style->filler[0], " ", 1);
populate_string(style->filler[1], "", 1);
populate_string(style->filler[2], "", 1);
populate_string(style->filler[3], "", 1);
populate_string(style->filler[4], "", 1);
populate_string(style->filler[5], "", 1);
populate_string(style->filler[6], "", 1);
populate_string(style->filler[7], "", 1);
populate_string(style->filler[8], "", 1);
style->filler_entries = 9;
return true;
} else if (args->status->terminal_supports_utf8 && 0 == strcmp(name, "shaded")) {
style->style_id = 4;
populate_string(style->indicator, "▒▓▒", 3);
populate_string(style->tip, "", 0);
populate_string(style->filler[0], "", 1);
populate_string(style->filler[1], "", 1);
populate_string(style->filler[2], "", 1);
populate_string(style->filler[3], "", 1);
style->filler_entries = 4;
return true;
}
/* Default plain style. */
style->style_id = 1;
populate_string(style->indicator, "<=>", 3);
populate_string(style->tip, ">", 1);
populate_string(style->filler[0], " ", 1);
populate_string(style->filler[1], "=", 1);
style->filler_entries = 2;
if (0 == strcmp(name, "plain"))
return true;
return false;
}
/*
* Return the index into args->display->barstyle for the style with the
* given name, adding that style to the array if it's not there already and
* there's room.
*
* If there is no room, returns zero, so the first style is re-used.
*/
int8_t pv_display_barstyle_index(pvformatter_args_t args, const char *name)
{
struct pvbarstyle_s style;
int8_t barstyle_index;
#ifdef ENABLE_DEBUGGING
bool found;
#endif
memset(&style, 0, sizeof(style));
#ifdef ENABLE_DEBUGGING
found = pv_barstyle(args, &style, name);
if (!found)
debug("%s: %s", name, "bar style not found, using plain");
#else
(void) pv_barstyle(args, &style, name);
#endif
for (barstyle_index = 0;
barstyle_index < PV_BARSTYLE_MAX && args->display->barstyle[barstyle_index].style_id > 0;
barstyle_index++) {
if (args->display->barstyle[barstyle_index].style_id == style.style_id) {
debug("%s: %s: %d", name, "found in bar style array", barstyle_index);
return barstyle_index;
}
}
if (barstyle_index >= PV_BARSTYLE_MAX) {
debug("%s: %s", name, "no room to add another bar style - returning 0");
return 0;
}
memcpy(&(args->display->barstyle[barstyle_index]), &style, sizeof(style)); /* flawfinder: ignore */
/* flawfinder - the destination is an array element of the right size. */
debug("%s: %s: %d", name, "added to bar style array", barstyle_index);
return barstyle_index;
}
pvdisplay_bytecount_t pv_formatter_bar_default(pvformatter_args_t args)
{
if (0 == args->segment->parameter) {
const char *default_name;
default_name = args->control->default_bar_style;
/*@-branchstate@ */
if (NULL == default_name)
default_name = "plain";
/*@+branchstate@ */
/* splint - it doesn't matter that default_name may be static. */
args->segment->parameter = 1 + pv_display_barstyle_index(args, default_name);
}
return pv_formatter_progress_bar_only(args);
}
pvdisplay_bytecount_t pv_formatter_bar_plain(pvformatter_args_t args)
{
if (0 == args->segment->parameter)
args->segment->parameter = 1 + pv_display_barstyle_index(args, "plain");
return pv_formatter_progress_bar_only(args);
}
pvdisplay_bytecount_t pv_formatter_bar_block(pvformatter_args_t args)
{
if (0 == args->segment->parameter)
args->segment->parameter = 1 + pv_display_barstyle_index(args, "block");
return pv_formatter_progress_bar_only(args);
}
pvdisplay_bytecount_t pv_formatter_bar_granular(pvformatter_args_t args)
{
if (0 == args->segment->parameter)
args->segment->parameter = 1 + pv_display_barstyle_index(args, "granular");
return pv_formatter_progress_bar_only(args);
}
pvdisplay_bytecount_t pv_formatter_bar_shaded(pvformatter_args_t args)
{
if (0 == args->segment->parameter)
args->segment->parameter = 1 + pv_display_barstyle_index(args, "shaded");
return pv_formatter_progress_bar_only(args);
}
+51
View File
@@ -0,0 +1,51 @@
/*
* Formatter function for transfer buffer percentage utilisation.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
/*
* Percentage transfer buffer utilisation.
*/
pvdisplay_bytecount_t pv_formatter_buffer_percent(pvformatter_args_t args)
{
char content[16]; /* flawfinder: ignore - always bounded */
content[0] = '\0';
if (0 == args->buffer_size)
return 0;
if (args->transfer->buffer_size > 0) {
double pct_used = pv_percentage((off_t)
(args->transfer->read_position - args->transfer->write_position),
(off_t)
(args->transfer->buffer_size));
(void) pv_snprintf(content, sizeof(content), "{%3.0f%%}", pct_used);
}
switch (args->transfer->method) {
case PV_TRANSFERMETHOD_READWRITE:
break;
case PV_TRANSFERMETHOD_SPLICE:
(void) pv_snprintf(content, sizeof(content), "{%s}", "----");
break;
case PV_TRANSFERMETHOD_SPLICE_INTERMEDIATE:
(void) pv_snprintf(content, sizeof(content), "{%s}", "-||-");
break;
case PV_TRANSFERMETHOD_COPY_FILE_RANGE:
(void) pv_snprintf(content, sizeof(content), "{%s}", "--->");
break;
case PV_TRANSFERMETHOD__UNSET:
(void) pv_snprintf(content, sizeof(content), "{%s}", "????");
break;
}
return pv_formatter_segmentcontent(content, args);
}
+44
View File
@@ -0,0 +1,44 @@
/*
* Formatter function for bytes or lines transferred.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
/*
* Number of bytes or lines transferred.
*/
pvdisplay_bytecount_t pv_formatter_bytes(pvformatter_args_t args)
{
char content[128]; /* flawfinder: ignore - always bounded */
args->display->showing_bytes = true;
if (0 == args->buffer_size)
return 0;
content[0] = '\0';
/*@-mustfreefresh@ */
if (args->control->numeric) {
/* Numeric mode - raw values only, no suffix. */
(void) pv_snprintf(content, sizeof(content),
"%lld", (long long) ((args->control->bits ? 8 : 1) * args->transfer->transferred));
} else if (args->control->bits && !args->control->linemode) {
pv_describe_amount(content, sizeof(content), "%s",
(long double) (args->transfer->transferred * 8), "", _("b"),
args->display->count_type);
} else {
pv_describe_amount(content, sizeof(content), "%s",
(long double) (args->transfer->transferred), "", _("B"), args->display->count_type);
}
/*@+mustfreefresh@ *//* splint - false positive from gettext(). */
return pv_formatter_segmentcontent(content, args);
}
+86
View File
@@ -0,0 +1,86 @@
/*
* Formatter function for OSC 9;4 - ConEmu progress bar - codes.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
#include <string.h>
#if HAVE_MATH_H
#include <math.h>
#endif
/*
* Populate a buffer with OSC 9;4 progress bar codes for terminal title
* tabs, returning the length of the string.
*/
size_t pv_osc94_format(char *buffer, size_t bufsize, readonly_pvcontrol_t control, readonly_pvtransfercalc_t calc)
{
int formatted_size = 0;
if (NULL == buffer)
return 0;
if (bufsize < 1)
return 0;
buffer[0] = '\0';
if (control->size > 0 || control->rate_gauge) {
/* Known size or rate gauge - percentage progress. */
formatted_size = pv_snprintf(buffer, bufsize, "\033]9;4;1;%.0f\033\\", calc->percentage);
} else {
/* Unknown size - indeterminate progress. */
/* See pv_formatter_progress_unknownsize() in progressbar.c. */
double indicator_position;
indicator_position = calc->percentage;
if (indicator_position > 200.0)
#if HAVE_FMOD
indicator_position = fmod(indicator_position, 200.0);
#else
{
while (indicator_position > 200.0)
indicator_position -= 200.0;
}
#endif
if (indicator_position > 100.0) {
indicator_position = 200.0 - indicator_position;
}
if (indicator_position < 0.0) {
indicator_position = 0.0;
}
formatted_size = pv_snprintf(buffer, bufsize, "\033]9;4;3;%.0f\033\\", indicator_position);
}
if (formatted_size < 0)
return 0;
if (formatted_size >= (int) bufsize)
return bufsize - 1;
return (size_t) formatted_size;
}
/*
* Produce OSC 9;4 progress bar codes for terminal title tabs.
*/
pvdisplay_bytecount_t pv_formatter_progress_conemu(pvformatter_args_t args)
{
char content[128]; /* flawfinder: ignore */
/* flawfinder - null-terminated and bounded with pv_snprintf(). */
memset(content, 0, sizeof(content));
(void) pv_osc94_format(content, sizeof(content), args->control, args->calc);
args->display->using_osc94 = true;
return pv_formatter_segmentcontent(content, args);
}
+83
View File
@@ -0,0 +1,83 @@
/*
* Formatter function for ETA display.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
#include <limits.h>
/*
* Estimated time until completion.
*/
pvdisplay_bytecount_t pv_formatter_eta(pvformatter_args_t args)
{
char content[128]; /* flawfinder: ignore - bounded in pv_snprintf(). */
long eta, max_days;
content[0] = '\0';
/*
* Don't try to calculate this if the size is not known.
*/
if (args->control->size < 1)
return 0;
if (0 == args->buffer_size)
return 0;
eta =
pv_seconds_remaining((args->transfer->transferred - args->display->initial_offset),
args->control->size - args->display->initial_offset, args->calc->current_avg_rate);
/* The ETA must always be positive. */
if (eta < 0)
eta = 0;
/* The ETA must be under 1,000,000 days so it's not too wide. */
/* If a "long" is 32 bits, only 24,855 days will fit in it. */
max_days = 24855L;
#ifdef LONG_MAX
if (LONG_MAX > 2147483647L)
max_days = 1000000;
#endif
if ((eta / 86400L) >= max_days)
eta = max_days * 86400L - 1L;
/*
* If the ETA is more than a day, include a day count as well as
* hours, minutes, and seconds.
*/
/*@-mustfreefresh@ */
if (eta > 86400L) {
(void) pv_snprintf(content,
sizeof(content),
"%.16s %ld:%02ld:%02ld:%02ld",
_("ETA"), eta / 86400, (eta / 3600) % 24, (eta / 60) % 60, eta % 60);
} else {
(void) pv_snprintf(content,
sizeof(content),
"%.16s %ld:%02ld:%02ld", _("ETA"), eta / 3600, (eta / 60) % 60, eta % 60);
}
/*@+mustfreefresh@ *//* splint: false positives from gettext(). */
/*
* If this is the final update, show a blank space where the ETA
* used to be.
*/
if (args->display->final_update) {
size_t erase_idx;
for (erase_idx = 0; erase_idx < sizeof(content) && content[erase_idx] != '\0'; erase_idx++) {
content[erase_idx] = ' ';
}
}
return pv_formatter_segmentcontent(content, args);
}
+108
View File
@@ -0,0 +1,108 @@
/*
* Formatter function for the local time at which the transfer is expected
* to complete.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
#include <string.h>
#include <time.h>
#include <limits.h>
/*
* Estimated local time of completion.
*/
pvdisplay_bytecount_t pv_formatter_fineta(pvformatter_args_t args)
{
char content[128]; /* flawfinder: ignore - bounded by strftime(). */
time_t now, then;
const struct tm *time_ptr;
long eta, max_years;
const char *time_format;
bool show_fineta;
content[0] = '\0';
/*
* Don't try to calculate this if the size is not known.
*/
if (args->control->size < 1)
return 0;
if (0 == args->buffer_size)
return 0;
now = time(NULL);
show_fineta = true;
time_format = NULL;
/*
* Note that the completion clock time may be hidden by a failed
* localtime lookup.
*/
eta = pv_seconds_remaining(args->transfer->transferred - args->display->initial_offset,
args->control->size - args->display->initial_offset, args->calc->current_avg_rate);
/* The ETA must always be positive. */
if (eta < 0)
eta = 0;
/* Clamp the ETA to 7,000 years max so the date isn't too wide. */
/* If a "long" is 32 bits, only 68 years will fit in it. */
max_years = 68;
#ifdef LONG_MAX
if (LONG_MAX > 2147483647L)
max_years = 7000;
#endif
if ((eta / 31536000L) > max_years)
eta = 31536000L * max_years;
/*
* Only include the date if the ETA is more than 6 hours
* away.
*/
if (eta > (long) (6 * 3600)) {
time_format = "%Y-%m-%d %H:%M:%S";
} else {
time_format = "%H:%M:%S";
}
then = now + eta;
time_ptr = localtime(&then);
if (NULL == time_ptr) {
show_fineta = false;
} else {
/*
* The localtime() function keeps data stored in a static
* buffer that gets overwritten by time functions.
*/
struct tm time = *time_ptr;
size_t content_bytes;
/*@-mustfreefresh@ */
(void) pv_snprintf(content, sizeof(content), "%.16s ", _("FIN"));
/*@+mustfreefresh@ *//* splint: false positive from gettext(). */
content_bytes = strlen(content); /* flawfinder: ignore */
/* flawfinder: always bounded with \0 by pv_snprintf(). */
(void) strftime(content + content_bytes, sizeof(content) - 1 - content_bytes, time_format, &time);
}
if (!show_fineta) {
size_t erase_idx;
for (erase_idx = 0; erase_idx < sizeof(content) && content[erase_idx] != '\0'; erase_idx++) {
content[erase_idx] = ' ';
}
}
return pv_formatter_segmentcontent(content, args);
}
+54
View File
@@ -0,0 +1,54 @@
/*
* Formatter function for showing the last bytes written.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
/*
* Display the last few bytes written.
*
* As a side effect, this sets args->display->lastwritten_bytes to
* the segment's chosen_size, if it was previously smaller than that.
*/
pvdisplay_bytecount_t pv_formatter_last_written(pvformatter_args_t args)
{
pvdisplay_bytecount_t bytes_to_show, read_offset, write_offset, remaining;
args->display->showing_last_written = true;
bytes_to_show = args->segment->chosen_size;
if (0 == bytes_to_show)
bytes_to_show = args->segment->width;
if (0 == bytes_to_show)
return 0;
if (bytes_to_show > PV_SIZEOF_LASTWRITTEN_BUFFER)
bytes_to_show = PV_SIZEOF_LASTWRITTEN_BUFFER;
if (bytes_to_show > args->display->lastwritten_bytes)
args->display->lastwritten_bytes = bytes_to_show;
if (0 == args->buffer_size)
return 0;
if (args->offset + bytes_to_show >= args->buffer_size)
return 0;
args->segment->offset = args->offset;
args->segment->bytes = bytes_to_show;
read_offset = args->display->lastwritten_bytes - bytes_to_show;
write_offset = args->offset;
for (remaining = bytes_to_show; remaining > 0; remaining--) {
char display_char = args->display->lastwritten_buffer[read_offset++];
args->buffer[write_offset++] = pv_isprint(display_char) ? display_char : '.';
}
return bytes_to_show;
}
+43
View File
@@ -0,0 +1,43 @@
/*
* Formatter function for showing the name of the transfer.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
#include <string.h>
/*
* Display the transfer's name.
*/
pvdisplay_bytecount_t pv_formatter_name(pvformatter_args_t args)
{
char string_format[32]; /* flawfinder: ignore - always bounded */
char content[512]; /* flawfinder: ignore - always bounded */
pvdisplay_bytecount_t field_width;
if (0 == args->buffer_size)
return 0;
field_width = args->segment->chosen_size;
if (field_width < 1)
field_width = 9;
if (field_width > 500)
field_width = 500;
memset(string_format, 0, sizeof(string_format));
(void) pv_snprintf(string_format, sizeof(string_format), "%%%d.500s:", field_width);
content[0] = '\0';
if (NULL != args->control->name) {
(void) pv_snprintf(content, sizeof(content), string_format, args->control->name);
}
return pv_formatter_segmentcontent(content, args);
}
+49
View File
@@ -0,0 +1,49 @@
/*
* Formatter function for the most recently written line.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
/*
* Display the previously written line.
*/
pvdisplay_bytecount_t pv_formatter_previous_line(pvformatter_args_t args)
{
pvdisplay_bytecount_t bytes_to_show, read_offset, write_offset, remaining;
args->display->showing_previous_line = true;
if (0 == args->buffer_size)
return 0;
bytes_to_show = args->segment->chosen_size;
if (0 == bytes_to_show)
bytes_to_show = args->segment->width;
if (0 == bytes_to_show)
return 0;
if (bytes_to_show > PV_SIZEOF_PREVLINE_BUFFER)
bytes_to_show = PV_SIZEOF_PREVLINE_BUFFER;
if (args->offset + bytes_to_show >= args->buffer_size)
return 0;
args->segment->offset = args->offset;
args->segment->bytes = bytes_to_show;
read_offset = 0;
write_offset = args->offset;
for (remaining = bytes_to_show; remaining > 0; remaining--) {
char display_char = args->display->previous_line[read_offset++];
args->buffer[write_offset++] = pv_isprint(display_char) ? display_char : ' ';
}
return bytes_to_show;
}
+410
View File
@@ -0,0 +1,410 @@
/*
* Formatter functions for progress bars.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
#include <string.h>
#if HAVE_MATH_H
#include <math.h>
#endif
/* Convenience macro for appending a string to the buffer. */
#define append_to_buffer(x) { \
if (buffer_offset < (buffer_size - x.bytes)) { \
memcpy(&(buffer[buffer_offset]), x.string, x.bytes); /* flawfinder: ignore */ \
buffer_offset += x.bytes; \
} \
}
/*
* flawfinder - the byte count and offset are checked against the buffer
* size before memcpy() is called.
*/
/*
* Write a progress bar to a buffer, in known-size or rate-gauge mode - a
* bar, and a percentage (size) or max rate (gauge). The total width of the
* content is bounded to the given width. Returns the number of bytes
* written to the buffer.
*
* If "bar_sides" is false, only the bar itself is rendered, not the opening
* and closing characters.
*
* If "include_bar" is false, the bar is omitted entirely.
*
* If "include_amount" is false, the percentage or rate after the bar is
* omitted.
*
* This is only called by pv_formatter_progress().
*/
static pvdisplay_bytecount_t pv_formatter_progress_knownsize(pvformatter_args_t args, char *buffer,
pvdisplay_bytecount_t buffer_size, bool bar_sides,
bool include_bar, bool include_amount)
{
char after_bar[32]; /* flawfinder: ignore - only populated by pv_snprintf(). */
pvdisplay_bytecount_t after_bar_bytes, buffer_offset;
pvdisplay_width_t after_bar_width;
pvdisplay_width_t bar_area_width, filled_bar_width, pad_count;
double bar_percentage;
pvbarstyle_t style;
pvdisplay_bytecount_t full_cell_index;
bool has_tip = false;
buffer[0] = '\0';
if (args->segment->parameter > 0 && args->segment->parameter <= PV_BARSTYLE_MAX) {
style = &(args->display->barstyle[args->segment->parameter - 1]);
} else {
style = &(args->display->barstyle[0]);
}
full_cell_index = style->filler_entries;
if (full_cell_index > 0)
full_cell_index--;
if (1 == full_cell_index && style->tip.width > 0)
has_tip = true;
memset(after_bar, 0, sizeof(after_bar));
if (args->control->size > 0) {
/* Percentage of data transferred. */
bar_percentage = (double) (args->calc->percentage);
(void) pv_snprintf(after_bar, sizeof(after_bar), " %3ld%%", (int) bar_percentage);
} else {
/* Current rate vs max rate. */
bar_percentage = 0.0;
if (args->calc->rate_max > 0) {
bar_percentage = (double) (100.0 * args->calc->transfer_rate / args->calc->rate_max);
}
/*@-mustfreefresh@ */
if (args->control->bits && !args->control->linemode) {
/* Bits per second. */
pv_describe_amount(after_bar, sizeof(after_bar), "/%s",
8.0 * args->calc->rate_max, "", _("b/s"), args->display->count_type);
} else {
/* Bytes or lines per second. */
pv_describe_amount(after_bar, sizeof(after_bar),
"/%s", args->calc->rate_max, _("/s"), _("B/s"), args->display->count_type);
}
/*@+mustfreefresh@ *//* splint: false positives from gettext(). */
}
if (!include_amount)
after_bar[0] = '\0';
after_bar_bytes = strlen(after_bar); /* flawfinder: ignore */
/* flawfinder: always \0-terminated by pv_snprintf() and the earlier memset(). */
after_bar_width = pv_strwidth(after_bar, after_bar_bytes);
if (!include_bar) {
/*
* Only returning the "after bar" portion - the amount
* (progress or max rate).
*/
if (buffer_size < after_bar_bytes)
return 0;
if (after_bar_bytes > 1) {
/* NB skip the leading space. */
memmove(buffer, after_bar + 1, after_bar_bytes - 1);
buffer[after_bar_bytes - 1] = '\0';
return after_bar_bytes - 1;
}
return 0;
}
if (bar_sides) {
if (args->segment->width < (after_bar_width + 2))
return 0;
bar_area_width = args->segment->width - after_bar_width - 2;
} else {
if (args->segment->width < after_bar_width)
return 0;
bar_area_width = args->segment->width - after_bar_width;
}
filled_bar_width = (pvdisplay_width_t) ((bar_area_width * bar_percentage) / 100);
/* Leave room for the tip of the bar. */
if (has_tip && filled_bar_width > 0)
filled_bar_width -= style->tip.width;
debug("percentage=%.2f width=%d bar_area_width=%d filled_bar_width=%d after_bar_width=%d", bar_percentage,
args->segment->width, bar_area_width, filled_bar_width, after_bar_width);
buffer_offset = 0;
if (bar_sides) {
/* The opening of the bar area. */
buffer[buffer_offset++] = '[';
}
/* The bar portion. */
pad_count = 0;
while (pad_count < filled_bar_width && pad_count < bar_area_width) {
append_to_buffer(style->filler[full_cell_index]);
pad_count += style->filler[full_cell_index].width;
if (0 == style->filler[full_cell_index].width)
pad_count++;
}
/* The tip of the bar, if not at 100%. */
if (has_tip && pad_count < bar_area_width) {
append_to_buffer(style->tip);
pad_count += style->tip.width;
}
/* A partial cell, if below 100% and there are intermediates. */
if (pad_count < bar_area_width && full_cell_index > 1 && !has_tip) {
double exact_width = (((double) bar_area_width) * bar_percentage) / 100.0;
double cell_portion = exact_width - (double) filled_bar_width;
double cell_index_double = ((double) full_cell_index) * cell_portion;
size_t cell_index = (size_t) cell_index_double;
if (cell_index > full_cell_index)
cell_index = full_cell_index;
append_to_buffer(style->filler[cell_index]);
pad_count += style->filler[cell_index].width;
if (0 == style->filler[cell_index].width)
pad_count++;
}
/* The spaces after the bar. */
while (pad_count < bar_area_width) {
append_to_buffer(style->filler[0]);
pad_count += style->filler[0].width;
if (0 == style->filler[0].width)
pad_count++;
}
if (bar_sides) {
/* The closure of the bar area. */
if (buffer_offset < buffer_size - 1)
buffer[buffer_offset++] = ']';
}
/* The percentage. */
if (after_bar_bytes > 0 && after_bar_bytes < (buffer_size - 1 - buffer_offset)) {
memmove(buffer + buffer_offset, after_bar, after_bar_bytes);
buffer_offset += after_bar_bytes;
}
buffer[buffer_offset] = '\0';
return buffer_offset;
}
/*
* Write a progress bar to a buffer, in unknown-size mode - just a moving
* indicator. The total width of the content is bounded to the given width.
* Returns the number of bytes written to the buffer.
*
* If "bar_sides" is false, only the bar itself is rendered, not the opening
* and closing characters.
*
* This is only called by pv_formatter_progress().
*/
static pvdisplay_bytecount_t pv_formatter_progress_unknownsize(pvformatter_args_t args, char *buffer,
pvdisplay_bytecount_t buffer_size, bool bar_sides)
{
pvdisplay_bytecount_t buffer_offset;
pvdisplay_width_t bar_area_width, pad_count;
double indicator_position, padding_width;
pvbarstyle_t style;
buffer[0] = '\0';
if (args->segment->parameter > 0 && args->segment->parameter <= PV_BARSTYLE_MAX) {
style = &(args->display->barstyle[args->segment->parameter - 1]);
} else {
style = &(args->display->barstyle[0]);
}
if (bar_sides) {
if (args->segment->width < (style->indicator.width + 3))
return 0;
bar_area_width = args->segment->width - (style->indicator.width + 2);
} else {
if (args->segment->width < (style->indicator.width + 2))
return 0;
bar_area_width = args->segment->width - style->indicator.width;
}
/*
* Note that pv_calculate_transfer_rate() sets the percentage when
* the size is unknown to a value that goes 0 - 200 and resets, so
* here this is used make values above 100 send the indicator back
* down again, so it moves back and forth.
*/
indicator_position = args->calc->percentage;
if (indicator_position > 200.0)
#if HAVE_FMOD
indicator_position = fmod(indicator_position, 200.0);
#else
{
while (indicator_position > 200.0)
indicator_position -= 200.0;
}
#endif
if (indicator_position > 100.0)
indicator_position = 200.0 - indicator_position;
if (indicator_position < 0.0)
indicator_position = 0.0;
buffer_offset = 0;
if (bar_sides) {
/* The opening of the bar area. */
buffer[buffer_offset++] = '[';
}
/* The spaces before the indicator. */
pad_count = 0;
padding_width = (((double) bar_area_width) * indicator_position) / 100.0;
while (pad_count < bar_area_width && pad_count < (pvdisplay_width_t) padding_width) {
append_to_buffer(style->filler[0]);
pad_count += style->filler[0].width;
if (0 == style->filler[0].width)
pad_count++;
}
/* The indicator. */
if (buffer_offset < buffer_size - style->indicator.bytes) {
append_to_buffer(style->indicator);
}
/* The spaces after the indicator. */
while (pad_count < bar_area_width) {
append_to_buffer(style->filler[0]);
pad_count += style->filler[0].width;
if (0 == style->filler[0].width)
pad_count++;
}
if (bar_sides) {
/* The closure of the bar area. */
if (buffer_offset < buffer_size - 1)
buffer[buffer_offset++] = ']';
}
buffer[buffer_offset] = '\0';
return buffer_offset;
}
/*
* Progress bar.
*/
pvdisplay_bytecount_t pv_formatter_progress(pvformatter_args_t args)
{
char content[4096]; /* flawfinder: ignore - always bounded */
pvdisplay_bytecount_t bytes;
content[0] = '\0';
if (0 == args->segment->parameter) {
const char *default_name;
default_name = args->control->default_bar_style;
/*@-branchstate@ */
if (NULL == default_name)
default_name = "plain";
/*@+branchstate@ */
/* splint - it doesn't matter that default_name may be static. */
args->segment->parameter = 1 + pv_display_barstyle_index(args, default_name);
}
if (0 == args->buffer_size)
return 0;
if (args->control->size > 0 || args->control->rate_gauge) {
/* Known size or rate gauge - bar with percentage. */
bytes = pv_formatter_progress_knownsize(args, content, sizeof(content), true, true, true);
} else {
/* Unknown size - back-and-forth moving indicator. */
bytes = pv_formatter_progress_unknownsize(args, content, sizeof(content), true);
}
content[bytes] = '\0';
return pv_formatter_segmentcontent(content, args);
}
/*
* Progress bar, without sides and without a number afterwards.
*/
pvdisplay_bytecount_t pv_formatter_progress_bar_only(pvformatter_args_t args)
{
char content[4096]; /* flawfinder: ignore - always bounded */
pvdisplay_bytecount_t bytes;
content[0] = '\0';
if (0 == args->segment->parameter) {
const char *default_name;
default_name = args->control->default_bar_style;
/*@-branchstate@ */
if (NULL == default_name)
default_name = "plain";
/*@+branchstate@ */
/* splint - it doesn't matter that default_name may be static. */
args->segment->parameter = 1 + pv_display_barstyle_index(args, default_name);
}
if (0 == args->buffer_size)
return 0;
if (args->control->size > 0 || args->control->rate_gauge) {
/* Known size or rate gauge - bar with percentage. */
bytes = pv_formatter_progress_knownsize(args, content, sizeof(content), false, true, false);
} else {
/* Unknown size - back-and-forth moving indicator. */
bytes = pv_formatter_progress_unknownsize(args, content, sizeof(content), false);
}
content[bytes] = '\0';
return pv_formatter_segmentcontent(content, args);
}
/*
* The number after the progress bar.
*/
pvdisplay_bytecount_t pv_formatter_progress_amount_only(pvformatter_args_t args)
{
char content[256]; /* flawfinder: ignore - always bounded */
pvdisplay_bytecount_t bytes;
memset(content, 0, sizeof(content));
if (0 == args->buffer_size)
return 0;
if (args->control->numeric) {
/* Numeric mode - percentage as a rounded integer with no suffix. */
(void) pv_snprintf(content, sizeof(content), "%.0f", args->calc->percentage);
bytes = strlen(content); /* flawfinder: ignore */
/* flawfinder: always \0-terminated by pv_snprintf() and the earlier memset(). */
} else if (args->control->size > 0 || args->control->rate_gauge) {
/* Known size or rate gauge - percentage or rate. */
bytes = pv_formatter_progress_knownsize(args, content, sizeof(content), false, false, true);
} else {
/* Unknown size - no number. */
return 0;
}
content[bytes] = '\0';
return pv_formatter_segmentcontent(content, args);
}
+45
View File
@@ -0,0 +1,45 @@
/*
* Formatter function for the current rate of transfer.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
/*
* Transfer rate.
*/
pvdisplay_bytecount_t pv_formatter_rate(pvformatter_args_t args)
{
char content[128]; /* flawfinder: ignore - always bounded */
args->display->showing_rate = true;
content[0] = '\0';
if (0 == args->buffer_size)
return 0;
/*@-mustfreefresh@ */
if (args->control->numeric) {
/* Numeric - raw value without suffix. */
(void) pv_snprintf(content, sizeof(content),
"%.4Lf", ((args->control->bits ? 8.0 : 1.0) * args->calc->transfer_rate));
} else if (args->control->bits && !args->control->linemode) {
/* Bits per second. */
pv_describe_amount(content, sizeof(content), "[%s]",
8 * args->calc->transfer_rate, "", _("b/s"), args->display->count_type);
} else {
/* Bytes or lines per second. */
pv_describe_amount(content, sizeof(content),
"[%s]", args->calc->transfer_rate, _("/s"), _("B/s"), args->display->count_type);
}
/*@+mustfreefresh@ *//* splint - false positives from gettext(). */
return pv_formatter_segmentcontent(content, args);
}
+50
View File
@@ -0,0 +1,50 @@
/*
* Formatter function for ratio of bytes transferred by the other monitored
* side to bytes transferred by this side.
*
* Copyright 2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
/*
* Ratio of bytes or lines transferred by the other monitored side ("-M
* both") to the bytes or lines transferred by this side.
*/
pvdisplay_bytecount_t pv_formatter_ratio(pvformatter_args_t args)
{
char content[128]; /* flawfinder: ignore - always bounded */
args->display->showing_ratio = true;
if (0 == args->buffer_size)
return 0;
content[0] = '\0';
if (0 == args->transfer->otherside_transferred || 0 == args->transfer->transferred) {
(void) pv_snprintf(content, sizeof(content), "%s:%s", "-", "-");
} else if (args->transfer->otherside_transferred == args->transfer->transferred) {
(void) pv_snprintf(content, sizeof(content), "%d:%d", 1, 1);
} else {
long double side1, side2, ratio;
side1 = (long double) (args->transfer->otherside_transferred);
side2 = (long double) (args->transfer->transferred);
if (side1 > side2) {
ratio = side1 / side2;
(void) pv_snprintf(content, sizeof(content), "%.4Lg:%d", ratio, 1);
} else {
ratio = side2 / side1;
(void) pv_snprintf(content, sizeof(content), "%d:%.4Lg", 1, ratio);
}
}
return pv_formatter_segmentcontent(content, args);
}
+218
View File
@@ -0,0 +1,218 @@
/*
* Formatter function for ECMA-48 SGR codes.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
#include <string.h>
struct sgr_keyword_map_s {
/*@null@ */ const char *keyword;
uint8_t bytes;
uint8_t code;
};
/*
* Return an array mapping keywords to ECMA-48 SGR code numbers.
*/
/*@keep@ */ static struct sgr_keyword_map_s *sgr_keywords(void)
{
/*@keep@ */ static struct sgr_keyword_map_s keywords[] = {
{ "reset", 0, 0 },
{ "none", 0, 0 },
{ "bold", 0, 1 },
{ "dim", 0, 2 },
{ "italic", 0, 3 },
{ "underscore", 0, 4 },
{ "underline", 0, 4 },
{ "blink", 0, 5 },
{ "reverse", 0, 7 },
{ "no-bold", 0, 22 }, /* same as no-dim */
{ "no-dim", 0, 22 },
{ "no-italic", 0, 23 },
{ "no-underscore", 0, 24 },
{ "no-underline", 0, 24 },
{ "no-blink", 0, 25 },
{ "no-reverse", 0, 27 },
{ "black", 0, 30 },
{ "red", 0, 31 },
{ "green", 0, 32 },
{ "brown", 0, 33 },
{ "yellow", 0, 33 },
{ "blue", 0, 34 },
{ "magenta", 0, 35 },
{ "cyan", 0, 36 },
{ "white", 0, 37 },
{ "fg-black", 0, 30 },
{ "fg-red", 0, 31 },
{ "fg-green", 0, 32 },
{ "fg-brown", 0, 33 },
{ "fg-yellow", 0, 33 },
{ "fg-blue", 0, 34 },
{ "fg-magenta", 0, 35 },
{ "fg-cyan", 0, 36 },
{ "fg-white", 0, 37 },
{ "fg-default", 0, 39 },
{ "bg-black", 0, 40 },
{ "bg-red", 0, 41 },
{ "bg-green", 0, 42 },
{ "bg-brown", 0, 43 },
{ "bg-yellow", 0, 43 },
{ "bg-blue", 0, 44 },
{ "bg-magenta", 0, 45 },
{ "bg-cyan", 0, 46 },
{ "bg-white", 0, 47 },
{ "bg-default", 0, 49 },
{ NULL, 0, 0 }
};
/* Calculate the lengths of each keyword on the first call. */
if (0 == keywords[0].bytes) {
int keyword_index;
for (keyword_index = 0; NULL != keywords[keyword_index].keyword; keyword_index++) {
keywords[keyword_index].bytes = strlen(keywords[keyword_index].keyword); /* flawfinder: ignore */
/* flawfinder - strlen() on a static null-terminated string is OK. */
}
}
/*@-compmempass@ */
return keywords;
/*@+compmempass@ */
/*
* splint - no other way to pass static back without a false
* positive warning about a memory leak.
*/
}
/*
* Display SGR codes if colour output is supported.
*/
pvdisplay_bytecount_t pv_formatter_sgr(pvformatter_args_t args)
{
/*@keep@ */ static struct sgr_keyword_map_s *keywords;
char content[1024]; /* flawfinder: ignore */
size_t content_buffer_size = sizeof(content);
pvdisplay_bytecount_t write_position, read_position, keyword_start, keyword_length;
int numeric_value, code_count, most_recent_code;
/* flawfinder - null-terminated and bounded with pv_snprintf(). */
if (!args->display->colour_permitted)
return 0;
args->display->format_uses_colour = true;
if (!args->status->terminal_supports_colour)
return 0;
if (NULL == args->segment->string_parameter)
return 0;
if (0 == args->segment->string_parameter_bytes)
return 0;
keywords = sgr_keywords();
write_position = 0;
content[0] = '\0';
debug("%p+%d [%.*s]", args->segment->string_parameter, args->segment->string_parameter_bytes,
args->segment->string_parameter_bytes, args->segment->string_parameter);
read_position = 0;
keyword_start = 0;
keyword_length = 0;
numeric_value = -1;
code_count = 0;
most_recent_code = -1;
while (read_position < args->segment->string_parameter_bytes) {
char read_char = args->segment->string_parameter[read_position++];
if ((',' == read_char) || (';' == read_char)) {
keyword_length = read_position - keyword_start;
if (keyword_length > 0)
keyword_length--;
} else {
if ((read_char >= '0' && read_char <= '9')
&& (numeric_value >= 0 || keyword_start == read_position - 1)) {
if (keyword_start == read_position - 1)
numeric_value = 0;
numeric_value = numeric_value * 10 + (int) (read_char - '0');
} else {
numeric_value = -1;
}
if (read_position >= args->segment->string_parameter_bytes) {
keyword_length = read_position - keyword_start;
}
}
if (keyword_length > 0) {
int code = -1;
debug("keyword@%d+%d: [%.*s]; numeric=%d", keyword_start, keyword_length, keyword_length,
&(args->segment->string_parameter[keyword_start]), numeric_value);
if (numeric_value >= 0 && numeric_value < 255) {
code = numeric_value;
} else {
int keyword_index;
for (keyword_index = 0; -1 == code && NULL != keywords[keyword_index].keyword;
keyword_index++) {
if (keyword_length != keywords[keyword_index].bytes)
continue;
if (0 !=
strncmp(keywords[keyword_index].keyword,
&(args->segment->string_parameter[keyword_start]), keyword_length))
continue;
code = (int) (keywords[keyword_index].code);
}
}
debug("code=%d", code);
if (code >= 0) {
if (code_count > 15 && write_position < content_buffer_size) {
write_position +=
pv_snprintf(content + write_position, sizeof(content) - write_position,
"%s", "m");
code_count = 0;
}
if (0 == code_count && write_position < content_buffer_size) {
write_position +=
pv_snprintf(content + write_position, sizeof(content) - write_position,
"%s", "\033[");
} else if (write_position < content_buffer_size) {
write_position +=
pv_snprintf(content + write_position, sizeof(content) - write_position,
"%s", ";");
}
if (write_position < content_buffer_size) {
write_position +=
pv_snprintf(content + write_position, sizeof(content) - write_position,
"%d", code);
}
code_count++;
most_recent_code = code;
}
keyword_length = 0;
keyword_start = read_position;
}
}
if (code_count > 0 && write_position < content_buffer_size)
write_position += pv_snprintf(content + write_position, sizeof(content) - write_position, "%s", "m");
if (most_recent_code > 0) {
args->display->sgr_code_active = true;
} else if (0 == most_recent_code) {
args->display->sgr_code_active = false;
}
return pv_formatter_segmentcontent(content, args);
}
+69
View File
@@ -0,0 +1,69 @@
/*
* Formatter function for the elapsed transfer time.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
/*
* Elapsed time.
*/
pvdisplay_bytecount_t pv_formatter_timer(pvformatter_args_t args)
{
char content[128]; /* flawfinder: ignore - bounded with pv_snprintf(). */
long double elapsed_seconds;
args->display->showing_timer = true;
content[0] = '\0';
if (0 == args->buffer_size)
return 0;
elapsed_seconds = args->transfer->elapsed_seconds;
/* The timer must always be positive. */
if (elapsed_seconds < 0.0L)
elapsed_seconds = 0.0L;
if (args->control->numeric) {
/* Numeric mode - show the number of seconds, unformatted. */
(void) pv_snprintf(content, sizeof(content), "%.4Lf", elapsed_seconds);
} else if (elapsed_seconds > (long double) (999999.999999L * 86400.0L)) {
/*
* At a million days, the timer would be too wide, so avoid
* an overflow.
*/
(void) pv_snprintf(content,
sizeof(content),
"%s:%02ld:%02ld:%02ld",
">=1e6",
(((long) (elapsed_seconds)) / 3600) %
24, (((long) (elapsed_seconds)) / 60) % 60, ((long) (elapsed_seconds)) % 60);
} else if (elapsed_seconds > (long double) 86400.0L) {
/*
* If the elapsed time is more than a day, include a day count as
* well as hours, minutes, and seconds.
*/
(void) pv_snprintf(content,
sizeof(content),
"%ld:%02ld:%02ld:%02ld",
((long) (elapsed_seconds)) / 86400,
(((long) (elapsed_seconds)) / 3600) %
24, (((long) (elapsed_seconds)) / 60) % 60, ((long) (elapsed_seconds)) % 60);
} else {
(void) pv_snprintf(content,
sizeof(content),
"%ld:%02ld:%02ld",
((long) (elapsed_seconds)) / 3600,
(((long) (elapsed_seconds)) / 60) % 60, ((long) (elapsed_seconds)) % 60);
}
return pv_formatter_segmentcontent(content, args);
}
+1259 -453
View File
File diff suppressed because it is too large Load Diff
+74 -39
View File
@@ -1,7 +1,7 @@
/*
* Functions for converting strings to numbers.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -17,7 +17,7 @@
* including <ctype.h> causes weird versioned glibc dependencies on certain
* Red Hat systems, complicating package management.
*/
static bool pv__isdigit(char c)
bool pv_isdigit(char c)
{
return ((c >= '0') && (c <= '9')) ? true : false;
}
@@ -29,46 +29,53 @@ static bool pv__isdigit(char c)
* a fractional part, optionally followed by a units suffix such as "K" for
* kibibytes. If "decimal_units" is true, suffixes are interpreted as
* multiples of 1000, rather than multiples of 1024.
*
* If resultptr is not NULL, it is populated with the result as a long
* double.
*/
off_t pv_getnum_size(const char *str, bool decimal_units)
off_t pv_getnum_size(const char *str, bool decimal_units, /*@null@ */ long double *resultptr)
{
off_t integral_part = 0;
off_t fractional_part = 0;
unsigned int fractional_divisor = 1;
unsigned int binary_shift = 0;
off_t decimal_multiplier = 0;
size_t readpos = 0;
if (NULL == str)
if (NULL == str) {
if (NULL != resultptr)
*resultptr = 0.0;
return (off_t) 0;
}
/* Skip any non-numeric leading characters. */
while (str[0] != '\0' && (!pv__isdigit(str[0])))
str++;
while (str[readpos] != '\0' && (!pv_isdigit(str[readpos])))
readpos++;
/*
* Parse the integral part of the number - the digits before the
* decimal mark or units.
*/
for (; pv__isdigit(str[0]); str++) {
for (; pv_isdigit(str[readpos]); readpos++) {
integral_part = integral_part * 10;
integral_part += (off_t) (str[0] - '0');
integral_part += (off_t) (str[readpos] - '0');
}
/*
* If the next character is a decimal mark, skip over it and parse
* the following digits as the fractional part of the number.
*
* Note that we hard-code the decimal mark as '.' or ',' so this
* will fail if there are any locales whose decimal mark is not one
* of those two characters.
* Note that the decimal mark is hard-coded as being either '.' or
* ',' so this will fail if there are any locales whose decimal mark
* is not one of those two characters.
*/
if (('.' == str[0]) || (',' == str[0])) {
str++;
for (; pv__isdigit(str[0]); str++) {
if (('.' == str[readpos]) || (',' == str[readpos])) {
readpos++;
for (; pv_isdigit(str[readpos]); readpos++) {
/* Stop counting below 0.0001. */
if (fractional_divisor < 10000) {
fractional_part = fractional_part * 10;
fractional_part += (off_t) (str[0] - '0');
fractional_part += (off_t) (str[readpos] - '0');
fractional_divisor = fractional_divisor * 10;
}
}
@@ -78,11 +85,11 @@ off_t pv_getnum_size(const char *str, bool decimal_units)
* Parse any units given (K=KiB=*1024, M=MiB=1024KiB, G=GiB=1024MiB,
* T=TiB=1024GiB; replace 1024 with 1000 if decimal_units is true).
*/
if (str[0] != '\0') {
if (str[readpos] != '\0') {
/* Skip any spaces or tabs after the digits. */
while ((' ' == str[0]) || ('\t' == str[0]))
str++;
switch (str[0]) {
while ((' ' == str[readpos]) || ('\t' == str[readpos]))
readpos++;
switch (str[readpos]) {
case 'k':
case 'K':
binary_shift = 10;
@@ -109,8 +116,9 @@ off_t pv_getnum_size(const char *str, bool decimal_units)
}
/*
* If decimal_units is false, zero decimal_multiplier; if true, zero
* binary_shift. This is so we only do one or the other.
* If decimal_units is true, set binary_shift to zero; if false, set
* decimal_multiplier to zero. This is so that only one of the two
* multipliers can be active.
*/
if (decimal_units) {
binary_shift = 0;
@@ -132,9 +140,8 @@ off_t pv_getnum_size(const char *str, bool decimal_units)
/*@-shiftimplementation@ */
/*
* splint note: ignore the fact that the types we are
* shifting are signed, because we know they are definitely
* not negative.
* splint note: ignore the fact that the types being shifted
* are signed, because they are definitely not negative.
*/
integral_part = (off_t) (integral_part << shiftby);
fractional_part = (off_t) (fractional_part << shiftby);
@@ -153,12 +160,22 @@ off_t pv_getnum_size(const char *str, bool decimal_units)
/*
* Add the fractional part, divided by its divisor, to the integral
* part, now that we've multiplied everything by the appropriate
* units.
* part, now that the multiplier for the units has been applied.
*/
if (NULL != resultptr) {
*resultptr = ((long double) fractional_part) / (long double) fractional_divisor;
*resultptr += (long double) integral_part;
}
fractional_part = fractional_part / fractional_divisor;
integral_part += fractional_part;
if (NULL != resultptr) {
debug("%s [%s] = %lld = %Lf", str, decimal_units ? "decimal" : "binary", (long long) integral_part,
*resultptr);
} else {
debug("%s [%s] = %lld", str, decimal_units ? "decimal" : "binary", (long long) integral_part);
}
return integral_part;
}
@@ -176,11 +193,11 @@ double pv_getnum_interval(const char *str)
return 0.0;
/* Skip any non-digit characters at the start. */
while (str[0] != '\0' && (!pv__isdigit(str[0])))
while (str[0] != '\0' && (!pv_isdigit(str[0])))
str++;
/* Parse the digits before the decimal mark. */
for (; pv__isdigit(str[0]); str++) {
for (; pv_isdigit(str[0]); str++) {
result = result * 10;
result += (double) (str[0] - '0');
}
@@ -193,7 +210,7 @@ double pv_getnum_interval(const char *str)
str++;
/* Parse the digits after the decimal mark, up to 0.0000001. */
for (; pv__isdigit(str[0]) && step < 1000000; str++) {
for (; pv_isdigit(str[0]) && step < 1000000; str++) {
step = step * 10;
result += ((double) (str[0] - '0')) / step;
}
@@ -209,7 +226,7 @@ double pv_getnum_interval(const char *str)
*/
unsigned int pv_getnum_count(const char *str, bool decimal_units)
{
return (unsigned int) pv_getnum_size(str, decimal_units);
return (unsigned int) pv_getnum_size(str, decimal_units, NULL);
}
@@ -226,38 +243,38 @@ bool pv_getnum_check(const char *str, pv_numtype type)
str++;
/* If the next character isn't a digit, this isn't a number. */
if (!pv__isdigit(str[0]))
if (!pv_isdigit(str[0]))
return false;
/* Skip over the digits. */
for (; pv__isdigit(str[0]); str++);
for (; pv_isdigit(str[0]); str++);
/*
* If there's a decimal mark (see note in pv_getnum_size() above),
* check that too.
*/
if (('.' == str[0]) || (',' == str[0])) {
/* Integers should have no decimal mark. */
if (type == PV_NUMTYPE_INTEGER)
/* Bare integers should have no decimal mark. */
if (type == PV_NUMTYPE_BARE_INTEGER)
return false;
/* Skip the decimal mark, then all digits. */
str++;
for (; pv__isdigit(str[0]); str++);
for (; pv_isdigit(str[0]); str++);
}
/* If the string ends here, this is a valid number. */
if ('\0' == str[0])
return true;
/* A units suffix is not allowed for doubles, only for integers. */
if (type == PV_NUMTYPE_DOUBLE)
/* A units suffix is only allowed for ANY_WITH_SUFFIX. */
if (type != PV_NUMTYPE_ANY_WITH_SUFFIX)
return false;
/* Skip trailing spaces or tabs. */
while ((' ' == str[0]) || ('\t' == str[0]))
str++;
/* Check the units suffix is one we know about. */
/* Check the units suffix is known. */
switch (str[0]) {
case 'k':
case 'K':
@@ -280,4 +297,22 @@ bool pv_getnum_check(const char *str, pv_numtype type)
return true;
}
/* EOF */
/*
* Return a value representing "amount" as a percentage of "total", i.e.
* 100*amount/total. If "total" is zero or less, return 0.
*/
double pv_percentage(off_t amount, const off_t total)
{
double amount_as_double;
if (total < 1)
return 0.0;
amount_as_double = (double) amount;
amount_as_double *= 100.0;
amount_as_double /= (double) total;
return amount_as_double;
}
+116
View File
@@ -0,0 +1,116 @@
/*
* Functions for setting the process title.
*
* Copyright 2024-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#if ! HAVE_SETPROCTITLE
extern char **environ;
/*@null@*/ static char **base_argv = NULL;
static size_t space_available = 0;
/*
* Assuming the environment comes after the command line arguments, make a
* duplicate of the environment array and all its values, to allow the
* process title to use the space the environment used to occupy.
*
* The logic for this was derived from util-linux-ng.
*/
/*@-mustfreefresh@ */
/*@-nullstate@ */
void initproctitle(int argc, char **argv)
{
char **original_environment = environ;
char **new_environment;
size_t env_array_size, env_index;
/* Find the number of entries in the environment array. */
for (env_array_size = 0; environ[env_array_size] != NULL; env_array_size++);
/* Allocate a new environment array. */
new_environment = (char **) malloc(sizeof(char *) * (env_array_size + 1));
if (NULL == new_environment)
return;
/* Duplicate the strings in the environment. */
for (env_index = 0; original_environment[env_index] != NULL; env_index++) {
new_environment[env_index] = pv_strdup(original_environment[env_index]);
if (NULL == new_environment[env_index])
return;
}
new_environment[env_index] = NULL;
base_argv = argv;
/* Work out how much room is available. */
if (env_index > 0) {
/* From argv[0] to the end of the last environment value. */
space_available = (size_t)
(original_environment[env_index - 1] + strlen(original_environment[env_index - 1]) - argv[0]); /* flawfinder: ignore */
} else if (argc > 0) {
/* No environment; from argv[0] to the end of the last argument. */
space_available = (size_t) (argv[argc - 1] + strlen(argv[argc - 1]) - argv[0]); /* flawfinder: ignore */
}
/*
* flawfinder - the OS is supposed to guarantee that the environment
* and argument strings are null-terminated.
*/
environ = new_environment;
}
/*@+nullstate@ */
/*@+mustfreefresh@ */
/*
* Set the process title visible to ps(1), by overwriting argv[0] with the
* given printf() format string.
*/
void setproctitle(const char *format, ...)
{
char title[1024]; /* flawfinder: ignore */
size_t length;
va_list ap;
/* flawfinder - buffer is zeroed and calls using it are bounded. */
if (NULL == base_argv)
return;
memset(title, 0, sizeof(title));
va_start(ap, format);
(void) vsnprintf(title, sizeof(title) - 1, format, ap); /* flawfinder: ignore */
va_end(ap);
/*
* flawfinder - the format is explicitly caller-supplied. Callers
* of this function are all passing fixed format strings and not
* user-supplied formats.
*/
length = strlen(title); /* flawfinder: ignore */
/* flawfinder - a byte was left at the end to force null-termination. */
if (length > space_available - 2)
length = space_available - 2;
(void) pv_snprintf(base_argv[0], space_available, "%s", title);
if (space_available > length)
memset(base_argv[0] + length, 0, space_available - length);
}
#endif
+682
View File
@@ -0,0 +1,682 @@
/*
* Remote-control and remote-query functions.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
#include "config.h"
#include "pv.h"
#include "pv-internal.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#ifdef PV_REMOTE_CONTROL
/* Structure for transferring settings with --remote. */
struct remote_msg {
bool progress; /* progress bar flag */
bool timer; /* timer flag */
bool eta; /* ETA flag */
bool fineta; /* absolute ETA flag */
bool rate; /* rate counter flag */
bool average_rate; /* average rate counter flag */
bool bytes; /* bytes transferred flag */
bool bufpercent; /* transfer buffer percentage flag */
size_t lastwritten; /* last-written bytes count */
long double rate_limit; /* rate limit, in bytes per second */
size_t buffer_size; /* buffer size, in bytes (0=default) */
off_t size; /* total size of data */
double interval; /* interval between updates */
unsigned int width; /* screen width */
unsigned int height; /* screen height */
bool width_set_manually; /* width was set manually, not detected */
bool height_set_manually; /* height was set manually, not detected */
bool rate_limit_specified; /* whether a rate limit value was set */
bool rate_limit_active; /* whether rate limiting is in effect (>0) */
char name[256]; /* flawfinder: ignore */
char format[256]; /* flawfinder: ignore */
char extra_display[256]; /* flawfinder: ignore */
};
/* Structure for transferring transfer state with --query. */
struct query_msg {
long double elapsed_seconds; /* from state.transfer */
off_t transferred; /* from state.transfer */
off_t size; /* from state.control */
bool response; /* true if this is the response signal. */
};
/*
* flawfinder rationale: name, format, and extra_display are always
* explicitly zeroed and bounded to one less than their size so they are
* always \0 terminated.
*/
/*
* Set the options of a remote process by writing them to a file, sending a
* signal to the receiving process, and waiting for the message to be
* consumed by the remote process.
*
* Returns nonzero on error.
*/
int pv_remote_set(pvstate_t state, pid_t remote)
{
char control_filename[4096]; /* flawfinder: ignore */
FILE *control_fptr;
struct remote_msg msgbuf;
pid_t signal_sender;
long timeout;
bool received;
/*
* flawfinder rationale: buffer is large enough, explicitly zeroed,
* and always bounded properly as we are only writing to it with
* pv_snprintf().
*/
/*
* Check that the remote process exists.
*/
if (kill((pid_t) (remote), 0) != 0) {
pv_perror("%s %u", _("pid"), remote);
return PV_ERROREXIT_REMOTE_OR_PID;
}
/*
* Copy parameters into message buffer.
*/
memset(&msgbuf, 0, sizeof(msgbuf));
msgbuf.progress = state->control.format_option.progress;
msgbuf.timer = state->control.format_option.timer;
msgbuf.eta = state->control.format_option.eta;
msgbuf.fineta = state->control.format_option.fineta;
msgbuf.rate = state->control.format_option.rate;
msgbuf.average_rate = state->control.format_option.average_rate;
msgbuf.bytes = state->control.format_option.bytes;
msgbuf.bufpercent = state->control.format_option.bufpercent;
msgbuf.lastwritten = state->control.format_option.lastwritten;
msgbuf.rate_limit = state->control.rate_limit;
msgbuf.rate_limit_specified = state->control.rate_limit_specified;
msgbuf.rate_limit_active = state->control.rate_limit_active;
msgbuf.buffer_size = state->control.target_buffer_size;
msgbuf.size = state->control.size;
msgbuf.interval = state->control.interval;
msgbuf.width = (unsigned int) (state->control.width);
msgbuf.height = (unsigned int) (state->control.height);
msgbuf.width_set_manually = state->control.width_set_manually;
msgbuf.height_set_manually = state->control.height_set_manually;
if (state->control.name != NULL) {
strncpy(msgbuf.name, state->control.name, sizeof(msgbuf.name) - 1); /* flawfinder: ignore */
}
if (state->control.format_string != NULL) {
strncpy(msgbuf.format, state->control.format_string, sizeof(msgbuf.format) - 1); /* flawfinder: ignore */
}
if (state->control.extra_display_spec != NULL) {
strncpy(msgbuf.extra_display, state->control.extra_display_spec, sizeof(msgbuf.extra_display) - 1); /* flawfinder: ignore */
}
/*
* Make sure parameters are within sensible bounds.
*/
if (msgbuf.width < 1)
msgbuf.width = 80;
if (msgbuf.height < 1)
msgbuf.height = 25;
if (msgbuf.width > 999999)
msgbuf.width = 999999;
if (msgbuf.height > 999999)
msgbuf.height = 999999;
if ((msgbuf.interval > 0) && (msgbuf.interval < 0.1))
msgbuf.interval = 0.1;
if (msgbuf.interval > 600)
msgbuf.interval = 600;
/*
* flawfinder rationale: name, format, and extra_display are
* explicitly bounded to 1 less than the size of their buffer and
* the buffer is \0 terminated by memset() earlier.
*/
/*
* Get the filename and file stream to use for remote control.
*/
memset(control_filename, 0, sizeof(control_filename));
control_fptr = pv_open_controlfile(control_filename, sizeof(control_filename), (pid_t) getpid(), SIGUSR2, true);
if (NULL == control_fptr) {
pv_perror("%s", control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
/*
* Write the message buffer to the remote control file, and close
* it.
*/
if (1 != fwrite(&msgbuf, sizeof(msgbuf), 1, control_fptr)) {
pv_perror("%s", control_filename);
(void) fclose(control_fptr);
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
if (0 != fclose(control_fptr)) {
pv_perror("%s", control_filename);
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
/*
* Clear this process's "SIGUSR2 received" flag, and then send a
* SIGUSR2 signal to the remote process, to tell it a message is
* ready to read.
*/
signal_sender = 0;
(void) pv_sigusr2_received(state, &signal_sender);
if (kill((pid_t) (remote), SIGUSR2) != 0) {
pv_perror("%s %u", _("pid"), remote);
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
debug("%s", "message sent");
/*
* Wait for a signal from the remote process to say it has received
* the message.
*/
timeout = 1100000;
received = false;
while (timeout > 10000 && !received) {
struct timeval tv;
memset(&tv, 0, sizeof(tv));
tv.tv_sec = 0;
tv.tv_usec = 10000;
/*@-nullpass@ *//* splint: NULL is OK with select() */
(void) select(0, NULL, NULL, NULL, &tv);
/*@+nullpass@ */
timeout -= 10000;
if (pv_sigusr2_received(state, &signal_sender)) {
if (signal_sender == remote) {
debug("%s", "message received");
received = true;
}
}
}
/*
* Remove the remote control file.
*/
debug("%s: %s", "removing", control_filename);
if (0 != remove(control_filename)) {
pv_perror("%s", control_filename);
}
/*
* Return 0 if the message was received.
*/
if (received)
return 0;
/*@-mustfreefresh@ */
/*
* splint note: the gettext calls made by _() cause memory leak
* warnings, but in this case it's unavoidable, and mitigated by the
* fact that each string is only translated once.
*/
pv_error("%u: %s", remote, _("message not received"));
return PV_ERROREXIT_REMOTE_OR_PID;
/*@+mustfreefresh @ */
}
/*
* Check for a --remote message (SIGUSR2), returning false if none was
* found.
*
* If a message was received, update the current process's options with the
* ones in the message.
*
* Note that this relies on pv_state_set_format_options() causing the output
* format to be reparsed.
*/
static bool pv__rxsignal_usr2(pvstate_t state)
{
pid_t signal_sender;
char control_filename[4096]; /* flawfinder: ignore */
FILE *control_fptr;
struct remote_msg msgbuf;
pvformatoptions_s format_options;
/* flawfinder rationale: as above. */
/*
* Return early if a SIGUSR2 signal has not been received.
*/
signal_sender = 0;
if (!pv_sigusr2_received(state, &signal_sender))
return false;
memset(control_filename, 0, sizeof(control_filename));
control_fptr = pv_open_controlfile(control_filename, sizeof(control_filename), signal_sender, SIGUSR2, false);
if (NULL == control_fptr) {
pv_perror("%s", control_filename);
return false;
}
/*
* Read the message buffer from the remote control file, and close
* it.
*/
if (1 != fread(&msgbuf, sizeof(msgbuf), 1, control_fptr)) {
pv_perror("%s", control_filename);
(void) fclose(control_fptr);
return false;
}
if (0 != fclose(control_fptr)) {
pv_perror("%s", control_filename);
return false;
}
/*
* Send a SIGUSR2 signal to the sending process, to tell it the
* message has been received.
*/
if (kill(signal_sender, SIGUSR2) != 0) {
debug("%u: %s", signal_sender, strerror(errno));
}
debug("%s", "received remote control message");
pv_state_format_string_set(state, NULL);
pv_state_name_set(state, NULL);
pv_state_extra_display_set(state, NULL);
msgbuf.name[sizeof(msgbuf.name) - 1] = '\0';
msgbuf.format[sizeof(msgbuf.format) - 1] = '\0';
msgbuf.extra_display[sizeof(msgbuf.extra_display) - 1] = '\0';
pv_state_name_set(state, '\0' == msgbuf.name[0] ? NULL : msgbuf.name);
format_options.progress = msgbuf.progress;
format_options.timer = msgbuf.timer;
format_options.eta = msgbuf.eta;
format_options.fineta = msgbuf.fineta;
format_options.rate = msgbuf.rate;
format_options.average_rate = msgbuf.average_rate;
format_options.bytes = msgbuf.bytes;
format_options.bufpercent = msgbuf.bufpercent;
format_options.lastwritten = msgbuf.lastwritten;
pv_state_set_format_options(state, format_options);
if (msgbuf.rate_limit_specified)
pv_state_rate_limit_set(state, msgbuf.rate_limit, msgbuf.rate_limit_specified,
msgbuf.rate_limit_active);
if (msgbuf.buffer_size > 0) {
pv_state_target_buffer_size_set(state, msgbuf.buffer_size);
}
if (msgbuf.size > 0)
pv_state_size_set(state, msgbuf.size);
if (msgbuf.interval > 0)
pv_state_interval_set(state, msgbuf.interval);
if (msgbuf.width > 0 && msgbuf.width_set_manually)
pv_state_width_set(state, msgbuf.width, msgbuf.width_set_manually);
if (msgbuf.height > 0 && msgbuf.height_set_manually)
pv_state_height_set(state, msgbuf.height, msgbuf.height_set_manually);
if (msgbuf.format[0] != '\0')
pv_state_format_string_set(state, msgbuf.format);
if (msgbuf.extra_display[0] != '\0')
pv_state_extra_display_set(state, msgbuf.extra_display);
return true;
}
/*
* Check for a --query message (SIGUSR1).
*
* If a type 0 message was received (query), then write a type 1 message
* (response) to the control file and send a SIGUSR1 to the sending process.
*
* If a type 1 message was received (response), update the state from the
* message in the control file.
*
* In both cases, the receiver of the message deletes its control file.
*
* The state transferred by message is transfer.elapsed_seconds,
* transfer.transferred, and control.size.
*
* Returns true if a signal was received and dealt with, false otherwise.
*
* If match_sender is not zero, then ignores the signal and returns false if
* the sending PID is not match_sender.
*/
static bool pv__rxsignal_usr1(pvstate_t state, pid_t match_sender)
{
pid_t signal_sender;
char control_filename[4096]; /* flawfinder: ignore */
FILE *control_fptr;
struct query_msg msgbuf;
/* flawfinder rationale: as above. */
/*
* Return early if a SIGUSR1 signal has not been received.
*/
signal_sender = 0;
if (!pv_sigusr1_received(state, &signal_sender))
return false;
/*
* If match_sender was specified, ignore the signal if the sender
* doesn't match.
*/
if ((0 != match_sender) && (signal_sender != match_sender)) {
debug("%s=%d, %s=%d - %s", "match_sender", match_sender, "signal_sender", signal_sender,
"ignoring USR1");
return false;
}
/*
* Note that errors are only reported with debug() rather than
* pv_error() here so that the display of a running pv doesn't get
* interrupted by, for example, a querying pv being terminated.
*/
memset(control_filename, 0, sizeof(control_filename));
control_fptr = pv_open_controlfile(control_filename, sizeof(control_filename), signal_sender, SIGUSR1, false);
if (NULL == control_fptr) {
debug("%s: %s", control_filename, strerror(errno));
return false;
}
/*
* Read the message buffer from the remote control file, close it,
* and delete it.
*/
if (1 != fread(&msgbuf, sizeof(msgbuf), 1, control_fptr)) {
debug("fread: %s", strerror(errno));
(void) fclose(control_fptr);
return false;
}
if (0 != fclose(control_fptr)) {
debug("fclose: %s", strerror(errno));
return false;
}
debug("%s: %s", "removing", control_filename);
if (0 != remove(control_filename)) {
debug("remove: %s", strerror(errno));
return false;
}
if (msgbuf.response) {
/* Response message - update local state. */
debug("%s: %d [%Lg, %ld, %ld]", "query response received", signal_sender, msgbuf.elapsed_seconds,
msgbuf.transferred, msgbuf.size);
state->transfer.elapsed_seconds = msgbuf.elapsed_seconds;
state->transfer.transferred = msgbuf.transferred;
state->control.size = msgbuf.size;
return true;
}
/* Query message - transmit state to sender. */
debug("%s: %d", "query received", signal_sender);
msgbuf.elapsed_seconds = state->transfer.elapsed_seconds;
msgbuf.transferred = state->transfer.transferred;
msgbuf.size = state->control.size;
msgbuf.response = true;
memset(control_filename, 0, sizeof(control_filename));
control_fptr = pv_open_controlfile(control_filename, sizeof(control_filename), (pid_t) getpid(), SIGUSR1, true);
if (NULL == control_fptr) {
debug("%s", strerror(errno));
return true; /* true since the signal was received. */
}
if (1 != fwrite(&msgbuf, sizeof(msgbuf), 1, control_fptr)) {
debug("fwrite: %s", strerror(errno));
(void) fclose(control_fptr);
(void) remove(control_filename);
return true; /* as above. */
}
if (0 != fclose(control_fptr)) {
debug("fclose: %s", strerror(errno));
(void) remove(control_filename);
return true;
}
/*
* Send a SIGUSR1 signal to the remote process, to tell it this
* query response message is ready to read.
*/
if (kill((pid_t) (signal_sender), SIGUSR1) != 0) {
debug("%u: %s", signal_sender, strerror(errno));
(void) remove(control_filename);
return true;
}
debug("%s: %d", "query response sent", signal_sender);
return true;
}
/*
* Check for remote control messages. For a SIGUSR2 (--remote), replace the
* current process's options with those being passed in. For a SIGUSR1
* (--query), either receive transfer state from the sending process, or
* send the current transfer state to the sending process, depending on the
* content of the message.
*
* NB --remote relies on pv_state_set_format_options() causing the output
* format to be reparsed.
*
* Returns true if a --remote message was received, false otherwise.
*/
bool pv_remote_check(pvstate_t state)
{
bool received_remote;
received_remote = pv__rxsignal_usr2(state);
(void) pv__rxsignal_usr1(state, 0);
return received_remote;
}
/*
* Replace the transfer state with that of the given process, including the
* total transfer size. If sizeptr is not NULL, the size is also copied to
* *sizeptr (this is so a caller can get the size without knowing the
* structure of pvstate_t).
*
* Returns nonzero on error. If "silent" is false, reports the error.
*/
int pv_remote_transferstate_fetch(pvstate_t state, pid_t query, /*@null@ */ off_t *sizeptr, bool silent)
{
char control_filename[4096]; /* flawfinder: ignore */
FILE *control_fptr;
struct query_msg msgbuf;
pid_t signal_sender;
long timeout;
bool received;
/*
* flawfinder rationale: buffer is large enough, explicitly zeroed,
* and always bounded properly, as only pv_snprintf() writes to it.
*/
/*
* Check that the remote process exists.
*/
if (kill((pid_t) (query), 0) != 0) {
if (!silent)
pv_perror("%s %u", _("pid"), query);
return PV_ERROREXIT_REMOTE_OR_PID;
}
/* Set up the query message. */
memset(&msgbuf, 0, sizeof(msgbuf));
msgbuf.response = false;
/*
* Get the filename and file stream to use.
*/
memset(control_filename, 0, sizeof(control_filename));
control_fptr = pv_open_controlfile(control_filename, sizeof(control_filename), (pid_t) getpid(), SIGUSR1, true);
if (NULL == control_fptr) {
if (!silent)
pv_perror("%s", control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
/*
* Write the message to the control file, and close it.
*/
if (1 != fwrite(&msgbuf, sizeof(msgbuf), 1, control_fptr)) {
if (!silent)
pv_perror("%s", control_filename);
(void) fclose(control_fptr);
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
if (0 != fclose(control_fptr)) {
if (!silent)
pv_perror("%s", control_filename);
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
/*
* Clear this process's "SIGUSR1 received" flag and send a SIGUSR1
* signal to the remote process, to tell it a query message is
* ready.
*/
signal_sender = 0;
(void) pv_sigusr1_received(state, &signal_sender);
if (kill((pid_t) (query), SIGUSR1) != 0) {
if (!silent)
pv_perror("%s %u", _("pid"), query);
(void) remove(control_filename);
return PV_ERROREXIT_REMOTE_OR_PID;
}
debug("%s: %d", "query sent", query);
/*
* Wait for a SIGUSR1 signal to be sent back with a query response
* message.
*/
timeout = 1100000;
received = false;
while (timeout > 10000 && !received && 0 == state->flags.trigger_exit) {
struct timeval tv;
memset(&tv, 0, sizeof(tv));
tv.tv_sec = 0;
tv.tv_usec = 10000;
/*@-nullpass@ *//* splint: NULL is OK with select() */
(void) select(0, NULL, NULL, NULL, &tv);
/*@+nullpass@ */
timeout -= 10000;
if (pv__rxsignal_usr1(state, query)) {
debug("%s", "response received");
received = true;
if (NULL != sizeptr)
*sizeptr = state->control.size;
}
}
/*
* Remove the control file in case it still exists - the other
* process should have removed it.
*/
debug("%s: %s", "cleaning up", control_filename);
(void) remove(control_filename);
/*
* Return 0 if the message was received.
*/
if (received)
return 0;
/*@-mustfreefresh@ */
/*
* splint note: the gettext calls made by _() cause memory leak
* warnings, but in this case it's unavoidable, and mitigated by the
* fact that each string is only translated once.
*/
if (!silent)
pv_error("%u: %s", query, _("message not received"));
return PV_ERROREXIT_REMOTE_OR_PID;
/*@+mustfreefresh @ */
}
#else /* !PV_REMOTE_CONTROL */
/*
* Dummy stubs for remote control when PV_REMOTE_CONTROL is not set.
*/
bool pv_remote_check( /*@unused@ */ __attribute__((unused)) pvstate_t state)
{
return false;
}
int pv_remote_set( /*@unused@ */
__attribute__((unused)) pvstate_t state, /*@unused@ */ __attribute__((unused)) pid_t remote)
{
/*@-mustfreefresh@ *//* splint - see above */
pv_error("%s", _("SA_SIGINFO not supported on this system"));
/*@+mustfreefresh@ */
return PV_ERROREXIT_REMOTE_OR_PID;
}
int pv_remote_transferstate_fetch( /*@unused@ */
__attribute__((unused)) pvstate_t state,
/*@unused@ */
__attribute__((unused)) pid_t query,
/*@null@ */
/*@unused@ */
__attribute__((unused)) off_t *sizeptr,
/*@unused@ */
__attribute__((unused))
bool silent)
{
/*@-mustfreefresh@ *//* splint - see above */
pv_error("%s", _("SA_SIGINFO not supported on this system"));
/*@+mustfreefresh@ */
return PV_ERROREXIT_REMOTE_OR_PID;
}
#endif /* PV_REMOTE_CONTROL */
+345 -154
View File
@@ -1,7 +1,7 @@
/*
* Signal handling functions.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -19,16 +19,21 @@
#include <fcntl.h>
#ifdef HAVE_IPC
void pv_crs_needreinit(pvstate_t);
void pv_crs_needreinit(pvcursorstate_t);
#endif
/*@null@*/ static pvstate_t pv_sig_state = NULL;
/*
* Ensure that terminal attribute TOSTOP is set. If we have to set it,
* record that fact by setting the state boolean "pv_tty_tostop_added" to
* true, so that in pv_sig_fini() we can turn it back off again.
* Check whether the terminal attribute TOSTOP is set. If it is not, set
* it, and record that fact by setting "clear_tty_tostop_on_exit" to true,
* so that pv_sig_fini() knows to clear it again.
*
* In "-c" mode with IPC, that flag is propagated to other PV instances via
* the shared "tty_tostop_added" flag, so those instances can set their own
* on-exit flag, meaning that if any of the PV instances set it, the last
* one to exit will clear it.
*/
static void pv_sig_ensure_tty_tostop()
{
@@ -37,71 +42,127 @@ static void pv_sig_ensure_tty_tostop()
if (NULL == pv_sig_state)
return;
/* Can't look at terminal flags if backgrounded. */
if (1 == pv_sig_state->flags.suspend_stderr)
return;
if (0 != tcgetattr(STDERR_FILENO, &terminal_attributes)) {
debug("%s: %s", "failed to read terminal attributes", strerror(errno));
return;
}
/* Can't set terminal flags if backgrounded. */
if (1 == pv_sig_state->flags.suspend_stderr)
return;
if (0 == (terminal_attributes.c_lflag & TOSTOP)) {
terminal_attributes.c_lflag |= TOSTOP;
if (0 == tcsetattr(STDERR_FILENO, TCSANOW, &terminal_attributes)) {
pv_sig_state->signal.pv_tty_tostop_added = true;
pv_sig_state->flags.clear_tty_tostop_on_exit = 1;
debug("%s", "set terminal TOSTOP attribute");
#if HAVE_IPC
/*
* In "-c" mode with IPC, make all "pv -c" instances
* aware that we set TOSTOP, so the last one can
* clear it on exit.
*/
if (pv_sig_state->control.cursor && (NULL != pv_sig_state->cursor.shared)
&& (!pv_sig_state->cursor.noipc)) {
pv_sig_state->cursor.shared->tty_tostop_added = true;
}
#endif
} else {
debug("%s: %s", "failed to set terminal TOSTOP attribute", strerror(errno));
}
#if HAVE_IPC
/*
* In "-c" mode with IPC, make all "pv -c" instances aware
* that we set TOSTOP, so the last one can clear it on exit.
*/
if (pv_sig_state->control.cursor && (NULL != pv_sig_state->cursor.shared)
&& (!pv_sig_state->cursor.noipc)) {
pv_sig_state->cursor.shared->tty_tostop_added = true;
}
#endif
}
}
#ifdef ECHOCTL
/*
* Handle SIGTTOU (tty output for background process) by redirecting stderr
* to /dev/null, so that we can be stopped and backgrounded without messing
* up the terminal. We store the old stderr file descriptor so that on a
* subsequent SIGCONT we can try writing to the terminal again, in case we
* get backgrounded and later get foregrounded again.
* Check whether the terminal attribute ECHOCTL is set. If it is, clear it,
* and record that fact by setting "set_tty_echoctl_on_exit" to true, so
* that pv_sig_fini() knows to clear it again.
*
* In "-c" mode with IPC, that flag is propagated to other PV instances via
* the shared "tty_echoctl_cleared" flag, so those instances can set their
* own on-exit flag, meaning that if any of the PV instances clear it, the
* last one to exit will set it.
*/
static void pv_sig_ttou( /*@unused@ */ __attribute__((unused))
int s)
static void pv_sig_ensure_tty_noechoctl()
{
int fd;
struct termios terminal_attributes;
if (NULL == pv_sig_state)
return;
fd = open("/dev/null", O_RDWR); /* flawfinder: ignore */
if (fd < 0) {
debug("%s: %s", "failed to open /dev/null", strerror(errno));
/* Can't look at terminal flags if backgrounded. */
if (1 == pv_sig_state->flags.suspend_stderr)
return;
if (0 != tcgetattr(STDERR_FILENO, &terminal_attributes)) {
debug("%s: %s", "failed to read terminal attributes", strerror(errno));
return;
}
/*
* flawfinder rationale: not checking for symlinks because this is
* explicitly a device file under /dev so we assume it is safe to
* open.
*
* TODO: look at just preventing stderr output instead of writing to
* stderr while backgrounded.
*/
/* Can't set terminal flags if backgrounded. */
if (1 == pv_sig_state->flags.suspend_stderr)
return;
if (-1 == pv_sig_state->signal.old_stderr)
pv_sig_state->signal.old_stderr = dup(STDERR_FILENO);
if (dup2(fd, STDERR_FILENO) < 0) {
debug("%s: %s", "failed to replace stderr", strerror(errno));
if (0 != (terminal_attributes.c_lflag & ECHOCTL)) {
terminal_attributes.c_lflag -= ECHOCTL;
if (0 == tcsetattr(STDERR_FILENO, TCSANOW, &terminal_attributes)) {
pv_sig_state->flags.set_tty_echoctl_on_exit = 1;
debug("%s", "cleared terminal ECHOCTL attribute");
#if HAVE_IPC
/*
* In "-c" mode with IPC, make all "pv -c" instances
* aware that ECHOCTL was cleared, so the last one
* can set it on exit.
*/
if (pv_sig_state->control.cursor && (NULL != pv_sig_state->cursor.shared)
&& (!pv_sig_state->cursor.noipc)) {
pv_sig_state->cursor.shared->tty_echoctl_cleared = true;
}
#endif
} else {
debug("%s: %s", "failed to clear terminal ECHOCTL attribute", strerror(errno));
}
}
}
#endif /* ECHOCTL */
if (0 != close(fd)) {
debug("%s: %s", "failed to close /dev/null", strerror(errno));
/*
* Handle SIGTTOU (tty output for background process) by setting the flag to
* suspend writes to stderr, to stop the terminal being interfered with when
* pv is stopped and put into the background. On a subsequent SIGCONT, pv
* will try writing to the terminal again, in case it was put into the
* background and later put into the foreground again.
*
* When a SIGTTOU is raised, the rest of the pipeline gets stopped too, so
* transfers involving pipelines need pv to send a SIGCONT to the rest of
* the process group here, otherwise backgrounding stops transfers involving
* pipes.
*/
static void pv_sig_ttou( /*@unused@ */ __attribute__((unused))
int s)
{
if (NULL == pv_sig_state)
return;
if (1 != pv_sig_state->flags.suspend_stderr) {
debug("%s", "SIGTTOU - suspending stderr");
pv_sig_state->flags.suspend_stderr = 1;
/* Also tell the SIGCONT handler to do nothing next time. */
pv_sig_state->flags.skip_next_sigcont++;
/* Raise an immediate SIGCONT to bring the rest of the pipeline back up. */
/*@-unrecog@ *//* splint doesn't know about killpg() */
if (0 != killpg(getpgrp(), SIGCONT)) {
debug("%s: %s", "killpg", strerror(errno));
}
/*@+unrecog@ */
} else {
debug("%s", "SIGTTOU - but stderr was already suspended");
}
}
@@ -115,7 +176,7 @@ static void pv_sig_tstp( /*@unused@ */ __attribute__((unused))
{
if (NULL == pv_sig_state)
return;
pv_elapsedtime_read(&(pv_sig_state->signal.tstp_time));
pv_elapsedtime_read(&(pv_sig_state->signal.when_tstp_arrived));
if (0 != raise(SIGSTOP)) {
debug("%s: %s", "raise", strerror(errno));
}
@@ -125,7 +186,7 @@ static void pv_sig_tstp( /*@unused@ */ __attribute__((unused))
/*
* Handle SIGCONT (continue if stopped) by adding the elapsed time since the
* 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).
* terminal again.
*/
static void pv_sig_cont( /*@unused@ */ __attribute__((unused))
int s)
@@ -136,48 +197,91 @@ static void pv_sig_cont( /*@unused@ */ __attribute__((unused))
if (NULL == pv_sig_state)
return;
pv_sig_state->flag.terminal_resized = 1;
if (pv_sig_state->flags.skip_next_sigcont > 0) {
debug("%s: %d", "SIGCONT received but ignored - current value of skip_next_sigcont",
pv_sig_state->flags.skip_next_sigcont);
pv_sig_state->flags.skip_next_sigcont--;
return;
} else if (pv_sig_state->flags.skip_next_sigcont < 0) {
pv_sig_state->flags.skip_next_sigcont = 0;
debug("%s", "skip_next_sigcont underrun cleared");
}
debug("%s: %d", "SIGCONT received - current value of suspend_stderr", pv_sig_state->flags.suspend_stderr);
pv_sig_state->flags.terminal_resized = 1;
/*
* We can only make the time adjustments if this SIGCONT followed a
* SIGTSTP such that we have a stop time.
* Time adjustments can only be made if this SIGCONT followed a
* SIGTSTP, such that there is a stop-time to measure from.
*/
if (0 != pv_sig_state->signal.tstp_time.tv_sec) {
if (0 != pv_sig_state->signal.when_tstp_arrived.tv_sec) {
memset(&current_time, 0, sizeof(current_time));
memset(&time_spent_stopped, 0, sizeof(time_spent_stopped));
pv_elapsedtime_read(&current_time);
/* time spent stopped = current time - time SIGTSTP received */
pv_elapsedtime_subtract(&time_spent_stopped, &current_time, &(pv_sig_state->signal.tstp_time));
/* time spent stopped = current time - time SIGTSTP received. */
pv_elapsedtime_subtract(&time_spent_stopped, &current_time, &(pv_sig_state->signal.when_tstp_arrived));
/* add time spent stopped the total stopped-time count */
pv_elapsedtime_add(&(pv_sig_state->signal.toffset), &(pv_sig_state->signal.toffset),
&time_spent_stopped);
/* add time spent stopped to the total stopped-time count. */
pv_elapsedtime_add(&(pv_sig_state->signal.total_stoppage_time),
&(pv_sig_state->signal.total_stoppage_time), &time_spent_stopped);
/* reset the SIGTSTP receipt time */
pv_elapsedtime_zero(&(pv_sig_state->signal.tstp_time));
/* In watchfd mode, update the stoppage time of all watched fds. */
if (pv_sig_state->watchfd.count > 0 && NULL != pv_sig_state->watchfd.watching) {
unsigned int watch_idx;
for (watch_idx = 0; watch_idx < pv_sig_state->watchfd.count; watch_idx++) {
int info_idx;
if (pv_sig_state->watchfd.watching[watch_idx].finished)
continue;
if (NULL == pv_sig_state->watchfd.watching[watch_idx].info_array)
continue;
for (info_idx = 0; info_idx < pv_sig_state->watchfd.watching[watch_idx].array_length;
info_idx++) {
pvwatchfd_t info_item =
&(pv_sig_state->watchfd.watching[watch_idx].info_array[info_idx]);
if (info_item->unused)
continue;
if (!info_item->displayable)
continue;
pv_elapsedtime_add(&(info_item->total_stoppage_time),
&(info_item->total_stoppage_time), &time_spent_stopped);
}
}
}
/* reset the SIGTSTP receipt time. */
pv_elapsedtime_zero(&(pv_sig_state->signal.when_tstp_arrived));
}
/*
* Restore the old stderr, if we had replaced it.
* Try resuming the use of stderr, if it had been suspended, but
* only if pv is now in the foreground.
*/
if (pv_sig_state->signal.old_stderr != -1) {
if (dup2(pv_sig_state->signal.old_stderr, STDERR_FILENO) < 0) {
debug("%s: %s", "failed to restore old stderr", strerror(errno));
if (1 == pv_sig_state->flags.suspend_stderr) {
if (pv_in_foreground()) {
debug("%s", "SIGCONT - resuming stderr");
pv_sig_state->flags.suspend_stderr = 0;
} else {
debug("%s", "SIGCONT but still in background - not resuming stderr");
}
if (0 != close(pv_sig_state->signal.old_stderr)) {
debug("%s: %s", "failed to close duplicate old stderr", strerror(errno));
}
pv_sig_state->signal.old_stderr = -1;
}
pv_sig_ensure_tty_tostop();
if (0 == pv_sig_state->flags.suspend_stderr) {
pv_sig_ensure_tty_tostop();
#ifdef HAVE_IPC
pv_crs_needreinit(pv_sig_state);
pv_crs_needreinit(&(pv_sig_state->cursor));
#endif
}
}
@@ -190,38 +294,39 @@ static void pv_sig_winch( /*@unused@ */ __attribute__((unused))
{
if (NULL == pv_sig_state)
return;
pv_sig_state->flag.terminal_resized = 1;
pv_sig_state->flags.terminal_resized = 1;
}
#endif
/*
* Handle termination signals by setting the abort flag.
* Handle termination signals by recording which one was received, and then
* setting the abort flag.
*/
static void pv_sig_term( /*@unused@ */ __attribute__((unused))
int s)
static void pv_sig_term(int s)
{
if (NULL == pv_sig_state)
return;
pv_sig_state->flag.trigger_exit = 1;
pv_sig_state->flags.terminating_signal = (sig_atomic_t) s;
pv_sig_state->flags.trigger_exit = 1;
}
#ifdef SA_SIGINFO
#ifdef PV_REMOTE_CONTROL
/*
* Handle a SIGUSR2 by setting a flag to say we received it, after recording
* the sending PID.
* Handle a SIGUSR2 by recording the PID that sent it, and setting a flag to
* say it was received.
*/
static void pv_sig_usr2( /*@unused@ */ __attribute__((unused))
int sig, siginfo_t * info, /*@unused@ */ __attribute__((unused))
int sig, siginfo_t *info, /*@unused@ */ __attribute__((unused))
void *ucontext)
{
if (NULL == pv_sig_state)
return;
if (NULL == info)
return;
pv_sig_state->signal.sender_usr2 = info->si_pid;
pv_sig_state->signal.rxusr2 = 1;
pv_sig_state->signal.sender = info->si_pid;
}
@@ -229,28 +334,62 @@ static void pv_sig_usr2( /*@unused@ */ __attribute__((unused))
* Return true if a SIGUSR2 signal has been received since the last time
* this function was called, populating *pid with the sending PID if so.
*/
bool pv_sigusr2_received(pvstate_t state, pid_t * pid)
bool pv_sigusr2_received(pvstate_t state, pid_t *pid)
{
if (NULL == state)
return false;
if (0 == state->signal.rxusr2)
return false;
if (NULL != pid)
*pid = state->signal.sender;
*pid = state->signal.sender_usr2;
state->signal.rxusr2 = 0;
return true;
}
#endif
/*
* Handle a SIGUSR1 by recording the PID that sent it, and setting a flag to
* say it was received.
*/
static void pv_sig_usr1( /*@unused@ */ __attribute__((unused))
int sig, siginfo_t *info, /*@unused@ */ __attribute__((unused))
void *ucontext)
{
if (NULL == pv_sig_state)
return;
if (NULL == info)
return;
pv_sig_state->signal.sender_usr1 = info->si_pid;
pv_sig_state->signal.rxusr1 = 1;
}
/*
* Return true if a SIGUSR1 signal has been received since the last time
* this function was called, populating *pid with the sending PID if so.
*/
bool pv_sigusr1_received(pvstate_t state, pid_t *pid)
{
if (NULL == state)
return false;
if (0 == state->signal.rxusr1)
return false;
if (NULL != pid)
*pid = state->signal.sender_usr1;
state->signal.rxusr1 = 0;
return true;
}
#endif /* PV_REMOTE_CONTROL */
/*
* Handle alarm signals by doing nothing.
*
* Note that we have to use a signal handler like this, instead of using
* SIG_IGN, because if we ignore the signal entirely, it does nothing,
* including not interrupting blocking write() calls - which is what we're
* using alarm signals for in the first place.
* An empty signal handler is used, instead of SIG_IGN, because ignoring the
* signal with SIG_IGN prevents it from doing anything at all - meaning it
* would not interrupt blocking write() calls, which is what pv uses alarm
* signals for.
*/
static void pv_sig_alrm( /*@unused@ */ __attribute__((unused))
int s)
@@ -270,27 +409,27 @@ void pv_sig_init(pvstate_t state)
memset(&sa, 0, sizeof(sa));
/*
* Note that wherever we use a "struct sigaction", we declare it
* static and explicitly zero it before use, because it may contain
* deeper structures (e.g. "sigset_t") which trigger splint
* warnings about potential memory leaks.
* Wherever a "struct sigaction" is used, it is declared static and
* explicitly zeroed before use, because it may contain deeper
* structures (e.g. "sigset_t") which trigger splint warnings about
* potential memory leaks.
*/
pv_sig_state = state;
pv_sig_state->signal.old_stderr = -1;
pv_elapsedtime_zero(&(pv_sig_state->signal.tstp_time));
pv_elapsedtime_zero(&(pv_sig_state->signal.toffset));
pv_sig_state->flags.suspend_stderr = 0;
pv_elapsedtime_zero(&(pv_sig_state->signal.when_tstp_arrived));
pv_elapsedtime_zero(&(pv_sig_state->signal.total_stoppage_time));
/*
* Note that we cast all sigemptyset() and sigaction() return values
* to void, because there's nothing we can reasonably do about any
* conceivable error they may return.
* All sigemptyset() and sigaction() return values are ignored, as
* there is no reasonable action to take about any error they
* return.
*/
/*
* Ignore SIGPIPE, so we don't die if stdout is a pipe and the other
* end closes unexpectedly.
* Ignore SIGPIPE, in case the output is a pipe and the other end
* closes unexpectedly.
*/
sa.sa_handler = SIG_IGN;
(void) sigemptyset(&(sa.sa_mask));
@@ -298,9 +437,11 @@ void pv_sig_init(pvstate_t state)
(void) sigaction(SIGPIPE, &sa, &(pv_sig_state->signal.old_sigpipe));
/*
* Handle SIGTTOU by continuing with output switched off, so that we
* can be stopped and backgrounded without messing up the terminal.
* Handle SIGTTOU by continuing with the display switched off, to
* allow pv to be stopped and backgrounded without messing up the
* terminal.
*/
pv_sig_state->flags.skip_next_sigcont = 0;
sa.sa_handler = pv_sig_ttou;
(void) sigemptyset(&(sa.sa_mask));
sa.sa_flags = 0;
@@ -355,7 +496,7 @@ void pv_sig_init(pvstate_t state)
sa.sa_flags = 0;
(void) sigaction(SIGTERM, &sa, &(pv_sig_state->signal.old_sigterm));
#ifdef SA_SIGINFO
#ifdef PV_REMOTE_CONTROL
/*
* Handle SIGUSR2 by setting a flag to say the signal has been
* received, and storing the sending process's PID.
@@ -368,17 +509,35 @@ void pv_sig_init(pvstate_t state)
/*@+unrecog@ */
(void) sigaction(SIGUSR2, &sa, &(pv_sig_state->signal.old_sigusr2));
memset(&sa, 0, sizeof(sa));
#endif
/*
* Handle SIGUSR1 by setting a flag to say the signal has been
* received, and storing the sending process's PID.
*/
memset(&sa, 0, sizeof(sa));
sa.sa_sigaction = pv_sig_usr1;
(void) sigemptyset(&(sa.sa_mask));
/*@-unrecog@ *//* splint doesn't know about SA_SIGINFO */
sa.sa_flags = SA_SIGINFO;
/*@+unrecog@ */
(void) sigaction(SIGUSR1, &sa, &(pv_sig_state->signal.old_sigusr1));
memset(&sa, 0, sizeof(sa));
#endif /* PV_REMOTE_CONTROL */
/*
* Ensure that the TOSTOP terminal attribute is set, so that a
* SIGTTOU signal will be raised if we try to write to the terminal
* while backgrounded (see the SIGTTOU handler above).
* SIGTTOU signal will be raised if pv attempts to write to the
* terminal while backgrounded (see the SIGTTOU handler above).
*/
pv_sig_ensure_tty_tostop();
#ifdef ECHOCTL
/* Clear the ECHOCTL terminal attribute if it's set. */
pv_sig_ensure_tty_noechoctl();
#endif
/*
* Handle SIGALRM by doing nothing, so we can use alarms or interval
* Handle SIGALRM by doing nothing, allowing alarms or interval
* timers to interrupt blocking writes (returning EINTR).
*/
sa.sa_handler = pv_sig_alrm;
@@ -389,14 +548,15 @@ void pv_sig_init(pvstate_t state)
/*
* Shut down signal handling. If we had set the TOSTOP terminal attribute,
* and we're in the foreground, also turn that off (though if we're in
* cursor "-c" mode, only do that if we're the last PV instance, otherwise
* leave the terminal alone).
* Shut down signal handling. If this pv had set the TOSTOP terminal
* attribute, and is in the foreground, also turn that off (with the
* restriction that if in cursor "-c" mode, only do that if this is the last
* PV instance, otherwise leave the terminal alone).
*/
void pv_sig_fini( /*@unused@ */ __attribute__((unused)) pvstate_t state)
{
bool need_to_clear_tostop = false;
bool need_to_set_echoctl = false;
if (NULL == pv_sig_state)
return;
@@ -411,30 +571,28 @@ void pv_sig_fini( /*@unused@ */ __attribute__((unused)) pvstate_t state)
(void) sigaction(SIGINT, &(pv_sig_state->signal.old_sigint), NULL);
(void) sigaction(SIGHUP, &(pv_sig_state->signal.old_sighup), NULL);
(void) sigaction(SIGTERM, &(pv_sig_state->signal.old_sigterm), NULL);
#ifdef SA_SIGINFO
#ifdef PV_REMOTE_CONTROL
(void) sigaction(SIGUSR2, &(pv_sig_state->signal.old_sigusr2), NULL);
(void) sigaction(SIGUSR1, &(pv_sig_state->signal.old_sigusr1), NULL);
#endif
(void) sigaction(SIGALRM, &(pv_sig_state->signal.old_sigalrm), NULL);
need_to_clear_tostop = pv_sig_state->signal.pv_tty_tostop_added;
need_to_clear_tostop = (1 == pv_sig_state->flags.clear_tty_tostop_on_exit) ? true : false;
if (pv_sig_state->control.cursor) {
#ifdef HAVE_IPC
/*
* We won't clear TOSTOP if other "pv -c" instances
* were still running when pv_crs_fini() ran.
*
* TODO: we need a better way to determine if we're the last
* "pv" left.
* Don't clear TOSTOP if other "pv -c" instances were still
* running when pv_crs_fini() ran.
*/
if (pv_sig_state->control.cursor && pv_sig_state->cursor.pvcount > 1) {
need_to_clear_tostop = false;
}
#else /* !HAVE_IPC */
/*
* Without IPC we can't tell whether the other "pv -c"
* instances in the pipeline have finished so we will just
* have to clear TOSTOP anyway.
* Without IPC there's no way to tell whether other "pv -c"
* instances in the pipeline have finished, so clear TOSTOP
* anyway.
*/
#endif /* !HAVE_IPC */
}
@@ -444,7 +602,7 @@ void pv_sig_fini( /*@unused@ */ __attribute__((unused)) pvstate_t state)
if (need_to_clear_tostop && pv_in_foreground()) {
struct termios terminal_attributes;
debug("%s", "about to to clear TOSTOP terminal attribute if it is set");
debug("%s", "about to clear TOSTOP terminal attribute if it is set");
if (0 != tcgetattr(STDERR_FILENO, &terminal_attributes)) {
debug("%s: %s", "tcgetattr", strerror(errno));
@@ -457,8 +615,51 @@ void pv_sig_fini( /*@unused@ */ __attribute__((unused)) pvstate_t state)
}
}
pv_sig_state->signal.pv_tty_tostop_added = false;
pv_sig_state->flags.clear_tty_tostop_on_exit = 0;
}
#ifdef ECHOCTL
need_to_set_echoctl = (1 == pv_sig_state->flags.set_tty_echoctl_on_exit) ? true : false;
if (pv_sig_state->control.cursor) {
#ifdef HAVE_IPC
/*
* Don't set ECHOCTL if other "pv -c" instances were still
* running when pv_crs_fini() ran.
*/
if (pv_sig_state->control.cursor && pv_sig_state->cursor.pvcount > 1) {
need_to_set_echoctl = false;
}
#else /* !HAVE_IPC */
/*
* Without IPC there's no way to tell whether other "pv -c"
* instances in the pipeline have finished, so set ECHOCTL
* anyway.
*/
#endif /* !HAVE_IPC */
}
debug("%s=%s", "need_to_set_echoctl", need_to_set_echoctl ? "true" : "false");
if (need_to_set_echoctl && pv_in_foreground()) {
struct termios terminal_attributes;
debug("%s", "about to set ECHOCTL terminal attribute if it is not set");
if (0 != tcgetattr(STDERR_FILENO, &terminal_attributes)) {
debug("%s: %s", "tcgetattr", strerror(errno));
} else if (0 == (terminal_attributes.c_lflag & ECHOCTL)) {
terminal_attributes.c_lflag |= ECHOCTL;
if (0 == tcsetattr(STDERR_FILENO, TCSANOW, &terminal_attributes)) {
debug("%s", "set TOSTOP terminal attribute");
} else {
debug("%s: %s", "failed to set TOSTOP terminal attribute", strerror(errno));
}
}
pv_sig_state->flags.clear_tty_tostop_on_exit = 0;
}
#endif /* ECHOCTL */
}
@@ -467,19 +668,17 @@ void pv_sig_fini( /*@unused@ */ __attribute__((unused)) pvstate_t state)
*/
void pv_sig_nopause(void)
{
static struct sigaction sa;
sigset_t signal_set, signal_oldset;
memset(&sa, 0, sizeof(sa));
debug("%s", "blocking SIGTSTP, SIGCONT");
sa.sa_handler = SIG_IGN;
(void) sigemptyset(&(sa.sa_mask));
sa.sa_flags = 0;
(void) sigaction(SIGTSTP, &sa, NULL);
(void) sigemptyset(&signal_set);
(void) sigaddset(&signal_set, SIGTSTP);
(void) sigaddset(&signal_set, SIGCONT);
sa.sa_handler = SIG_DFL;
(void) sigemptyset(&(sa.sa_mask));
sa.sa_flags = 0;
(void) sigaction(SIGCONT, &sa, NULL);
if (0 != sigprocmask(SIG_BLOCK, &signal_set, &signal_oldset)) {
debug("%s: %s", "failed to set signal mask", strerror(errno));
}
}
@@ -488,27 +687,25 @@ void pv_sig_nopause(void)
*/
void pv_sig_allowpause(void)
{
static struct sigaction sa;
sigset_t signal_set, signal_oldset;
memset(&sa, 0, sizeof(sa));
debug("%s", "unblocking SIGTSTP, SIGCONT");
sa.sa_handler = pv_sig_tstp;
(void) sigemptyset(&(sa.sa_mask));
sa.sa_flags = 0;
(void) sigaction(SIGTSTP, &sa, NULL);
(void) sigemptyset(&signal_set);
(void) sigaddset(&signal_set, SIGTSTP);
(void) sigaddset(&signal_set, SIGCONT);
sa.sa_handler = pv_sig_cont;
(void) sigemptyset(&(sa.sa_mask));
sa.sa_flags = 0;
(void) sigaction(SIGCONT, &sa, NULL);
if (0 != sigprocmask(SIG_UNBLOCK, &signal_set, &signal_oldset)) {
debug("%s: %s", "failed to set signal mask", strerror(errno));
}
}
/*
* If we have redirected stderr to /dev/null, check every second or so to
* see whether we can write to the terminal again - this is so that if we
* get backgrounded, then foregrounded again, we start writing to the
* terminal again.
* If output to stderr is suspended, check once a second whether it is safe
* to write to the terminal. This is so that if pv is put into the
* background, and then brought into the foreground again, it can resume
* terminal output.
*/
void pv_sig_checkbg(void)
{
@@ -522,23 +719,17 @@ void pv_sig_checkbg(void)
next_check = time(NULL) + 1;
if (-1 == pv_sig_state->signal.old_stderr)
if (0 == pv_sig_state->flags.suspend_stderr)
return;
if (dup2(pv_sig_state->signal.old_stderr, STDERR_FILENO) < 0) {
debug("%s: %s", "failed to restore old stderr", strerror(errno));
}
if (!pv_in_foreground())
return;
if (0 != close(pv_sig_state->signal.old_stderr)) {
debug("%s: %s", "failed to close duplicate old stderr", strerror(errno));
}
pv_sig_state->signal.old_stderr = -1;
debug("%s: %s", "pv_sig_checkbg", "attempting to resume stderr");
pv_sig_state->flags.suspend_stderr = 0;
pv_sig_ensure_tty_tostop();
#ifdef HAVE_IPC
pv_crs_needreinit(pv_sig_state);
pv_crs_needreinit(&(pv_sig_state->cursor));
#endif
}
/* EOF */
+675 -120
View File
@@ -1,7 +1,7 @@
/*
* State management functions.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -10,94 +10,374 @@
#include "pv.h"
#include "pv-internal.h"
/*
* Do not use non-blocking I/O, because it has caused problems with some
* applications, such as dd, in the past.
*/
/* #undef MAKE_OUTPUT_NONBLOCKING */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
/* alloc / realloc history buffer */
static void pv_alloc_history(pvstate_t state)
/*
* Allocate or reallocate the history buffer for calculating average
* transfer rate.
*/
static void pv_alloc_calc_history(pvtransfercalc_t calc)
{
if (NULL != state->display.history)
free(state->display.history);
state->display.history = NULL;
if (NULL != calc->history)
free(calc->history);
calc->history = NULL;
state->display.history = calloc((size_t) (state->display.history_len), sizeof(state->display.history[0]));
if (NULL == state->display.history) {
calc->history = calloc((size_t) (calc->history_len), sizeof(calc->history[0]));
if (NULL == calc->history) {
/*@-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.
* splint note: the gettext calls made by _() cause
* unavoidable memory leak warnings, but they are mitigated
* by the fact that each string is only translated once.
*/
fprintf(stderr, "%s: %s: %s\n", state->status.program_name,
_("history structure allocation failed"), strerror(errno));
pv_perror("%s", _("memory allocation failure"));
/*@+mustfreefresh@ */
return;
}
state->display.history_first = state->display.history_last = 0;
state->display.history[0].elapsed_sec = 0.0; /* to be safe, memset() not recommended for doubles */
/*
* Explicitly set these values to zero, as memset() is not
* recommended for floating point types.
*/
calc->history_first = calc->history_last = 0;
calc->history[0].elapsed_sec = 0.0;
}
/*
* Create a new state structure, and return it, or 0 (NULL) on error.
* Set the "calc" state sub-structure's history length appropriately for the
* given average rate window setting, allocate an appropriate history, and
* return the appropriate history interval to use.
*/
pvstate_t pv_state_alloc(const char *program_name)
unsigned int pv_update_calc_average_rate_window(pvtransfercalc_t calc, unsigned int val)
{
unsigned int history_interval;
if (val < 1)
val = 1;
if (val >= 20) {
calc->history_len = (size_t) (val / 5 + 1);
history_interval = 5;
} else {
calc->history_len = (size_t) (val + 1);
history_interval = 1;
}
pv_alloc_calc_history(calc);
return history_interval;
}
/*
* Clear the "calc" part of a state structure.
*/
void pv_reset_calc(pvtransfercalc_t calc)
{
if (NULL == calc)
return;
/*
* Explicitly set important floating point values to 0, as memset()
* is not recommended for this.
*/
calc->transfer_rate = 0.0;
calc->average_rate = 0.0;
calc->prev_elapsed_sec = 0.0;
calc->prev_rate = 0.0;
calc->prev_trans = 0.0;
calc->current_avg_rate = 0.0;
calc->rate_min = 0.0;
calc->rate_max = 0.0;
calc->rate_sum = 0.0;
calc->ratesquared_sum = 0.0;
calc->measurements_taken = 0;
calc->prev_transferred = 0;
calc->percentage = 0.0;
calc->history_first = calc->history_last = 0;
if (NULL != calc->history) {
calc->history[0].elapsed_sec = 0.0;
}
}
/*
* Clear the "transfer" part of a state structure.
*/
void pv_reset_transfer(pvtransferstate_t transfer)
{
if (NULL == transfer)
return;
transfer->elapsed_seconds = 0.0;
transfer->read_position = 0;
transfer->write_position = 0;
transfer->to_write = 0;
transfer->written = 0;
transfer->total_bytes_read = 0;
transfer->total_written = 0;
transfer->written_but_not_consumed = 0;
transfer->read_errors_in_a_row = 0;
transfer->last_read_skip_fd = 0;
#ifdef HAVE_COPY_FILE_RANGE
transfer->copy_file_range_failed_fd = -1;
#endif /* HAVE_COPY_FILE_RANGE */
#ifdef HAVE_SPLICE
transfer->splice_failed_fd = -1;
transfer->intermediate_pipe[0] = -1;
transfer->intermediate_pipe[1] = -1;
transfer->discard_fd = -1;
#endif /* HAVE_SPLICE */
transfer->line_positions_length = 0;
transfer->line_positions_head = 0;
transfer->last_output_position = 0;
transfer->output_not_seekable = false;
}
/*
* Reset the calculated parts of the "flags" state structure.
*/
void pv_reset_flags(pvtransientflags_t flags)
{
if (NULL == flags)
return;
flags->reparse_display = 1;
}
/*
* Reset the calculated parts of a "display" state structure.
*/
void pv_reset_display(pvdisplay_t display)
{
if (NULL == display)
return;
display->initial_offset = 0;
display->output_produced = false;
}
/*
* Clear the calculated parts of a state structure.
*/
void pv_state_reset(pvstate_t state)
{
if (NULL == state)
return;
pv_reset_flags(&(state->flags));
state->status.current_input_file = -1;
pv_reset_display(&(state->display));
pv_reset_display(&(state->extra_display));
pv_reset_calc(&(state->calc));
pv_reset_transfer(&(state->transfer));
}
/*
* Create a new state structure, and return it, or NULL on error.
*/
pvstate_t pv_state_alloc(void)
{
pvstate_t state;
size_t try_size;
state = calloc(1, sizeof(*state));
if (NULL == state)
return NULL;
memset(state, 0, sizeof(*state));
/* splint 3.1.2 thinks this is required for some reason. */
if (NULL != state->status.program_name) {
free(state->status.program_name);
}
state->status.program_name = pv_strdup(program_name);
if (NULL == state->status.program_name) {
free(state);
return NULL;
}
state->control.watch_pid = 0;
state->control.watch_fd = -1;
state->watchfd.count = 0;
state->control.output_fd = -1;
state->control.othermonitor_pid = 0;
state->control.othermonitor_read_fd = -1;
state->control.othermonitor_write_fd = -1;
#ifdef HAVE_IPC
state->cursor.shmid = -1;
state->cursor.pvcount = 1;
#endif /* HAVE_IPC */
state->cursor.lock_fd = -1;
state->flag.reparse_display = 1;
state->status.current_input_file = -1;
#ifdef HAVE_SPLICE
state->transfer.splice_failed_fd = -1;
#endif /* HAVE_SPLICE */
state->display.display_visible = false;
pv_state_reset(state);
#ifdef HAVE_GETCWD
/*
* Get the current working directory, if possible, as a base for
* showing relative filenames with --watchfd.
*
* If this fails then --watchfd will fall back to always showing the
* full path.
*/
if (NULL == getcwd(state->status.cwd, PV_SIZEOF_CWD - 1)) {
/* failed - will always show full path */
state->status.cwd[0] = '\0';
for (try_size = 32; try_size <= 16384; try_size = try_size * 2) {
bool buffer_too_small;
if (NULL != state->status.cwd) {
free(state->status.cwd);
state->status.cwd = NULL;
}
/*@-mustfreeonly@ *//* splint mis-detects this as a memory leak. */
state->status.cwd = malloc(try_size);
/*@+mustfreeonly@ */
if (NULL == state->status.cwd)
break;
buffer_too_small = false;
if (NULL == getcwd(state->status.cwd, try_size)) {
if (errno != ERANGE)
buffer_too_small = true;
free(state->status.cwd);
state->status.cwd = NULL;
}
if (!buffer_too_small)
break;
}
if ('\0' == state->status.cwd[1]) {
/* CWD is root directory - always show full path */
state->status.cwd[0] = '\0';
}
state->status.cwd[PV_SIZEOF_CWD - 1] = '\0';
#endif /* HAVE_GETCWD */
return state;
}
/*
* Free dynamic contents of a display structure.
*/
void pv_freecontents_display(pvdisplay_t display)
{
if (NULL != display->display_buffer)
free(display->display_buffer);
display->display_buffer = NULL;
}
/*
* Free dynamic contents of a transfer state structure.
*/
void pv_freecontents_transfer(pvtransferstate_t transfer)
{
/*@-keeptrans@ */
if (NULL != transfer->transfer_buffer)
free(transfer->transfer_buffer);
transfer->transfer_buffer = NULL;
/*@+keeptrans@ */
/* splint - explicitly freeing this structure, so free() here is OK. */
#ifdef HAVE_SPLICE
/* Close the intermediate pipe, if there was one. */
if (transfer->intermediate_pipe_buffer_size > 0) {
int idx;
for (idx = 0; idx < 2; idx++) {
if (transfer->intermediate_pipe[idx] >= 0) {
(void) close(transfer->intermediate_pipe[idx]);
transfer->intermediate_pipe[idx] = -1;
}
}
}
/* Close the discard file descriptor, if there was one. */
if (transfer->discard_fd >= 0) {
(void) close(transfer->discard_fd);
transfer->discard_fd = -1;
}
#endif /* HAVE_SPLICE */
if (NULL != transfer->line_positions)
free(transfer->line_positions);
transfer->line_positions = NULL;
}
/*
* Free dynamic contents of a calculated transfer state structure.
*/
void pv_freecontents_calc(pvtransfercalc_t calc)
{
if (NULL != calc->history)
free(calc->history);
calc->history = NULL;
}
/*
* Free the contents of a watchfd watched-items array.
*/
void pv_freecontents_watchfd_items(struct pvwatcheditem_s *watching, unsigned int count)
{
unsigned int watch_idx;
if (NULL == watching)
return;
/*@-compdestroy@ */
for (watch_idx = 0; watch_idx < count; watch_idx++) {
int info_idx;
if (NULL == watching[watch_idx].info_array)
continue;
for (info_idx = 0; info_idx < watching[watch_idx].array_length; info_idx++) {
pv_freecontents_watchfd(&(watching[watch_idx].info_array[info_idx]));
}
free(watching[watch_idx].info_array);
watching[watch_idx].info_array = NULL;
watching[watch_idx].array_length = 0;
}
return;
/*@+compdestroy @ */
/*
* splint warns that watching[].info_array->transfer.transfer_buffer
* and other deep structures may not be deallocated and so leak
* memory, but that's what pv_freecontents_watchfd() takes care of.
*/
}
/*
* Truncate the output file descriptor to its current position, if it's a
* valid fd, sparse output mode is active, and no lseek() failed.
*/
static void pv_truncate_output(pvstate_t state)
{
off_t current_offset;
if (!state->control.sparse_output)
return;
if (state->transfer.output_not_seekable)
return;
if (state->control.output_fd < 0)
return;
current_offset = (off_t) lseek(state->control.output_fd, (off_t) 0, SEEK_CUR);
if (current_offset == (off_t) - 1)
return;
debug("%s: %ld", "truncating to current offset", (long) current_offset);
/*@+longintegral@ */
/*
* splint has trouble with off_t / __off_t.
*/
if (0 != ftruncate(state->control.output_fd, current_offset)) {
debug("%s: %s", "output ftruncate() failed", strerror(errno));
}
/*@-longintegral@ */
}
/*
* Free a state structure, after which it can no longer be used.
*/
@@ -106,34 +386,62 @@ void pv_state_free(pvstate_t state)
if (0 == state)
return;
if (NULL != state->status.program_name)
free(state->status.program_name);
state->status.program_name = NULL;
/*
* Close the output file first, while the output filename is still
* available to include in an error message.
*/
if (state->control.output_fd >= 0) {
pv_truncate_output(state);
if (STDOUT_FILENO != state->control.output_fd) {
if (close(state->control.output_fd) < 0) {
pv_perror("%s",
NULL == state->control.output_name ? "(null)" : state->control.output_name);
}
}
state->control.output_fd = -1;
}
if (NULL != state->display.display_buffer)
free(state->display.display_buffer);
state->display.display_buffer = NULL;
if (NULL != state->control.output_name) {
free(state->control.output_name);
state->control.output_name = NULL;
}
if (NULL != state->status.cwd) {
free(state->status.cwd);
state->status.cwd = NULL;
}
pv_freecontents_display(&(state->display));
pv_freecontents_display(&(state->extra_display));
if (NULL != state->control.name) {
free(state->control.name);
state->control.name = NULL;
}
if (NULL != state->control.default_bar_style) {
free(state->control.default_bar_style);
state->control.default_bar_style = NULL;
}
if (NULL != state->control.format_string) {
free(state->control.format_string);
state->control.format_string = NULL;
}
/*@-keeptrans@ */
if (NULL != state->transfer.transfer_buffer)
free(state->transfer.transfer_buffer);
state->transfer.transfer_buffer = NULL;
/*@+keeptrans@ */
/* splint - explicitly freeing this structure, so free() here is OK. */
if (NULL != state->control.extra_display_spec) {
free(state->control.extra_display_spec);
state->control.extra_display_spec = NULL;
}
if (NULL != state->display.history)
free(state->display.history);
state->display.history = NULL;
if (NULL != state->control.extra_format_string) {
free(state->control.extra_format_string);
state->control.extra_format_string = NULL;
}
pv_freecontents_transfer(&(state->transfer));
pv_freecontents_calc(&(state->calc));
if (NULL != state->files.filename) {
unsigned int file_idx;
@@ -147,6 +455,12 @@ void pv_state_free(pvstate_t state)
state->files.filename = NULL;
}
if (NULL != state->watchfd.watching) {
pv_freecontents_watchfd_items(state->watchfd.watching, state->watchfd.count);
free(state->watchfd.watching);
state->watchfd.watching = NULL;
}
free(state);
return;
@@ -154,10 +468,13 @@ void pv_state_free(pvstate_t state)
/*
* Set the formatting string, given a set of old-style formatting options.
* Set the format options and use them to build a default formatting string.
* The default string is used if no format string is explicitly set.
*
* Call this *after* setting a name, so it can determine whether there
* should be a name in the default format.
*/
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, size_t lastwritten, /*@null@ */
const char *name)
void pv_state_set_format_options(pvstate_t state, pvformatoptions_s format)
{
#define PV_ADDFORMAT(x,y) if (x) { \
if (state->control.default_format[0] != '\0') \
@@ -165,40 +482,79 @@ void pv_state_set_format(pvstate_t state, bool progress, bool timer, bool eta, b
(void) pv_strlcat(state->control.default_format, y, sizeof(state->control.default_format)); \
}
state->control.format_option.progress = format.progress;
state->control.format_option.timer = format.timer;
state->control.format_option.eta = format.eta;
state->control.format_option.fineta = format.fineta;
state->control.format_option.rate = format.rate;
state->control.format_option.average_rate = format.average_rate;
state->control.format_option.bytes = format.bytes;
state->control.format_option.bufpercent = format.bufpercent;
state->control.format_option.lastwritten = format.lastwritten;
state->control.default_format[0] = '\0';
PV_ADDFORMAT(name, "%N");
PV_ADDFORMAT(bytes, "%b");
PV_ADDFORMAT(bufpercent, "%T");
PV_ADDFORMAT(timer, "%t");
PV_ADDFORMAT(rate, "%r");
PV_ADDFORMAT(average_rate, "%a");
PV_ADDFORMAT(progress, "%p");
PV_ADDFORMAT(eta, "%e");
PV_ADDFORMAT(fineta, "%I");
if (lastwritten > 0) {
char buf[16]; /* flawfinder: ignore */
memset(buf, 0, sizeof(buf));
(void) pv_snprintf(buf, sizeof(buf), "%%%uA", (unsigned int) lastwritten);
PV_ADDFORMAT(lastwritten > 0, buf);
if (false == state->control.numeric) {
/* Standard progress display mode (without "--numeric"). */
/*
* flawfinder rationale: large enough for string, zeroed
* before use, only written to by pv_snprintf() with the
* right buffer length.
* Add the format strings for the enabled options in a
* standard order.
*/
PV_ADDFORMAT(NULL != state->control.name, "%N");
PV_ADDFORMAT(format.bytes, "%b");
PV_ADDFORMAT(format.bufpercent, "%T");
PV_ADDFORMAT(format.timer, "%t");
PV_ADDFORMAT(format.rate, "%r");
PV_ADDFORMAT(format.average_rate, "%a");
PV_ADDFORMAT(format.progress, "%p");
PV_ADDFORMAT(format.eta, "%e");
PV_ADDFORMAT(format.fineta, "%I");
if (format.lastwritten > 0) {
char buf[16]; /* flawfinder: ignore */
memset(buf, 0, sizeof(buf));
(void) pv_snprintf(buf, sizeof(buf), "%%%uA", (unsigned int) format.lastwritten);
PV_ADDFORMAT(format.lastwritten > 0, buf);
/*
* flawfinder rationale: large enough for string,
* zeroed before use, only written to by
* pv_snprintf() with the right buffer length.
*/
}
} else {
/* Numeric mode has different behaviour. */
PV_ADDFORMAT(format.timer, "%t");
PV_ADDFORMAT(format.bytes, "%b");
PV_ADDFORMAT(format.rate, "%r");
PV_ADDFORMAT(!(format.bytes || format.rate), "%{progress-amount-only}");
}
if (NULL != state->control.name) {
free(state->control.name);
state->control.name = NULL;
}
debug("%s: [%s]", "default format set", state->control.default_format);
if (NULL != name)
state->control.name = pv_strdup(name);
state->flag.reparse_display = 1;
/* Tell pv_format() that the format has changed. */
state->flags.reparse_display = 1;
}
/*
* Append a string to the default format, and trigger a format reparse.
*/
void pv_state_append_to_default_format(pvstate_t state, /*@null@ */ const char *val)
{
PV_ADDFORMAT(NULL != val, val);
state->flags.reparse_display = 1;
}
/*
* Simple setter functions.
*/
void pv_state_force_set(pvstate_t state, bool val)
{
state->control.force = val;
@@ -209,6 +565,16 @@ void pv_state_cursor_set(pvstate_t state, bool val)
state->control.cursor = val;
}
void pv_state_use_osc94_set(pvstate_t state, bool val)
{
state->control.use_osc94 = val;
}
void pv_state_show_stats_set(pvstate_t state, bool val)
{
state->control.show_stats = val;
}
void pv_state_numeric_set(pvstate_t state, bool val)
{
state->control.numeric = val;
@@ -224,6 +590,11 @@ void pv_state_delay_start_set(pvstate_t state, double val)
state->control.delay_start = val;
}
void pv_state_rate_gauge_set(pvstate_t state, bool val)
{
state->control.rate_gauge = val;
}
void pv_state_linemode_set(pvstate_t state, bool val)
{
state->control.linemode = val;
@@ -272,17 +643,33 @@ void pv_state_sync_after_write_set(pvstate_t state, bool val)
void pv_state_direct_io_set(pvstate_t state, bool val)
{
state->control.direct_io = val;
/* Tell pv_transfer() to take action when this value changes. */
state->control.direct_io_changed = true;
}
void pv_state_sparse_output_set(pvstate_t state, bool val)
{
state->control.sparse_output = val;
}
void pv_state_discard_input_set(pvstate_t state, bool val)
{
state->control.discard_input = val;
}
void pv_state_rate_limit_set(pvstate_t state, off_t val)
/*
* If "was_specified" is true, the limit was specified on the command line.
* This is used with --remote to determine whether to affect the remote
* process's rate limit settings.
*
* if "is_active" is true, the limit ("val") is not zero so rate limiting is
* active.
*/
void pv_state_rate_limit_set(pvstate_t state, long double val, bool was_specified, bool is_active)
{
state->control.rate_limit = val;
state->control.rate_limit_specified = was_specified;
state->control.rate_limit_active = is_active;
}
void pv_state_target_buffer_size_set(pvstate_t state, size_t val)
@@ -295,6 +682,11 @@ void pv_state_no_splice_set(pvstate_t state, bool val)
state->control.no_splice = val;
}
void pv_state_pipe_buffer_size_set(pvstate_t state, size_t val)
{
state->control.pipe_buffer_size = val;
}
void pv_state_size_set(pvstate_t state, off_t val)
{
state->control.size = val;
@@ -307,7 +699,9 @@ void pv_state_interval_set(pvstate_t state, double val)
void pv_state_width_set(pvstate_t state, unsigned int val, bool was_set_manually)
{
state->control.width = val;
if (val > PVDISPLAY_WIDTH_MAX)
val = PVDISPLAY_WIDTH_MAX;
state->control.width = (pvdisplay_width_t) val;
state->control.width_set_manually = was_set_manually;
}
@@ -327,6 +721,16 @@ void pv_state_name_set(pvstate_t state, /*@null@ */ const char *val)
state->control.name = pv_strdup(val);
}
void pv_state_default_bar_style_set(pvstate_t state, /*@null@ */ const char *val)
{
if (NULL != state->control.default_bar_style) {
free(state->control.default_bar_style);
state->control.default_bar_style = NULL;
}
if (NULL != val)
state->control.default_bar_style = pv_strdup(val);
}
void pv_state_format_string_set(pvstate_t state, /*@null@ */ const char *val)
{
if (NULL != state->control.format_string) {
@@ -337,14 +741,108 @@ void pv_state_format_string_set(pvstate_t state, /*@null@ */ const char *val)
state->control.format_string = pv_strdup(val);
}
void pv_state_watch_pid_set(pvstate_t state, pid_t val)
void pv_state_extra_display_set(pvstate_t state, /*@null@ */ const char *val)
{
state->control.watch_pid = val;
const char *word_start;
if (NULL != state->control.extra_display_spec) {
free(state->control.extra_display_spec);
state->control.extra_display_spec = NULL;
}
if (NULL != state->control.extra_format_string) {
free(state->control.extra_format_string);
state->control.extra_format_string = NULL;
}
state->control.extra_displays = 0;
if (NULL == val)
return;
if (NULL != val)
state->control.extra_display_spec = pv_strdup(val);
word_start = val;
while (NULL != word_start && '\0' != word_start[0]) {
size_t offset;
offset = 0;
while ('\0' != word_start[offset] && ',' != word_start[offset] && ':' != word_start[offset])
offset++;
if (((11 == offset) && (0 == strncmp(word_start, "windowtitle", 11)))
|| ((6 == offset) && (0 == strncmp(word_start, "window", 6)))
) {
debug("%s", "enabling windowtitle");
state->control.extra_displays |= PV_DISPLAY_WINDOWTITLE;
} else if (((12 == offset) && (0 == strncmp(word_start, "processtitle", 12)))
|| ((9 == offset) && (0 == strncmp(word_start, "proctitle", 9)))
|| ((7 == offset) && (0 == strncmp(word_start, "process", 7)))
|| ((4 == offset) && (0 == strncmp(word_start, "proc", 4)))
) {
debug("%s", "enabling processtitle");
state->control.extra_displays |= PV_DISPLAY_PROCESSTITLE;
}
switch (word_start[offset]) {
case ',':
offset++;
break;
case ':':
offset++;
debug("%s: [%s]", "setting extra_format_string", word_start + offset);
state->control.extra_format_string = pv_strdup(word_start + offset);
word_start = NULL;
break;
default:
word_start = NULL;
break;
}
if (NULL != word_start)
word_start += offset;
}
}
void pv_state_watch_fd_set(pvstate_t state, int val)
void pv_state_output_set(pvstate_t state, int fd, const char *name)
{
state->control.watch_fd = val;
/*
* Close any previous output file first, before the old output
* filename is replaced, so any associated error can be reported
* with the right filename.
*/
pv_truncate_output(state);
if (state->control.output_fd >= 0 && state->control.output_fd != STDOUT_FILENO) {
if (close(state->control.output_fd) < 0) {
pv_perror("%s", NULL == state->control.output_name ? "(null)" : state->control.output_name);
}
}
if (NULL != state->control.output_name)
free(state->control.output_name);
state->control.output_fd = fd;
state->control.output_name = pv_strdup(name);
#ifdef MAKE_OUTPUT_NONBLOCKING
/*
* Try and make the output use non-blocking I/O.
*
* This can cause problems with some, but not all, applications -
* such as dd - when used in a pipeline.
*/
fcntl(state->control.output_fd, F_SETFL, O_NONBLOCK | fcntl(state->control.output_fd, F_GETFL));
#endif /* MAKE_OUTPUT_NONBLOCKING */
/*
* In sparse output mode, if the output is in append mode (>>),
* explicitly lseek() to the end of the file. Otherwise, the file
* offset is not set until the first write(), which means that if
* the input starts with null bytes, upon lseek()ing past them
* relative to the current position, the "current position" is 0
* rather than the end of the file, and the file gets truncated on
* exit to the wrong size.
*/
if (state->control.sparse_output && 0 != (fcntl(fd, F_GETFL) & O_APPEND)) {
debug("%s", "sparse output mode, and appending - seeking output to the end");
if ((off_t) lseek(fd, 0, SEEK_END) == (off_t) - 1) {
debug("%s: %s", "lseek failed", strerror(errno));
}
}
}
void pv_state_average_rate_window_set(pvstate_t state, unsigned int val)
@@ -352,16 +850,32 @@ void pv_state_average_rate_window_set(pvstate_t state, unsigned int val)
if (val < 1)
val = 1;
state->control.average_rate_window = val;
if (val >= 20) {
state->display.history_len = (size_t) (val / 5 + 1);
state->display.history_interval = 5;
} else {
state->display.history_len = (size_t) (val + 1);
state->display.history_interval = 1;
}
pv_alloc_history(state);
state->control.history_interval = pv_update_calc_average_rate_window(&(state->calc), val);
}
void pv_state_set_terminal_supports_utf8(pvstate_t state, bool val)
{
state->status.terminal_supports_utf8 = val;
}
void pv_state_othermonitor_set(pvstate_t state, pid_t pid, int read_fd, int write_fd)
{
state->control.othermonitor_pid = pid;
state->control.othermonitor_read_fd = read_fd;
state->control.othermonitor_write_fd = write_fd;
}
/* If the format string is set to an empty string, stop all display output. */
void pv_state_cancel_output_if_empty_format_string(pvstate_t state)
{
if (NULL == state->control.format_string)
return;
if ('\0' != state->control.format_string[0])
return;
debug("%s", "empty format string - setting no_display and turning off cursor positioning");
state->control.no_display = true;
state->control.cursor = false;
}
/*
* Set the array of input files.
@@ -369,45 +883,86 @@ void pv_state_average_rate_window_set(pvstate_t state, unsigned int val)
void pv_state_inputfiles(pvstate_t state, unsigned int input_file_count, const char **input_files)
{
unsigned int file_idx;
/*@only@ */ nullable_only_string_t *new_array;
/* Free the old array and its contents, if there was one. */
if (NULL != state->files.filename) {
for (file_idx = 0; file_idx < state->files.file_count; file_idx++) {
/*@-unqualifiedtrans@ */
free(state->files.filename[file_idx]);
/*@+unqualifiedtrans@ */
/*
* TODO: find a way to tell splint the array
* contents are "only" and "null" as well as the
* array itself.
*/
}
free(state->files.filename);
state->files.filename = NULL;
state->files.file_count = 0;
}
state->files.filename = calloc((size_t) (input_file_count + 1), sizeof(char *));
if (NULL == state->files.filename) {
/* Allocate an empty new array of the right size. */
new_array = calloc((size_t) (input_file_count + 1), sizeof(char *));
if (NULL == new_array) {
/*@-mustfreefresh@ *//* see similar _() issue above */
fprintf(stderr, "%s: %s: %s\n", state->status.program_name, _("file list allocation failed"),
strerror(errno));
pv_perror("%s", _("memory allocation failure"));
/*@+mustfreefresh@ */
return;
}
state->files.filename = new_array;
/* Populate the new array with copies of the filenames. */
for (file_idx = 0; file_idx < input_file_count; file_idx++) {
/*@-nullstate@ */
state->files.filename[file_idx] = pv_strdup(input_files[file_idx]);
if (NULL == state->files.filename[file_idx]) {
/*@only@ */ char *new_string;
new_string = pv_strdup(input_files[file_idx]);
if (NULL == new_string) {
/*@-mustfreefresh@ *//* see similar _() issue above */
fprintf(stderr, "%s: %s: %s\n", state->status.program_name,
_("file list allocation failed"), strerror(errno));
pv_perror("%s", _("memory allocation failure"));
/*@+mustfreefresh@ */
return;
}
state->files.filename[file_idx] = new_string;
}
state->files.file_count = input_file_count;
}
/*@+nullstate@*/
/* splint: see unqualifiedtrans note by free() above. */
/*
* Set the arrays of watchfd process IDs and file descriptors.
*/
void pv_state_watchfds(pvstate_t state, unsigned int watchfd_count, const pid_t *pids, const int *fds)
{
unsigned int item_idx;
/*@only@ */ struct pvwatcheditem_s *new_array = NULL;
/* EOF */
/* Free the old arrays, if there were any. */
if (NULL != state->watchfd.watching) {
/*@-compdestroy@ */
pv_freecontents_watchfd_items(state->watchfd.watching, state->watchfd.count);
free(state->watchfd.watching);
state->watchfd.watching = NULL;
/*@+compdestroy@ */
/*
* splint warns about deep structures not being deallocated,
* but that's what pv_freecontents_watchfd_items() does.
*/
}
state->watchfd.count = 0;
state->watchfd.multiple_pids = false;
/* Allocate an empty new array of the right size. */
new_array = malloc((1 + watchfd_count) * sizeof(*new_array));
if (NULL == new_array) {
/*@-mustfreefresh@ *//* see similar _() issue above */
pv_perror("%s", _("memory allocation failure"));
/*@+mustfreefresh@ */
return;
}
memset(new_array, 0, (1 + watchfd_count) * sizeof(*new_array));
state->watchfd.watching = new_array;
/* Populate the new array with the values supplied. */
for (item_idx = 0; item_idx < watchfd_count; item_idx++) {
state->watchfd.watching[item_idx].pid = pids[item_idx];
state->watchfd.watching[item_idx].fd = fds[item_idx];
if ((item_idx > 0) && (pids[item_idx] != pids[item_idx - 1]))
state->watchfd.multiple_pids = true;
}
state->watchfd.count = watchfd_count;
debug("%s=%d, %s=%s", "watchfd.count", state->watchfd.count, "multiple_pids",
state->watchfd.multiple_pids ? "true" : "false");
}
+298 -17
View File
@@ -1,7 +1,7 @@
/*
* Functions for portably managing strings.
*
* Copyright 2023-2024 Andrew Wood
* Copyright 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -13,13 +13,19 @@
#include <stdarg.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
/*
* Wrapper for sprintf(), falling back to sprintf() on systems without that
* Wrapper for snprintf(), falling back to sprintf() on systems without that
* function.
*
* Returns -1 if "str" or "format" are NULL or if "size" is 0.
* Returns -1 if "format" is NULL.
*
* Otherwise, ensures that the buffer "str" is always terminated with a '\0'
* byte, before returning whatever the system's vsnprintf() or vsprintf()
@@ -30,24 +36,26 @@ int pv_snprintf(char *str, size_t size, const char *format, ...)
va_list ap;
int ret;
if (NULL == str)
return -1;
if (0 == size)
return -1;
if (NULL == format)
if (NULL == format) {
errno = EINVAL;
return -1;
}
str[0] = '\0';
if (NULL != str && size > 0)
str[0] = '\0';
va_start(ap, format);
/*@-nullpass@ */
#ifdef HAVE_VSNPRINTF
ret = vsnprintf(str, size, format, ap); /* flawfinder: ignore */
#else /* ! HAVE_VSNPRINTF */
ret = vsprintf(str, format, ap); /* flawfinder: ignore */
#endif /* HAVE_VSNPRINTF */
/*@+nullpass@ *//* explicitly allowing NULL to behave as vsnprintf() does. */
va_end(ap);
str[size - 1] = '\0';
if (NULL != str && size > 0)
str[size - 1] = '\0';
/*
* flawfinder rationale: this function replaces snprintf so
@@ -59,6 +67,131 @@ int pv_snprintf(char *str, size_t size, const char *format, ...)
return ret;
}
/*
* Wrapper for asprintf(), working around it on systems without that
* function.
*
* Allocates a buffer large enough for the expanded format string plus a
* terminating '\0' byte, points *strp to it, and returns whatever the
* system's vasprintf() or vsprintf() returned.
*
* Returns -1 if "strp" is NULL.
* Returns -1 and sets *strp to NULL if "format" is NULL.
*/
int pv_asprintf(nullable_string_ptr *strp, const char *format, ...)
{
va_list ap;
char *new_string = NULL;
size_t new_size = 0;
int ret;
if (NULL == strp)
return -1;
*strp = NULL;
if (NULL == format)
return -1;
#ifdef HAVE_VASPRINTF
va_start(ap, format);
/*@-unrecog@ */
ret = vasprintf(strp, format, ap); /* flawfinder: ignore */
/*@+unrecog@ *//* splint doesn't know about vasprintf(). */
va_end(ap);
if (ret < 0)
return ret;
new_string = *strp;
new_size = (size_t) ret + 1;
#else /* ! HAVE_VASPRINTF */
#ifdef HAVE_VSNPRINTF
/* Find out the required size. */
{
char tmpbuf[8]; /* flawfinder: ignore - bounded by vsnprintf(). */
va_start(ap, format);
ret = vsnprintf(tmpbuf, 7, format, ap); /* flawfinder: ignore */
va_end(ap);
if (ret < 0)
return ret;
}
/* Allocate a buffer big enough to include a terminating \0. */
new_size = (size_t) ret + 1;
new_string = malloc(new_size);
if (NULL == new_string)
return -1;
new_string[0] = '\0';
/* Generate the string. */
va_start(ap, format);
ret = vsnprintf(new_string, new_size, format, ap); /* flawfinder: ignore */
va_end(ap);
if (ret < 0) {
int old_errno;
old_errno = errno;
free(new_string);
errno = old_errno;
return ret;
}
*strp = new_string;
#else /* ! HAVE_VSNPRINTF */
/*
* Without vsnprintf(), determining the required size is impossible
* without a buffer to write to. The best effort here is to
* allocate a large buffer, write to it, then duplicate the string
* afterwards. This means there's an arbitrary upper bound on
* string size and there will be some heap fragmentation.
*/
/* Allocate a large buffer for the string. */
new_size = 16384;
new_string = malloc(new_size);
if (NULL == new_string)
return -1;
new_string[0] = '\0';
/* Generate the string. */
va_start(ap, format);
ret = vsprintf(new_string, format, ap); /* flawfinder: ignore */
va_end(ap);
if (ret < 0) {
int old_errno;
old_errno = errno;
free(new_string);
errno = old_errno;
return ret;
}
/* Duplicate the string into a buffer just long enough for it. */
*strp = pv_strdup(new_string);
if (NULL == *strp) {
int old_errno;
old_errno = errno;
free(new_string);
errno = old_errno;
return -1;
}
/* Free the original large buffer, and use the new one instead. */
free(new_string);
new_string = *strp;
#endif /* HAVE_VSNPRINTF */
#endif /* HAVE_VASPRINTF */
/* Terminate the new string. */
if (NULL != new_string && new_size > 0)
new_string[new_size - 1] = '\0';
/*
* flawfinder rationale: this function replaces asprintf so
* explicitly takes a non-constant format; also it explicitly
* \0-terminates the output buffer.
*/
return ret;
}
/*
* Implementation of strlcat() where it is unavailable: append a string to a
* buffer, constraining the buffer to a particular size and ensuring
@@ -69,7 +202,7 @@ int pv_snprintf(char *str, size_t size, const char *format, ...)
* byte.
*
* Returns the intended length of the string, not including the terminating
* '\0', i.e. strlen(src)+strlen(dst), regardless of whether truncation
* '\0', i.e. strlen(src)+strlen(dst), regardless of whether truncation
* occurred.
*
* Note that this implementation has the side effect that "dst" will always
@@ -80,7 +213,9 @@ size_t pv_strlcat(char *dst, const char *src, size_t dstsize)
#ifdef HAVE_STRLCAT
size_t result;
/*@-unrecog@ *//* splint doesn't recognise strlcat. */
result = strlcat(dst, src, dstsize);
/*@+unrecog@ */
if ((NULL != dst) && (dstsize > 0))
dst[dstsize - 1] = '\0';
@@ -102,8 +237,8 @@ size_t pv_strlcat(char *dst, const char *src, size_t dstsize)
/*
* flawfinder rationale: src must explicitly be \0 terminated, so
* this is up to the caller; with dst, we enforce \0 termination
* before calling strlen().
* this is up to the caller; with dst, \0 termination is enforced
* before strlen() is called.
*/
available = dstsize - dstlen;
@@ -121,7 +256,7 @@ size_t pv_strlcat(char *dst, const char *src, size_t dstsize)
*/
/*@null@ */
/*@only@ */
char *pv_strdup(const char *original)
char *pv_strdup(const /*@null@ */ char *original)
{
size_t length;
char *duplicate;
@@ -151,6 +286,7 @@ char *pv_strdup(const char *original)
return duplicate;
}
/*
* Return a pointer to the last matching character in the buffer, or NULL if
* not found.
@@ -160,9 +296,9 @@ char *pv_strdup(const char *original)
void *pv_memrchr(const void *buffer, int match, size_t length)
{
#ifdef HAVE_MEMRCHR
/*@-unrecog @ *//* splint doesn't know of memrchr() */
/*@-unrecog@ *//* splint doesn't know of memrchr() */
return memrchr(buffer, match, length);
/*@+unrecog @ */
/*@+unrecog@ */
#else
unsigned char *ptr;
@@ -180,4 +316,149 @@ void *pv_memrchr(const void *buffer, int match, size_t length)
#endif
}
/* EOF */
/*
* Return the number of display columns needed to show the
* non-null-terminated string "string" whose length in bytes is "bytes".
*
* Skips ECMA-48 CSI (ESC [ ...) sequences, and OSC (ESC ] ...) sequences,
* but any other control characters are treated as printable.
*
* Internally, after skipping CSI or OSC sequences, the string is converted
* to a wide character string, and each wide character's width is checked
* with "wcswidth()".
*
* If NLS is disabled, or the string cannot be converted, this just returns
* the number of bytes in the string that aren't part of CSI sequences.
*
* Note that this function uses internal buffers if the string is short
* enough, otherwise it has to call malloc() and free(), so it becomes less
* efficient with larger strings.
*/
size_t pv_strwidth(const char *string, size_t bytes)
{
char *allocated_raw = NULL;
static char internal_raw[256]; /* flawfinder: ignore - bounded */
char *raw_string = NULL;
size_t read_pos, write_pos;
size_t raw_bytes, width;
#if defined(ENABLE_NLS) && defined(HAVE_WCHAR_H)
size_t wide_char_count;
size_t wide_string_buffer_size;
wchar_t *allocated_wide = NULL;
static wchar_t internal_wide[256]; /* flawfinder: ignore - bounded */
wchar_t *wide_string = NULL;
#endif /* defined(ENABLE_NLS) && defined(HAVE_WCHAR_H) */
if (NULL == string)
return 0;
if (0 == bytes)
return 0;
if (bytes < sizeof(internal_raw) - 1) {
raw_string = internal_raw;
} else {
allocated_raw = calloc(1, 1 + bytes);
if (NULL == allocated_raw)
return bytes;
raw_string = allocated_raw;
}
/*
* Copy the original string, skipping ECMA-48 CSI and OSC sequences.
*/
for (read_pos = 0, write_pos = 0; read_pos < bytes; read_pos++) {
if ((string[read_pos] == '\033') && (read_pos < bytes - 1) && (string[read_pos + 1] == '[')) {
/* Skip CSI - ends with anything other than 0-9 or ';'. */
read_pos += 2;
while ((read_pos < bytes - 1)
&& ((string[read_pos] >= '0' && string[read_pos] <= '9')
|| (';' == string[read_pos])
)
) {
read_pos++;
}
} else if ((string[read_pos] == '\033') && (read_pos < bytes - 1) && (string[read_pos + 1] == ']')) {
/* Skip OSC - ends with BEL or ST (ESC \). */
read_pos += 2;
while (read_pos < bytes - 1) {
if (string[read_pos] == '\007') {
break;
}
if ((string[read_pos] == '\033') && (string[1 + read_pos] == '\\')) {
read_pos++;
break;
}
read_pos++;
}
} else {
/* Don't skip, copy across. */
raw_string[write_pos++] = string[read_pos];
}
}
raw_string[write_pos] = '\0';
raw_bytes = write_pos;
width = raw_bytes;
#if defined(ENABLE_NLS) && defined(HAVE_WCHAR_H)
/*@-nullpass@ */
/*
* splint note: mbstowcs() manual page on Linux explicitly says it
* takes NULL.
*/
wide_char_count = mbstowcs(NULL, raw_string, 0);
/*@+nullpass@ */
if (wide_char_count == (size_t) -1) {
debug("%s: %s: %s", "mbstowcs", raw_string, strerror(errno));
if (NULL != allocated_raw)
free(allocated_raw);
return raw_bytes;
}
wide_string_buffer_size = sizeof(*wide_string) * (1 + wide_char_count);
if (wide_string_buffer_size < sizeof(internal_wide)) {
wide_string = internal_wide;
} else {
allocated_wide = malloc(wide_string_buffer_size);
if (NULL == allocated_wide) {
pv_perror("%s", "malloc");
if (NULL != allocated_raw)
free(allocated_raw);
return raw_bytes;
}
wide_string = allocated_wide;
}
memset(wide_string, 0, wide_string_buffer_size);
if (mbstowcs(wide_string, raw_string, 1 + wide_char_count) == (size_t) -1) {
debug("%s: %s: %s", "mbstowcs", raw_string, strerror(errno));
} else if (NULL != wide_string) {
/*@-unrecog@ *//* splint doesn't see the prototype. */
width = wcswidth(wide_string, wide_char_count);
/*@+unrecog@ */
} else {
width = 0;
}
if (NULL != allocated_wide)
free(allocated_wide);
#endif /* defined(ENABLE_NLS) && defined(HAVE_WCHAR_H) */
if (NULL != allocated_raw)
free(allocated_raw);
return width;
}
/*
* Return true if the character is printable 7-bit ASCII. This function is
* used instead of the macro from <ctype.h> to avoid causing versioned glibc
* dependencies on some systems.
*/
bool pv_isprint(char c)
{
return ((c >= (char) 32) && (c <= (char) 126)) ? true : false;
}
+1211 -375
View File
File diff suppressed because it is too large Load Diff
+358 -179
View File
@@ -1,7 +1,7 @@
/*
* Functions for watching file descriptors in other processes.
*
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2024 Andrew Wood
* Copyright 2002-2008, 2010, 2012-2015, 2017, 2021, 2023-2026 Andrew Wood
*
* License GPLv3+: GNU GPL version 3 or later; see `docs/COPYING'.
*/
@@ -36,23 +36,27 @@
/*
* Set info->size to the size of the file info->file_fdpath points to,
* assuming that info->sb_fd has been populated by stat(), or to 0 if the
* file size could not be determined or the file was opened in write mode;
* returns false if the file was not a block device or regular file.
* assuming that info->sb_fd has already been populated by stat(), or to 0
* if the file size could not be determined or the file was opened in write
* mode; returns false if the file was not a block device or regular file.
*/
static bool filesize(pvwatchfd_t info)
{
if (NULL == info)
return false;
if (NULL == info->file_fdpath)
return false;
if (S_ISBLK(info->sb_fd.st_mode)) {
int fd;
/*
* Get the size of block devices by opening
* them and seeking to the end.
* Get the size of block devices by opening them and seeking
* to the end.
*/
fd = open(info->file_fdpath, O_RDONLY); /* flawfinder: ignore */
/*
* flawfinder: redirection check below; risk is minimal as
* we are not actually reading any data here.
* no reads are performed.
*/
if (fd >= 0) {
/*
@@ -72,10 +76,14 @@ static bool filesize(pvwatchfd_t info)
info->size = 0;
}
} else if (S_ISREG(info->sb_fd.st_mode)) {
/* Regular file - use its st_size. */
if ((info->sb_fd_link.st_mode & S_IWUSR) == 0) {
info->size = info->sb_fd.st_size;
}
} else {
/* Not a block device or a file, so the size is unknown. */
return false;
}
@@ -85,7 +93,23 @@ static bool filesize(pvwatchfd_t info)
/*@+type@*/
#ifdef __APPLE__
int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
/*
* Populate the "info" structure with the file paths and stat details of the
* process and file descriptor pair given within that structure.
*
* Returns nonzero on error - error codes are:
*
* -1 - info or state were NULL
* 1 - process does not exist
* 2 - not applicable (see the alternative pv_watchfd_info() below)
* 3 - lookup of the file descriptor destination failed
* 4 - file descriptor is not opened on a regular file
*
* If "automatic" is true, then this fd was picked automatically, and so if
* it's not readable or not a regular file, no error is reported with
* pv_error() when returning the error code.
*/
static int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
{
struct vnode_fdinfowithpath vnodeInfo = { };
@@ -96,7 +120,7 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
if (kill(info->watch_pid, 0) != 0) {
if (!automatic)
pv_error(state, "%s %u: %s", _("pid"), info->watch_pid, strerror(errno));
pv_perror("%s %u", _("pid"), info->watch_pid);
return 1;
}
@@ -105,26 +129,32 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
PROC_PIDFDVNODEPATHINFO, &vnodeInfo,
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));
pv_perror("%s %u: %s %d", _("pid"), info->watch_pid, _("fd"), info->watch_fd);
return 3;
}
strlcpy(info->file_fdpath, vnodeInfo.pvip.vip_path, PV_SIZEOF_FILE_FDPATH);
if (NULL != info->file_fdpath) {
free(info->file_fdpath);
info->file_fdpath = NULL;
}
info->file_fdpath = pv_strdup(vnodeInfo.pvip.vip_path);
if (NULL == info->file_fdpath) {
pv_perror("%s %u: %s %d", _("pid"), info->watch_pid, _("fd"), info->watch_fd);
return 3;
}
info->size = 0;
if (!(0 == stat(info->file_fdpath, &(info->sb_fd)))) {
if (!automatic)
pv_error(state, "%s %u: %s %d: %s: %s",
_("pid"),
info->watch_pid, _("fd"), info->watch_fd, info->file_fdpath, strerror(errno));
pv_perror("%s %u: %s %d: %s",
_("pid"), info->watch_pid, _("fd"), info->watch_fd, info->file_fdpath);
return 3;
}
if (!filesize(info)) {
if (!automatic)
pv_error(state, "%s %u: %s %d: %s: %s",
pv_error("%s %u: %s %d: %s: %s",
_("pid"),
info->watch_pid,
_("fd"), info->watch_fd, info->file_fdpath, _("not a regular file or block device"));
@@ -137,9 +167,8 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
#else
/*
* Fill in the given information structure with the file paths and stat
* details of the given file descriptor within the given process (given
* within the info structure).
* Populate the "info" structure with the file paths and stat details of the
* process and file descriptor pair given within that structure.
*
* Returns nonzero on error - error codes are:
*
@@ -150,10 +179,10 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
* 4 - file descriptor is not opened on a regular file
*
* If "automatic" is true, then this fd was picked automatically, and so if
* it's not readable or not a regular file, no error is displayed and the
* function just returns an error code.
* it's not readable or not a regular file, no error is reported with
* pv_error() when returning the error code.
*/
int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
static int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
{
if (NULL == state)
return -1;
@@ -162,43 +191,98 @@ int pv_watchfd_info(pvstate_t state, pvwatchfd_t info, bool automatic)
if (kill(info->watch_pid, 0) != 0) {
if (!automatic)
pv_error(state, "%s %u: %s", _("pid"), info->watch_pid, strerror(errno));
pv_perror("%s %u", _("pid"), info->watch_pid);
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);
memset(info->file_fdpath, 0, PV_SIZEOF_FILE_FDPATH);
if (readlink(info->file_fd, info->file_fdpath, PV_SIZEOF_FILE_FDPATH - 1) < 0) { /* flawfinder: ignore */
/*
* flawfinder: memset() has put \0 at the end already, and
* we tell readlink() to use 1 byte less than the buffer
* length, so \0 termination is assured. There is no
* mitigation for the risk of the link changing while we
* read it, but we are only reading from the destination,
* and then only if it's a block device - see filesize().
*/
/* Build the string containing the path to the /proc fdinfo file. */
if (NULL != info->file_fdinfo) {
free(info->file_fdinfo);
info->file_fdinfo = NULL;
}
if ((pv_asprintf(&(info->file_fdinfo), "/proc/%u/fdinfo/%d", info->watch_pid, info->watch_fd) < 0)
|| (NULL == info->file_fdinfo)) {
if (!automatic)
pv_error(state, "%s %u: %s %d: %s",
_("pid"), info->watch_pid, _("fd"), info->watch_fd, strerror(errno));
pv_perror("%s %u", _("pid"), info->watch_pid);
return 2;
}
if (!((0 == stat(info->file_fd, &(info->sb_fd)))
&& (0 == lstat(info->file_fd, &(info->sb_fd_link))))) {
/* Build the string containing the path to the /proc fd symlink. */
if (NULL != info->file_fdsymlink) {
free(info->file_fdsymlink);
info->file_fdsymlink = NULL;
}
if ((pv_asprintf(&(info->file_fdsymlink), "/proc/%u/fd/%d", info->watch_pid, info->watch_fd) < 0)
|| (NULL == info->file_fdsymlink)) {
if (!automatic)
pv_error(state, "%s %u: %s %d: %s: %s",
_("pid"),
info->watch_pid, _("fd"), info->watch_fd, info->file_fdpath, strerror(errno));
pv_perror("%s %u", _("pid"), info->watch_pid);
return 2;
}
/* Get a string containing the path that the /proc fd symlink points to. */
if (NULL != info->file_fdpath) {
free(info->file_fdpath);
info->file_fdpath = NULL;
}
/* Try buffers of different sizes - see readlink(2). */
{
size_t try_size;
for (try_size = 16; try_size <= 16384; try_size = try_size * 2) {
ssize_t bytes_stored;
if (NULL != info->file_fdpath) {
free(info->file_fdpath);
info->file_fdpath = NULL;
}
/*@-mustfreeonly@ *//* splint mis-detects this as a memory leak. */
info->file_fdpath = calloc(1, try_size);
/*@+mustfreeonly@ */
if (NULL == info->file_fdpath)
break;
bytes_stored = readlink(info->file_fdsymlink, info->file_fdpath, try_size - 1); /* flawfinder: ignore */
/*
* flawfinder: the risk is minimal, as no reads are
* performed.
*/
if (bytes_stored < 0) {
int old_errno;
old_errno = errno;
free(info->file_fdpath);
info->file_fdpath = NULL;
errno = old_errno;
break;
} else if (bytes_stored < (ssize_t) (try_size - 1)) {
info->file_fdpath[bytes_stored] = '\0';
break;
} else {
free(info->file_fdpath);
info->file_fdpath = NULL;
errno = ENAMETOOLONG;
}
}
}
if (NULL == info->file_fdpath) {
if (!automatic)
pv_perror("%s %u: %s %d", _("pid"), info->watch_pid, _("fd"), info->watch_fd);
return 2;
}
/* Run stat() on the /proc fd symlink and the path it points to. */
if (!((0 == stat(info->file_fdsymlink, &(info->sb_fd)))
&& (0 == lstat(info->file_fdsymlink, &(info->sb_fd_link))))) {
if (!automatic)
pv_perror("%s %u: %s %d: %s",
_("pid"), info->watch_pid, _("fd"), info->watch_fd, info->file_fdpath);
return 3;
}
/* Find the size of the path pointed to. */
info->size = 0;
if (!filesize(info)) {
if (!automatic)
pv_error(state, "%s %u: %s %d: %s: %s",
pv_error("%s %u: %s %d: %s: %s",
_("pid"),
info->watch_pid,
_("fd"), info->watch_fd, info->file_fdpath, _("not a regular file or block device"));
@@ -217,17 +301,22 @@ bool pv_watchfd_changed(pvwatchfd_t info)
#else
/*
* Return true if the given file descriptor has changed in some way since
* we started looking at it (i.e. changed destination or permissions).
* it was first detected (i.e. changed destination or permissions).
*/
bool pv_watchfd_changed(pvwatchfd_t info)
{
struct stat sb_fd, sb_fd_link;
if (NULL == info)
return false;
if (NULL == info->file_fdsymlink)
return false;
memset(&sb_fd, 0, sizeof(sb_fd));
memset(&sb_fd_link, 0, sizeof(sb_fd_link));
if ((0 == stat(info->file_fd, &sb_fd))
&& (0 == lstat(info->file_fd, &sb_fd_link))) {
if ((0 == stat(info->file_fdsymlink, &sb_fd))
&& (0 == lstat(info->file_fdsymlink, &sb_fd_link))) {
if ((sb_fd.st_dev != info->sb_fd.st_dev)
|| (sb_fd.st_ino != info->sb_fd.st_ino)
|| (sb_fd_link.st_mode != info->sb_fd_link.st_mode)
@@ -266,9 +355,14 @@ off_t pv_watchfd_position(pvwatchfd_t info)
long long pos_long;
FILE *fptr;
if (NULL == info)
return -1;
if (pv_watchfd_changed(info))
return -1;
if (NULL == info->file_fdinfo)
return -1;
fptr = fopen(info->file_fdinfo, "r"); /* flawfinder: ignore */
/* flawfinder: trusted location (/proc). */
if (NULL == fptr)
@@ -281,16 +375,30 @@ off_t pv_watchfd_position(pvwatchfd_t info)
(void) fclose(fptr);
#endif
/*
* This debugging line can be quite noisy - turned off for now,
* uncomment if needed.
*
* debug("pid:%d fd:%d position:%lld", (int) (info->watch_pid), info->watch_fd, position);
*/
return position;
}
#ifdef __APPLE__
/*
* Allocate an array of proc_fdinfo structs containing details of the file
* descriptors opened by process "pid", placing the pointer to the array
* into *fds and the number of entries in it into *count.
*
* Returns nonzero on error, and reports the error.
*/
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_perror("%s %u", _("pid"), pid);
return -1;
}
@@ -298,9 +406,10 @@ static int pidfds(pvstate_t state, unsigned int pid, struct proc_fdinfo **fds, i
*fds = (struct proc_fdinfo *) malloc(size_needed);
if (*fds == NULL) {
pv_error(state, "%s: alloc failed: %s", _("pid"), strerror(errno));
pv_perror("%s %u", _("pid"), pid);
return -1;
}
memset(*fds, 0, size_needed);
proc_pidinfo(pid, PROC_PIDLISTFDS, 0, *fds, size_needed);
@@ -321,7 +430,7 @@ static int pidfds(pvstate_t state, unsigned int pid, struct proc_fdinfo **fds, i
/*
* Extend the info array by one, returning false on error.
*/
static bool extend_info_array(int *array_length_ptr, pvwatchfd_t * info_array_ptr)
static bool extend_info_array(int *array_length_ptr, pvwatchfd_t *info_array_ptr)
{
int array_length = 0;
struct pvwatchfd_s *info_array = NULL;
@@ -346,6 +455,10 @@ static bool extend_info_array(int *array_length_ptr, pvwatchfd_t * info_array_pt
return false;
}
new_info_array[array_length - 1].unused = true;
debug("%s", "extended info array");
*info_array_ptr = new_info_array;
*array_length_ptr = array_length;
return true;
@@ -357,54 +470,128 @@ static bool extend_info_array(int *array_length_ptr, pvwatchfd_t * info_array_pt
/*
* Scan the given process and update the arrays with any new file
* descriptors.
* Reset calculated values in the given watchfd info structure.
*/
static void pv_reset_watchfd(pvwatchfd_t info)
{
if (NULL == info)
return;
pv_reset_calc(&(info->calc));
pv_reset_transfer(&(info->transfer));
pv_reset_flags(&(info->flags));
pv_reset_display(&(info->display));
}
/*
* Free dynamically allocated areas in the given watchfd info structure.
*/
void pv_freecontents_watchfd(pvwatchfd_t info)
{
if (NULL == info)
return;
pv_freecontents_calc(&(info->calc));
pv_freecontents_transfer(&(info->transfer));
pv_freecontents_display(&(info->display));
#ifdef __APPLE__
#else
if (NULL != info->file_fdinfo) {
free(info->file_fdinfo);
info->file_fdinfo = NULL;
}
if (NULL != info->file_fdsymlink) {
free(info->file_fdsymlink);
info->file_fdsymlink = NULL;
}
#endif
if (NULL != info->file_fdpath) {
free(info->file_fdpath);
info->file_fdpath = NULL;
}
}
/*
* Comparison function for qsort, to compare two pvwatchfd_s structures.
*/
static int pv_compare_watchfd(const void *a, const void *b)
{
int fd_a, fd_b;
fd_a = 0;
fd_b = 0;
if (NULL != a)
fd_a = ((pvwatchfd_t) a)->watch_fd;
if (NULL != b)
fd_b = ((pvwatchfd_t) b)->watch_fd;
if (fd_a < fd_b)
return -1;
if (fd_a > fd_b)
return 1;
return 0;
}
/*
* Scan the process "watch_pid" and update the arrays with any new file
* descriptors. If "watch_fd" is not -1, then all other file descriptor
* numbers will be ignored,
*
* Returns 0 on success, 1 if the process no longer exists or could not be
* read, or 2 for a memory allocation error.
*/
int pv_watchpid_scanfds(pvstate_t state,
pid_t watch_pid, int *array_length_ptr, pvwatchfd_t * info_array_ptr, int *fd_to_idx)
int pv_watchpid_scanfds(pvstate_t state, pid_t watch_pid, int watch_fd, int *array_length_ptr,
pvwatchfd_t *info_array_ptr)
{
int array_length = 0;
struct pvwatchfd_s *info_array = NULL;
bool changes_made;
#ifdef __APPLE__
struct proc_fdinfo *fd_infos = NULL;
int fd_infos_count = 0;
if (pidfds(state, watch_pid, &fd_infos, &fd_infos_count) != 0) {
pv_error(state, "%s: pidfds failed", _("pid"));
pv_error("%s %u: pidfds failed", _("pid"), watch_pid);
return -1;
}
#else
char fd_dir[512]; /* flawfinder: ignore - zeroed, bounded with pv_snprintf(). */
nullable_string_ptr fd_dir = NULL;
DIR *dptr;
struct dirent *d;
const struct dirent *d;
memset(fd_dir, 0, sizeof(fd_dir));
(void) pv_snprintf(fd_dir, sizeof(fd_dir), "/proc/%u/fd", watch_pid);
if ((pv_asprintf(&fd_dir, "/proc/%u/fd", watch_pid) < 0) || (NULL == fd_dir)) {
pv_perror("%s %u", _("pid"), watch_pid);
return 2;
}
dptr = opendir(fd_dir);
if (NULL == dptr)
if (NULL == dptr) {
free(fd_dir);
return 1;
}
free(fd_dir);
fd_dir = NULL;
#endif
array_length = *array_length_ptr;
info_array = *info_array_ptr;
changes_made = false;
#ifdef __APPLE__
if (fd_infos_count < 1) {
pv_error(state, "%s: no fds found", _("pid"));
pv_error("%s %u: no fds found", _("pid"), watch_pid);
return -1;
}
for (int i = 0; i < fd_infos_count; i++) {
#else
while ((d = readdir(dptr)) != NULL) {
#endif
int fd, check_idx, use_idx, rc;
int fd, check_idx, found_idx, use_idx, rc;
off_t position_now;
const char *use_format_string;
fd = -1;
#ifdef __APPLE__
@@ -412,23 +599,47 @@ int pv_watchpid_scanfds(pvstate_t state,
#else
if (sscanf(d->d_name, "%d", &fd) != 1)
continue;
if ((fd < 0) || (fd >= FD_SETSIZE))
continue;
#endif
/*
* Skip if this fd is already known to us.
*/
if (fd_to_idx[fd] != -1) {
/* Skip if the fd is negative. */
if (fd < 0)
continue;
/* If a watch_fd was specified, skip if this isn't it. */
if (watch_fd >= 0 && watch_fd != fd)
continue;
}
/*
* See if there's an empty slot we can re-use. An empty slot
* has a watch_pid of 0.
* Skip if this fd is already known.
*/
found_idx = -1;
for (check_idx = 0; check_idx < array_length && NULL != info_array; check_idx++) {
if (info_array[check_idx].unused)
continue;
if (info_array[check_idx].watch_fd != fd)
continue;
if (info_array[check_idx].closed) {
/*
* If the fd is known but closed,
* immediately free it for re-use.
*/
info_array[check_idx].unused = true;
info_array[check_idx].displayable = false;
pv_freecontents_watchfd(&(info_array[check_idx]));
continue;
}
found_idx = check_idx;
break;
}
if (found_idx >= 0)
continue;
/*
* Check for an empty slot to re-use.
*/
use_idx = -1;
for (check_idx = 0; check_idx < array_length; check_idx++) {
if (info_array[check_idx].watch_pid == 0) {
for (check_idx = 0; check_idx < array_length && NULL != info_array; check_idx++) {
if (info_array[check_idx].unused) {
use_idx = check_idx;
break;
}
@@ -445,62 +656,32 @@ int pv_watchpid_scanfds(pvstate_t state,
use_idx = array_length - 1;
}
/* At this point, the array should exist. */
if (NULL == info_array)
return 2;
debug("%s: %d => index %d", "found new fd", fd, use_idx);
changes_made = true;
/*
* Initialise the details of this new entry.
*/
memset(&(info_array[use_idx]), 0, sizeof(info_array[use_idx]));
pv_reset_watchfd(&(info_array[use_idx]));
info_array[use_idx].watch_pid = watch_pid;
info_array[use_idx].watch_fd = fd;
/* Allocate new display state. */
/*@-mustfreeonly@ *//* splint - this is not a leak, this is a new entry. */
info_array[use_idx].state = pv_state_alloc(state->status.program_name);
/*@+mustfreeonly@ */
if (NULL == info_array[use_idx].state)
return 2;
/* Copy the main status.cwd value to the new state. */
memcpy(&(info_array[use_idx].state->status.cwd), &(state->status.cwd), sizeof(state->status.cwd)); /* flawfinder: ignore */
/* flawfinder: bounded to destination object size. */
info_array[use_idx].closed = false;
info_array[use_idx].unused = false;
info_array[use_idx].displayable = true;
/*
* Copy over all the control values, blanking out the
* dynamically allocated strings, and setting the default
* format (fixed buffer) to the required format string
* instead of allocating a new dynamic format string for the
* copy (so there's less dynamic allocation going on).
* Set the average rate window so that a new history buffer
* is allocated for this state.
*/
memcpy(&(info_array[use_idx].state->control), &(state->control), sizeof(state->control)); /* flawfinder: ignore */
/* flawfinder: bounded to destination object size. */
/*@-mustfreeonly@ *//* splint - this is not a leak, this is a new entry. */
info_array[use_idx].state->control.name = NULL;
info_array[use_idx].state->control.format_string = NULL;
/*@+mustfreeonly@ */
info_array[use_idx].state->control.default_format[0] = '\0';
use_format_string =
NULL != state->control.format_string ? state->control.format_string : state->control.default_format;
if (NULL != use_format_string)
(void) pv_snprintf(info_array[use_idx].state->control.default_format, PV_SIZEOF_DEFAULT_FORMAT,
"%.510s", use_format_string);
/*
* Copy over all the display values, blanking out the
* dynamically allocated parts as above; then set the
* average rate window so that a new history buffer is
* allocated for this state.
*/
memcpy(&(info_array[use_idx].state->display), &(state->display), sizeof(state->display)); /* flawfinder: ignore */
/* flawfinder: bounded to destination object size. */
/*@-mustfreeonly@ *//* splint - this is not a leak, this is a new entry. */
info_array[use_idx].state->display.display_buffer = NULL;
info_array[use_idx].state->display.display_buffer_size = 0;
info_array[use_idx].state->display.history = NULL;
info_array[use_idx].state->display.history_len = 0;
/*@+mustfreeonly@ */
pv_state_average_rate_window_set(info_array[use_idx].state, state->control.average_rate_window);
(void) pv_update_calc_average_rate_window(&(info_array[use_idx].calc),
state->control.average_rate_window);
#ifdef __APPLE__
if (fd_infos[i].proc_fdtype != PROX_FDTYPE_VNODE) {
@@ -508,70 +689,33 @@ int pv_watchpid_scanfds(pvstate_t state,
}
#endif
/* Retrieve the details of this file descriptor. */
rc = pv_watchfd_info(state, &(info_array[use_idx]), true);
rc = pv_watchfd_info(state, &(info_array[use_idx]), -1 == watch_fd ? true : false);
/*
* Lookup failed - mark this slot as being free for re-use.
*/
if ((rc != 0) && (rc != 4)) {
debug("%s %d: %s: %d", "fd", fd, "lookup failed - marking slot for re-use", use_idx);
info_array[use_idx].watch_pid = 0;
if (NULL != info_array[use_idx].state)
pv_state_free(info_array[use_idx].state);
/*@-mustfreeonly@ *//* not a leak - we've just free()d it. */
info_array[use_idx].state = NULL;
/*@+mustfreeonly@ */
pv_freecontents_watchfd(&(info_array[use_idx]));
info_array[use_idx].unused = true;
info_array[use_idx].displayable = false;
continue;
}
fd_to_idx[fd] = use_idx;
/*
* Not displayable - set fd to -1 so the main loop doesn't
* show it.
* Not displayable - mark it as such so the main loop
* doesn't show it.
*/
if (rc != 0) {
debug("%s %d: %s", "fd", fd, "marking as not displayable");
info_array[use_idx].watch_fd = -1;
}
/* NULL check on the state - skip if not usable. */
if (NULL == info_array[use_idx].state) {
debug("%s %d: %s", "fd", fd, "state is NULL - marking as not displayable");
info_array[use_idx].watch_fd = -1;
continue;
}
/*
* Set the displayed size appropriately; if the size is 0,
* or not known, remove %e and %I from the state's default
* format string so that neither estimated time remaining
* nor estimated time of completion are displayed.
*/
info_array[use_idx].state->control.size = info_array[use_idx].size;
if (info_array[use_idx].state->control.size < 1) {
char *fmt;
while (NULL != (fmt = strstr(info_array[use_idx].state->control.default_format, "%e"))) {
debug("%s", "zero size - removing estimated time remaining");
/* strlen-1 here to include trailing \0 */
memmove(fmt, fmt + 2, strlen(fmt) - 1); /* flawfinder: ignore */
info_array[use_idx].state->flag.reparse_display = 1;
}
while (NULL != (fmt = strstr(info_array[use_idx].state->control.default_format, "%I"))) {
debug("%s", "zero size - removing estimated completion time");
/* strlen-1 here to include trailing \0 */
memmove(fmt, fmt + 2, strlen(fmt) - 1); /* flawfinder: ignore */
info_array[use_idx].state->flag.reparse_display = 1;
}
/* flawfinder: default_format is always \0-terminated. */
info_array[use_idx].displayable = false;
}
/* Set the info display_name appropriately. */
pv_watchpid_setname(state, &(info_array[use_idx]));
/* Carry the display_name through to the display state, and reparse. */
pv_state_name_set(info_array[use_idx].state, info_array[use_idx].display_name);
info_array[use_idx].state->flag.reparse_display = 1;
/* Force the display to be re-parsed. */
info_array[use_idx].flags.reparse_display = 1;
pv_elapsedtime_read(&(info_array[use_idx].start_time));
@@ -580,11 +724,11 @@ int pv_watchpid_scanfds(pvstate_t state,
* display), if known, so that ETA and so on are calculated
* correctly.
*/
info_array[use_idx].state->display.initial_offset = 0;
info_array[use_idx].display.initial_offset = 0;
info_array[use_idx].position = 0;
position_now = pv_watchfd_position(&(info_array[use_idx]));
if (position_now >= 0) {
info_array[use_idx].state->display.initial_offset = position_now;
info_array[use_idx].display.initial_offset = position_now;
info_array[use_idx].position = position_now;
}
}
@@ -596,6 +740,14 @@ int pv_watchpid_scanfds(pvstate_t state,
(void) closedir(dptr);
#endif
/*
* If any changes were made (i.e. new file descriptors were found),
* sort the array so that file descriptors are always displayed in
* ascending numerical order.
*/
if (changes_made && NULL != info_array && array_length > 1)
qsort(info_array, (size_t) array_length, sizeof(info_array[0]), pv_compare_watchfd);
return 0;
}
@@ -604,6 +756,9 @@ int pv_watchpid_scanfds(pvstate_t state,
* Set the display name for the given watched file descriptor, truncating at
* the relevant places according to the current screen width.
*
* If more than one distinct PID is being watched, include the PID in the
* name as well as the file descriptor number.
*
* If the file descriptor is pointing to a file under the current working
* directory, show its relative path, not the full path.
*/
@@ -611,14 +766,24 @@ void pv_watchpid_setname(pvstate_t state, pvwatchfd_t info)
{
size_t path_length, cwd_length;
int max_display_length;
char *file_fdpath = info->file_fdpath;
char *file_fdpath;
if (NULL == info)
return;
file_fdpath = info->file_fdpath;
memset(info->display_name, 0, PV_SIZEOF_DISPLAY_NAME);
if (NULL == file_fdpath)
return;
path_length = strlen(info->file_fdpath); /* flawfinder: ignore */
cwd_length = strlen(state->status.cwd); /* flawfinder: ignore */
cwd_length = 0;
if (NULL != state->status.cwd) {
cwd_length = strlen(state->status.cwd); /* flawfinder: ignore */
}
/* flawfinder: both strings are always \0 terminated. */
if (cwd_length > 0 && path_length > cwd_length) {
if (cwd_length > 0 && path_length > cwd_length && NULL != state->status.cwd) {
if (0 == strncmp(info->file_fdpath, state->status.cwd, cwd_length)) {
file_fdpath += cwd_length + 1;
path_length -= cwd_length + 1;
@@ -626,23 +791,37 @@ void pv_watchpid_setname(pvstate_t state, pvwatchfd_t info)
}
max_display_length = (int) (state->control.width / 2) - 6;
if (state->watchfd.multiple_pids)
max_display_length -= 9;
if (max_display_length >= (int) path_length) {
(void) pv_snprintf(info->display_name,
PV_SIZEOF_DISPLAY_NAME, "%4d:%.498s", info->watch_fd, file_fdpath);
if (state->watchfd.multiple_pids) {
(void) pv_snprintf(info->display_name,
PV_SIZEOF_DISPLAY_NAME, "%8d:%4d:%.498s", (int) (info->watch_pid),
info->watch_fd, file_fdpath);
} else {
(void) pv_snprintf(info->display_name,
PV_SIZEOF_DISPLAY_NAME, "%4d:%.498s", info->watch_fd, file_fdpath);
}
} else {
int prefix_length, suffix_length;
prefix_length = max_display_length / 4;
suffix_length = max_display_length - prefix_length - 3;
(void) pv_snprintf(info->display_name,
PV_SIZEOF_DISPLAY_NAME,
"%4d:%.*s...%.*s",
info->watch_fd, prefix_length,
file_fdpath, suffix_length, file_fdpath + path_length - suffix_length);
if (state->watchfd.multiple_pids) {
(void) pv_snprintf(info->display_name,
PV_SIZEOF_DISPLAY_NAME,
"%8d:%4d:%.*s...%.*s",
(int) (info->watch_pid), info->watch_fd, prefix_length,
file_fdpath, suffix_length, file_fdpath + path_length - suffix_length);
} else {
(void) pv_snprintf(info->display_name,
PV_SIZEOF_DISPLAY_NAME,
"%4d:%.*s...%.*s",
info->watch_fd, prefix_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);
}
/* EOF */
@@ -4,8 +4,11 @@
# 1MiB, described here:
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=586763
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
# Transfer 1500kB of data in a bursty fashion.
#
@@ -28,5 +31,3 @@ test "${lineLengthCount}" = "1" && exit 0
echo "variable line lengths detected"
tr '\r' '\n' < "${workFile1}"
exit 1
# EOF
@@ -3,8 +3,12 @@
# This is the same as the other display length at magnitude boundary check,
# but for rate, not bytes transferred.
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
# Transfer 1500kB of data in a bursty fashion.
#
@@ -29,5 +33,3 @@ test "${lineLengthCount}" = "1" && exit 0
echo "variable line lengths detected"
tr '\r' '\n' < "${workFile1}"
exit 1
# EOF
+24 -6
View File
@@ -2,8 +2,16 @@
#
# Test that "make install" installs the expected minimum set of files.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
if test "${XCTEST}" = "1"; then
echo "cross-compile flag set - skipping as local make will not run"
exit 77
fi
makeDir="${testSubject%/*}"
if ! test -d "${makeDir}"; then
@@ -21,8 +29,20 @@ if ! test -n "${testInstallDir}"; then
fi
export DESTDIR="${testInstallDir}"
if ! ${makeCommand} -C "${makeDir}" install DESTDIR="${testInstallDir}" >"${workFile1}" 2>&1; then
echo "\`make install' exited $?"
${makeCommand} -C "${makeDir}" install DESTDIR="${testInstallDir}" >"${workFile1}" 2>&1
rc=$?
if ! test "${rc}" -eq 0; then
if ! test "${makeCommand}" = "make"; then
# Retry with plain "make".
makeCommand="make"
${makeCommand} -C "${makeDir}" install DESTDIR="${testInstallDir}" >>"${workFile1}" 2>&1
rc=$?
fi
fi
if ! test ${rc} -eq 0; then
echo "\`make install' exited ${rc}"
echo "command: ${makeCommand} -C '${makeDir}' install DESTDIR='${testInstallDir}'"
cat "${workFile1}"
rm -rf "${testInstallDir}"
exit 1
fi
@@ -39,5 +59,3 @@ fi
rm -rf "${testInstallDir}"
exit "${exitStatus}"
# EOF
+5 -4
View File
@@ -3,8 +3,11 @@
# Check that the average transfer rate counter changes, but not more than it
# should.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
# Transfer 210 bytes as 100 bytes, a 1 second gap, 110 bytes, and another 1
# second gap.
@@ -27,5 +30,3 @@ test "${lineCount}" -lt 2 && exit 0
echo "average rate varied more than expected"
tr '\r' '\n' < "${workFile1}"
exit 1
# EOF
+5 -4
View File
@@ -2,8 +2,11 @@
#
# Check that the byte counter counts in bits when --bits is selected.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
dd if=/dev/zero bs=100 count=1 2>/dev/null \
| "${testSubject}" -f -b -8 >/dev/null 2>"${workFile1}"
@@ -13,5 +16,3 @@ test "${counterValue}" = "800b" && exit 0
echo "unexpected bit counter value: ${counterValue}"
exit 1
# EOF
+5 -4
View File
@@ -2,8 +2,11 @@
#
# Check that "--buffer-percent" displays correctly.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
# The output should show 100% and 0% as the buffer initially fills up due to
# there being nowhere to write it to, and then empties.
@@ -17,5 +20,3 @@ test "${differentLines}" -gt 1 && exit 0
echo "expected output changes not seen"
tr '\r' '\n' < "${workFile1}" | sed 's/^ *$/d' | sort | uniq
exit 1
# EOF
+5 -4
View File
@@ -2,8 +2,11 @@
#
# Check that the byte counter counts.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
dd if=/dev/zero bs=100 count=1 2>/dev/null \
| "${testSubject}" -f -b >/dev/null 2>"${workFile1}"
@@ -13,5 +16,3 @@ test "${counterValue}" = "100B" && exit 0
echo "unexpected byte counter value: ${counterValue}"
exit 1
# EOF
@@ -2,8 +2,11 @@
#
# Check that the estimated time counter counts.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
dd if=/dev/zero bs=100 count=1 2>/dev/null \
| "${testSubject}" -f -e -s 100 -i 0.1 -L 25 >/dev/null 2>"${workFile1}"
@@ -29,5 +32,3 @@ if ! test "${valueCount}" -lt 12; then
fi
exit 0
# EOF
@@ -2,8 +2,11 @@
#
# Check that the estimated time counter can show the end time of day.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
dd if=/dev/zero bs=100 count=1 2>/dev/null \
| "${testSubject}" -f -I -s 100 -i 0.1 -L 25 >/dev/null 2>"${workFile1}"
@@ -19,14 +22,12 @@ if ! test "${valueCount}" -gt 0; then
exit 1
fi
# 8 or more different values - not OK.
# 10 or more different values - not OK.
#
if ! test "${valueCount}" -lt 8; then
echo "more than 7 different values (${valueCount})"
if ! test "${valueCount}" -lt 10; then
echo "more than 9 different values (${valueCount})"
tr '\r' '\n' < "${workFile1}" | sed '/^ *$/d' | sort | uniq
exit 1
fi
exit 0
# EOF
+10 -6
View File
@@ -2,8 +2,11 @@
#
# Check that "--last-written" works.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
# Slowly write a sequence of numbers (rate-limited by another `pv' instance)
# and watch the "--last-written" output of a second `pv' instance to make
@@ -15,8 +18,11 @@ seq -w 3 1 100 \
differentLines=$(tr '\r' '\n' < "${workFile1}" | sed '/^ *$/d' | sort | uniq | wc -l | tr -dc '0-9')
lastLine=$(tr '\r' '\n' < "${workFile1}" | sed '/^ *$/d' | sed -n '$p')
if ! test "${differentLines}" -gt 5; then
echo "fewer than 6 different outputs seen"
# Even on very slow hosts, we should see at least 3 different output lines -
# nothing at the start, something in the middle, and the last few numbers at
# the end.
if ! test "${differentLines}" -gt 2; then
echo "fewer than 3 different outputs seen"
tr '\r' '\n' < "${workFile1}" | sed '/^ *$/d' | sort | uniq
exit 1
fi
@@ -30,5 +36,3 @@ if ! test "${lastLine}" = "${expectedLastLine}"; then
fi
exit 0
# EOF
+5 -4
View File
@@ -2,8 +2,11 @@
#
# Check that numeric output outputs some percentages.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
# Process 100 bytes at 100 bytes per second, updating every 0.1 seconds for
# around 10 output lines.
@@ -31,5 +34,3 @@ if ! test "${finalLine}" = "100"; then
fi
exit 0
# EOF
+13 -9
View File
@@ -3,8 +3,11 @@
# Check that numeric output gives a byte count instead of a percentage when
# used with -b.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
# Process 500 bytes at 500 bytes per second, updating every 0.1 seconds for
# around 10 output lines.
@@ -15,20 +18,21 @@ dd if=/dev/zero bs=500 count=1 2>/dev/null \
lineCount=$(wc -l < "${workFile1}" | tr -dc '0-9')
finalLine=$(sed -n '$p' < "${workFile1}")
# The number of output lines should be >8 and <13, and the final byte count
# The number of output lines should be >6 and <13, and the final byte count
# should be 500.
#
if ! test "${lineCount}" -gt 8; then
echo "fewer than 9 output lines (${lineCount})"
if ! test "${lineCount}" -gt 6; then
echo "fewer than 7 output lines (${lineCount}):"
cat "${workFile1}"
exit 1
fi
if ! test "${lineCount}" -lt 13; then
echo "more than 12 output lines (${lineCount})"
echo "more than 12 output lines (${lineCount}):"
cat "${workFile1}"
exit 1
fi
if ! test "${finalLine}" = "500"; then
echo "final byte count was not 500 (${finalLine})"
echo "final byte count was not 500 (${finalLine}):"
cat "${workFile1}"
exit 1
fi
# EOF
@@ -3,8 +3,12 @@
# Check that numeric output shows line counts instead of percentages, when
# used in line mode together with bytes mode.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"; workFile2="${workFile2:-.tmp2}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
true "${workFile2:?not set - call this from 'make check'}"
# Pass through 100 lines.
#
@@ -33,5 +37,3 @@ if ! test "${finalStdoutLine}" = "100"; then
fi
exit 0
# EOF
+11 -10
View File
@@ -2,8 +2,11 @@
#
# Check that numeric output gives a timer when used with -t.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
# Process 100 bytes at 100 bytes per second, updating every 0.1 seconds for
# around 10 output lines.
@@ -15,20 +18,20 @@ lineCount=$(wc -l < "${workFile1}" | tr -dc '0-9')
timesCount=$(tr ',' '.' < "${workFile1}" | awk '{print int(10*$1)}' | sort -n | uniq | wc -l | tr -dc '0-9')
finalPercentage=$(sed -n '$p' < "${workFile1}" | awk '{print $2}')
# The number of output lines should be >8 and <13, and the number of
# different elapsed times should be at least 7. The last percentage should
# The number of output lines should be >7 and <13, and the number of
# different elapsed times should be at least 6. The last percentage should
# be 100.
#
if ! test "${lineCount}" -gt 8; then
echo "fewer than 9 output lines (${lineCount})"
if ! test "${lineCount}" -gt 7; then
echo "fewer than 8 output lines (${lineCount})"
exit 1
fi
if ! test "${lineCount}" -lt 13; then
echo "more than 12 output lines (${lineCount})"
exit 1
fi
if ! test "${timesCount}" -gt 7; then
echo "fewer than 8 different elapsed times (${timesCount})"
if ! test "${timesCount}" -gt 5; then
echo "fewer than 6 different elapsed times (${timesCount})"
exit 1
fi
if ! test "${finalPercentage}" = "100"; then
@@ -37,5 +40,3 @@ if ! test "${finalPercentage}" = "100"; then
fi
exit 0
# EOF
@@ -2,8 +2,11 @@
#
# Check that the progress bar moves when data is coming in.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
dd if=/dev/zero bs=100 count=1 2>/dev/null \
| "${testSubject}" -f -p -i 0.1 -L 500 >/dev/null 2>"${workFile1}"
@@ -18,5 +21,3 @@ if ! test "${lineCount}" -gt 2; then
fi
exit 0
# EOF
+5 -4
View File
@@ -2,8 +2,11 @@
#
# Check that the progress bar increases in size when data is coming in.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
dd if=/dev/zero bs=100 count=1 2>/dev/null \
| "${testSubject}" -f -p -i 0.1 -L 50 -s 100 >/dev/null 2>"${workFile1}"
@@ -28,5 +31,3 @@ if ! test "${differentBarLengthsCount}" -gt 5; then
fi
exit 0
# EOF
+5 -4
View File
@@ -2,8 +2,11 @@
#
# Check that the -q option shuts everything up.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
dd if=/dev/zero bs=1000 count=5 2>/dev/null \
| "${testSubject}" -f -q -i 0.1 -L 5000 >/dev/null 2>"${workFile1}"
@@ -15,5 +18,3 @@ if test -s "${workFile1}"; then
fi
exit 0
# EOF
@@ -2,8 +2,11 @@
#
# Check that the transfer rate counter changes.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
# Transfer 200 bytes as two 100-byte blocks with a 2-second gap between.
#
@@ -27,5 +30,3 @@ if ! test "${rateCount}" -gt 2; then
fi
exit 0
# EOF
@@ -2,8 +2,11 @@
#
# Check that the elapsed time counter does count up.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
# Transfer a zero amount of data, but take 3 seconds to do it.
#
@@ -18,5 +21,3 @@ if ! test "${valueCount}" -gt 1; then
fi
exit 0
# EOF
+5 -4
View File
@@ -3,8 +3,11 @@
# Check that the process ID can be written to a file as described in the
# manual.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
# Check we can run "kill -s 0".
if ! kill -s 0 $$ >/dev/null 2>&1; then
@@ -46,5 +49,3 @@ if ! test "${pidValid}" = "1"; then
fi
exit 0
# EOF
@@ -2,8 +2,10 @@
#
# Check that size arguments are processed correctly.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
# Pass size argument $1 and check that the last reported number is $2.
checkSizeArgument () {
@@ -20,5 +22,3 @@ checkSizeArgument 1M 1048576
checkSizeArgument 8G 8589934592
exit 0
# EOF
+4 -4
View File
@@ -2,8 +2,10 @@
#
# Check that data can be just passed straight through.
# Dummy assignment for "shellcheck".
testSubject="${testSubject:-false}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
inputString="TESTING"
outputString=$(printf "%s" "${inputString}" | "${testSubject}" 2>/dev/null) || { echo "unexpected failure code"; exit 1; }
@@ -23,5 +25,3 @@ if ! test "${inputString}" = "${outputString}"; then
fi
exit 0
# EOF
+6 -4
View File
@@ -3,8 +3,12 @@
# Transfer a large chunk of data through pv and check data correctness
# afterwards.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"; workFile2="${workFile2:-.tmp2}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
true "${workFile2:?not set - call this from 'make check'}"
# generate some data
dd if=/dev/urandom of="${workFile1}" bs=1024 count=10240 2>/dev/null
@@ -19,5 +23,3 @@ outputChecksum=$(cksum "${workFile2}" | awk '{print $1}')
test "${inputChecksum}" = "${outputChecksum}" || exit 1
exit 0
# EOF
+6 -4
View File
@@ -3,8 +3,12 @@
# Transfer a large chunk of data through pv using pipes, sending it in a
# bursty fashion, and check data correctness afterwards.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"; workFile2="${workFile2:-.tmp2}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
true "${workFile2:?not set - call this from 'make check'}"
# generate some data
dd if=/dev/urandom of="${workFile1}" bs=1024 count=10240 2>/dev/null
@@ -52,5 +56,3 @@ if ! test "${inputChecksum}" = "${outputChecksum}"; then
fi
exit 0
# EOF
+6 -4
View File
@@ -2,8 +2,12 @@
#
# Make sure that files larger than 2GB are supported.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"; workFile2="${workFile2:-.tmp2}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
true "${workFile2:?not set - call this from 'make check'}"
# Check there is enough free space for this test.
workFile1Dir="${workFile1%/*}"
@@ -76,5 +80,3 @@ if ! test "${bytesReported}" -eq "${fileSize}"; then
fi
exit 0
# EOF
+32
View File
@@ -0,0 +1,32 @@
#!/bin/sh
#
# Check that EOF does not wait forever when the output pipe reader exits
# without consuming bytes already written into the pipe.
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
TIMEOUT=""
if command -v timeout >/dev/null 2>&1; then
TIMEOUT="timeout"
elif command -v gtimeout >/dev/null 2>&1; then
TIMEOUT="gtimeout"
else
echo "timeout command not available"
exit 77
fi
# The reader keeps the pipe open briefly but reads nothing. When it exits,
# PV has no further input, so it must notice the closed reader without
# relying on a later write returning EPIPE.
if ! "${TIMEOUT}" 4 sh <<EOF
printf "x" | "${testSubject}" -q -B 1 | sleep 1
EOF
then
echo "PV did not finish after the output pipe reader exited"
exit 1
fi
exit 0
+37
View File
@@ -0,0 +1,37 @@
#!/bin/sh
#
# Check that EOF does not wait forever when the upstream producer exits with
# failure and the output pipe reader exits without consuming buffered bytes.
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
TIMEOUT=""
if command -v timeout >/dev/null 2>&1; then
TIMEOUT="timeout"
elif command -v gtimeout >/dev/null 2>&1; then
TIMEOUT="gtimeout"
else
echo "timeout command not available"
exit 77
fi
if ! command -v gzip >/dev/null 2>&1; then
echo "gzip command not available"
exit 77
fi
# The producer fails immediately and writes no data. gzip still emits a small
# valid empty stream, so PV writes bytes to its output pipe before reaching EOF.
# The reader keeps the pipe open briefly but consumes nothing.
if ! "${TIMEOUT}" 4 sh <<EOF
false | gzip -1 -c -n | "${testSubject}" -q -B 1 | sleep 1
EOF
then
echo "PV did not finish after the input producer failed and the output reader exited"
exit 1
fi
exit 0
+4 -4
View File
@@ -2,8 +2,10 @@
#
# Check that there is no SIGPIPE or dropped data on bigger data transfers.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
# We nead GNU head. On some platforms it is named ghead instead of head.
HEAD="head"
@@ -36,5 +38,3 @@ if ! test "${stopAtByteCount}" = "${bytesTransferred}"; then
fi
exit 0
# EOF
+14 -5
View File
@@ -3,8 +3,14 @@
# Try repeatedly messaging a transfer process, and make sure the data stays
# intact.
# Dummy assignments for "shellcheck".
testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"; workFile2="${workFile2:-.tmp2}"; workFile3="${workFile3:-.tmp3}"; workFile4="${workFile4:-.tmp4}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
true "${workFile2:?not set - call this from 'make check'}"
true "${workFile3:?not set - call this from 'make check'}"
true "${workFile4:?not set - call this from 'make check'}"
# Do nothing if it is not supported.
if ! "${testSubject}" -h 2>/dev/null | grep -Eq "^ -R,"; then
@@ -12,14 +18,17 @@ if ! "${testSubject}" -h 2>/dev/null | grep -Eq "^ -R,"; then
exit 77
fi
# Generate some data.
# Generate 10MiB of data.
dd if=/dev/urandom of="${workFile1}" bs=1024 count=10240 2>/dev/null
# Run a few remote control commands in the background.
#
echo FAIL > "${workFile3}"
true > "${workFile4}"
(
set +e
# Don't start doing anything until the main transfer process, started below, has begun.
while test -e "${workFile4}" && ! test -s "${workFile4}"; do sleep 0.1; done
sleep 2
for loopCount in 1 2 3; do
"${testSubject}" -R "$(cat "${workFile4}")" -apterb || exit 1
@@ -30,6 +39,8 @@ for loopCount in 1 2 3; do
(usleep 200000 || sleep 1) 2>/dev/null
"${testSubject}" -R "$(cat "${workFile4}")" -F "%e" || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
"${testSubject}" -R "$(cat "${workFile4}")" -x "window:%b" || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
"${testSubject}" -R "$(cat "${workFile4}")" -N "." || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
echo "${loopCount}" >/dev/null # dummy for shellcheck
@@ -57,5 +68,3 @@ if ! test "${inputChecksum}" = "${outputChecksum}"; then
fi
exit 0
# EOF
+9 -4
View File
@@ -3,8 +3,15 @@
# Run valgrind's memory checker against a process using various different
# transfer options.
# Dummy assignments for "shellcheck".
sourcePath="${sourcePath:-.}"; testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"; workFile2="${workFile2:-.tmp2}"; workFile3="${workFile3:-.tmp3}"; workFile4="${workFile4:-.tmp4}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${sourcePath:?not set - call this from 'make check'}"
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
true "${workFile2:?not set - call this from 'make check'}"
true "${workFile3:?not set - call this from 'make check'}"
true "${workFile4:?not set - call this from 'make check'}"
# Load the valgrind function.
. "${sourcePath}/tests/run-valgrind.sh"
@@ -34,5 +41,3 @@ seq -w 3 1 100 \
| { runWithValgrind -bnl -i 0.2 -f -L 100 2>"${workFile1}" > "${workFile2}"; } 4>&1 || exit 1
exit 0
# EOF
+33
View File
@@ -0,0 +1,33 @@
#!/bin/sh
#
# Run valgrind's memory checker against a process that sets is process
# title.
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${sourcePath:?not set - call this from 'make check'}"
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
true "${workFile2:?not set - call this from 'make check'}"
true "${workFile3:?not set - call this from 'make check'}"
true "${workFile4:?not set - call this from 'make check'}"
# Load the valgrind function.
. "${sourcePath}/tests/run-valgrind.sh"
# Without an extra format string.
(dd if=/dev/zero bs=100 count=1 2>/dev/null;
sleep 1;
dd if=/dev/zero bs=110 count=1 2>/dev/null;
sleep 1;
) | { runWithValgrind -f -i 0.5 -a -x processtitle >/dev/null 2>"${workFile1}"; } 4>&1 || exit 1
# With an extra format string.
(dd if=/dev/zero bs=100 count=1 2>/dev/null;
sleep 1;
dd if=/dev/zero bs=110 count=1 2>/dev/null;
sleep 1;
) | { runWithValgrind -f -i 0.5 -a -x 'processtitle:%t %b' >/dev/null 2>"${workFile1}"; } 4>&1 || exit 1
exit 0
@@ -2,8 +2,15 @@
#
# Run valgrind's memory checker while receiving remote control commands.
# Dummy assignments for "shellcheck".
sourcePath="${sourcePath:-.}"; testSubject="${testSubject:-false}"; workFile1="${workFile1:-.tmp1}"; workFile2="${workFile2:-.tmp2}"; workFile3="${workFile3:-.tmp3}"; workFile4="${workFile4:-.tmp4}"
# Allow all tests to be skipped, e.g. during a release build
test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${sourcePath:?not set - call this from 'make check'}"
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
true "${workFile2:?not set - call this from 'make check'}"
true "${workFile3:?not set - call this from 'make check'}"
true "${workFile4:?not set - call this from 'make check'}"
# Do nothing if it is not supported.
if ! "${testSubject}" -h 2>/dev/null | grep -Eq "^ -R,"; then
@@ -20,7 +27,7 @@ dd if=/dev/urandom of="${workFile1}" bs=1024 count=10240 2>/dev/null
true > "${workFile3}"
(
set +e
while ! test -s "${workFile3}"; do usleep 200000 2>/dev/null || sleep 1; done
while test -e "${workFile3}" && ! test -s "${workFile3}"; do usleep 200000 2>/dev/null || sleep 1; done
for loopCount in 1 2 3; do
"${testSubject}" -R "$(cat "${workFile3}")" -apterb || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
@@ -30,6 +37,8 @@ for loopCount in 1 2 3; do
(usleep 200000 || sleep 1) 2>/dev/null
"${testSubject}" -R "$(cat "${workFile3}")" -F "%e" || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
"${testSubject}" -R "$(cat "${workFile3}")" -x "window:%b" || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
"${testSubject}" -R "$(cat "${workFile3}")" -N "." || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
echo "${loopCount}" >/dev/null # dummy for shellcheck
@@ -39,5 +48,3 @@ done
{ runWithValgrind -L 100k -i 0.1 -f -P "${workFile3}" "${workFile1}" > "${workFile2}" 2>/dev/null; } 4>&1 || exit 1
exit 0
# EOF

Some files were not shown because too many files have changed in this diff Show More