Stop accepting more args than the optional format string and explicitly
read only from stdin.

In the linked Debian bug report, a detailed description about irregular
behaviour of ts with special extra args is available.

Reported-by: Zefram <zef...@fysh.org>
Co-developed-by: Zefram <zef...@fysh.org>
Link: https://bugs.debian.org/1041291#5
Signed-off-by: Nicolas Schier <nico...@fjasle.eu>
---
 ts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ts b/ts
index 71b0fbc..982c164 100755
--- a/ts
+++ b/ts
@@ -67,7 +67,7 @@ GetOptions(
        "i" => \$inc,
        "s" => \$sincestart,
        "m" => \$mono
-) || die "usage: ts [-r] [-i | -s] [-m] [format]\n";
+) && @ARGV <= 1 or die "usage: ts [-r] [-i | -s] [-m] [format]\n";
 
 if ($rel) {
        eval q{
@@ -111,7 +111,7 @@ else {
 }
 
 
-while (<>) {
+while (<STDIN>) {
        if (! $rel) {
                if ($hires) {
                        my $f=$format;
-- 
2.42.0

Reply via email to