shithub: plan9front

Download patch

ref: dc8da7c232006a6894fd8742ee38c7bdfbc6d702
parent: 5fb37e15b68c5a523485edef7190a1fead96944a
author: qwx <devnull@localhost>
date: Mon Apr 12 04:29:54 EDT 2021

crop: allow no-ops for pipelines

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.

--- a/sys/src/cmd/crop.c	Sun Apr 11 17:58:30 2021
+++ b/sys/src/cmd/crop.c	Mon Apr 12 04:29:54 2021
@@ -148,9 +148,6 @@
 		usage();
 	}ARGEND
 
-	if(mode == None && cropval == 0 && eqpt(ZP, t))
-		usage();
-
 	file = "<stdin>";
 	fd = 0;
 	if(argc > 1)