9front - general discussion about 9front
 help / color / mirror / Atom feed
* dnsquery(8): prompt on stderr
@ 2019-08-30  9:13 vp
  0 siblings, 0 replies; only message in thread
From: vp @ 2019-08-30  9:13 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 328 bytes --]

dnsquery(8) prints the interactive prompt on stdout together with
query results, making scripted usage unnecessarily difficult.

A straightforward solution is prompting on stderr instead: as
practiced by rc(1), among many others -- promptly taking care of
the issue:

	; echo 9front.org mx | ndb/dnsquery >[2]/dev/null

--
kvik

[-- Attachment #2: dnsquery.diff --]
[-- Type: text/plain, Size: 423 bytes --]

diff -r 7789bbc91c22 sys/src/cmd/ndb/dnsquery.c
--- a/sys/src/cmd/ndb/dnsquery.c	Fri Aug 23 21:39:20 2019 +0200
+++ b/sys/src/cmd/ndb/dnsquery.c	Fri Aug 30 10:20:33 2019 +0200
@@ -58,7 +58,7 @@
 	Biobuf in;
 
 	Binit(&in, 0, OREAD);
-	for(print("> "); lp = Brdline(&in, '\n'); print("> ")){
+	for(fprint(2, "> "); lp = Brdline(&in, '\n'); fprint(2, "> ")){
 		n = Blinelen(&in) -1;
 		while(isspace(lp[n]))
 			lp[n--] = 0;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-08-30 11:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-30  9:13 dnsquery(8): prompt on stderr vp

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).