]> git.lizzy.rs Git - plan9front.git/commitdiff
crop: allow no-ops for pipelines
authorqwx <devnull@localhost>
Mon, 12 Apr 2021 08:29:54 +0000 (10:29 +0200)
committerqwx <devnull@localhost>
Mon, 12 Apr 2021 08:29:54 +0000 (10:29 +0200)
unlike other tools like iconv(1), a crop(1) without arguments or with
ones resulting in a no-op, like `-t 0 0', errors out.  other options
like `-i 0' do not error.  this breaks assumptions and results in
tedious intermediary steps or hacks like:

foo | {crop -t $1 $2 >[2]/null || cat} > baz.bit

instead, just ignore the check.  subsequent code doesn't make
assumptions on that.

sys/src/cmd/crop.c

index c1234e26d631e396a01f505abd835063cec7a757..f6a4684b3b3d4d5339b770127af685b68b8923aa 100644 (file)
@@ -148,9 +148,6 @@ main(int argc, char *argv[])
                usage();
        }ARGEND
 
-       if(mode == None && cropval == 0 && eqpt(ZP, t))
-               usage();
-
        file = "<stdin>";
        fd = 0;
        if(argc > 1)