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

9front - general discussion about 9front

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/9front

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 9front 9front/ http://inbox.vuxu.org/9front \
		9front@9front.org
	public-inbox-index 9front

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.9front


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git