Commit Graph
51 Commits
Author SHA1 Message Date
Devel08andGitHub e4987f0dbd pr: exit with code 1 if --column argument is zero (#11750) 2026-04-20 22:41:53 +02:00
cerdelenandGitHub 42e3ab6e49 pr: implement the -e flag (#10167)
* pr: new functionality: expand-tabs + tests

pr: rebase

* pr: pipe test input instead of using files

* pr: parameterize tests
2026-02-14 10:10:43 -08:00
Jeffrey FinkelsteinandSylvestre Ledru a5aa2a89f7 pr: fix column behavior for short files
Fix a bug where lines of the input file were not correctly distributed
to the columns of the output page if there were fewer lines than the
total number of cells in the output table. For example, before this
commit,

    printf "a\nb\n" | pr -2

would incorrectly produce an output page like this:

    a
    b

After this commit, it produces a more correct output page like this:

    a    b
2026-02-04 22:53:15 +01:00
Jeffrey FinkelsteinandSylvestre Ledru be0180747c pr: add passing tests for merging files
Add a passing unit tests for `pr` for merging two files.
2026-02-04 22:53:15 +01:00
425b232a50 pr: ignore empty line after newline char (#10332)
Fix a bug in `pr` where a form feed character (`\f`) immediately
following a newline character (`\n`) was incorrectly rendered as an
extra blank line in the output when running with the `-f` option. After
this commit, the empty line is correctly ignored.

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2026-01-19 03:20:35 -08:00
jfinkelsandGitHub 597361324c pr: ignore empty line after form feed char (#10331)
Fix a bug in `pr` where a newline character (`\n`) immediately following
a form feed character (`\f`) was incorrectly rendered as an extra blank
line in the output. After this commit, the newline is correctly ignored.
2026-01-19 09:14:50 +01:00
Jeffrey FinkelsteinandSylvestre Ledru 1a81d1bb6b pr: uniformly scan for form feed and newline chars
Fix the way form feed characters are interpreted by changing the way
lines and pages are found. Before this commit, a file comprising two
form feed characters (`/f/f`) would result in too few trailing newlines
at the end of the second page. After this change, each page is produced
with the correct number of lines.

This commit changes the way files are read, replacing complex iterators
with a loop-based approach, iteratively scanning for newline or form
feed characters. The `memchr` library is used to efficiently scan for
these two characters. One downside of this implementation is that it
currently reads the entire input file into memory; this can be improved
in subsequent merge requests.
2026-01-18 20:26:40 +01:00
Jeffrey FinkelsteinandSylvestre Ledru 500604287b pr: remove inaccurate unit test
Remove unit test for `pr` that was enforcing incorrect behavior. These
tests were ostensibly designed to match corresponding ones in the GNU
test suite, but they don't match the current behavior of GNU `pr`, so it
is not valuable to keep them.
2026-01-18 20:26:40 +01:00
Daniel HofstetterandGitHub da664ecbc7 Merge pull request #10107 from ChrisDryden/pr-omit-pagination
pr: add -T/--omit-pagination option
2026-01-08 16:43:43 +01:00
Aaron Ang 6a844812cf refactor: use jiff for safer time features 2026-01-07 22:54:18 -08:00
Christopher Dryden 25d50515c4 pr: add -T/--omit-pagination option 2026-01-07 18:23:47 +00:00
Chris DrydenandGitHub ce8c8d57af pr: add default values for -s and -S separator options (#10073)
* pr: add default values for -s and -S separator options

* pr: fix -S default value to space, simplify test
2026-01-07 16:06:52 +01:00
Jeffrey Finkelstein bfdbf59646 pr: use 72 char line width for all page headers
Set the default line width to 72 for all page headers in `pr`,
regardless of whether a custom date format is being used. Before, a
single space was used to separate the three components of the header
(date, filename, and page number) if a custom date format was not given.
2026-01-04 18:36:33 -05:00
Christopher Dryden 0e85a93c6c pr: add -b flag for backwards compatibility 2026-01-02 20:22:28 +00:00
Saathwik DasariandGitHub b600c257ef pr: allow character, block, and fifo devices as input (#9946) 2026-01-01 12:36:58 +01:00
Sylvestre Ledru fa82066cee pr: fix header formatting for custom date formats starting with '+'
Should fix tests/misc/time-style.sh
2025-11-13 21:14:44 +01:00
Daniel Hofstetter 1e50dc4c33 pr: reduce nesting to improve readability
of file_last_modified_time_format()
2025-07-31 17:00:28 +02:00
Nicolas Boichat 82cb88ac0d test_pr: Use new_ucmd!() directly 2025-07-31 22:08:56 +08:00
Nicolas Boichat d35a60e5e2 pr: Add support for -D/--date-format parameter 2025-07-31 15:45:31 +08:00
Nicolas Boichat 4878e65ea7 pr: Set date format depending on environment.
Based on GNU manual.
2025-07-31 15:45:31 +08:00
Dorian Peron 6e23d4e979 tests: patch tests to simplify imports 2025-07-01 03:36:46 +02:00
Sylvestre Ledru a0179ea239 uutests: adjust the tests to use them 2025-03-28 21:40:31 +01:00
Daniel Hofstetter df4dfea852 tests: replace run() with succeeds() or fails() 2025-03-09 16:53:56 +01:00
Sylvestre Ledru 18cb7dcf9e Use the new function fails_with_code
Done with
```
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.no_stdout\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2)\n\1.no_stdout();/gs' *rs
$ sed -i -e "s|.fails()(.*).code_is(|.fails_with_code(|g" *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2);/gs' *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)(.*?)[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\3)\2;/gs' *rs
...
```
2025-03-01 17:26:20 +01:00
Ben Wiederhake 9527341714 pr: return correct exit code on error 2024-04-14 15:42:13 +02:00