From ac16a38b4ae477e403bddb168af1de52d0943af8 Mon Sep 17 00:00:00 2001 From: Michael Mikonos <127171689+mknos@users.noreply.github.com> Date: Fri, 29 Dec 2023 20:47:21 +0800 Subject: [PATCH] pr: fail for -3x option * GNU pr and OpenBSD pr read option -3x as -3 -x * An error is raised because -x is not a valid option * This version was incorrectly absorbing non-digits after the "-3" * Removing the dot-match makes this version consistent * redo statement allows -x to be interpreted as the next option after $columns is set to 3 --- bin/pr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/pr b/bin/pr index 770e7244..76d11703 100755 --- a/bin/pr +++ b/bin/pr @@ -125,9 +125,9 @@ while (@ARGV && $ARGV[0] =~ /^-(.+)/ && (shift, ($_ = $1), 1)) { } # Accept -2, -3, etc... - if (s/^(\d.*)//) { + if (s/\A([0-9]+)//) { $columns = $1; - next OPTION; + redo OPTION; } usage("unexpected option: -$_");