9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] crop: allow no-ops in pipelines
@ 2021-04-12  0:05 qwx
  2021-04-12  1:51 ` cinap_lenrek
  0 siblings, 1 reply; 3+ messages in thread
From: qwx @ 2021-04-12  0:05 UTC (permalink / raw)
  To: 9front

Hello,

Any objections to pushing this change?

Thanks,

qwx

--
crop: allow no-ops in 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 it.

diff -r 936eda80a52f sys/src/cmd/crop.c
--- a/sys/src/cmd/crop.c	Sat Apr 10 15:01:09 2021 +0200
+++ b/sys/src/cmd/crop.c	Mon Apr 12 02:01:12 2021 +0200
@@ -148,9 +148,6 @@
 		usage();
 	}ARGEND
 
-	if(mode == None && cropval == 0 && eqpt(ZP, t))
-		usage();
-
 	file = "<stdin>";
 	fd = 0;
 	if(argc > 1)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9front] crop: allow no-ops in pipelines
  2021-04-12  0:05 [9front] crop: allow no-ops in pipelines qwx
@ 2021-04-12  1:51 ` cinap_lenrek
  2021-04-12  8:30   ` qwx
  0 siblings, 1 reply; 3+ messages in thread
From: cinap_lenrek @ 2021-04-12  1:51 UTC (permalink / raw)
  To: 9front

> crop: allow no-ops in pipelines

yes, agree.

--
cinap

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9front] crop: allow no-ops in pipelines
  2021-04-12  1:51 ` cinap_lenrek
@ 2021-04-12  8:30   ` qwx
  0 siblings, 0 replies; 3+ messages in thread
From: qwx @ 2021-04-12  8:30 UTC (permalink / raw)
  To: 9front

Thanks, pushed.

Cheers,

qwx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-12  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12  0:05 [9front] crop: allow no-ops in pipelines qwx
2021-04-12  1:51 ` cinap_lenrek
2021-04-12  8:30   ` qwx

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).