Date: Sat, 12 Aug 1995 14:01:24 -0700 (PDT) From: "Rodney W. Grimes" <rgrimes@gndrsh.aac.dev.com> To: obrien@leonardo.net (Mike O'Brien) Cc: hackers@freebsd.org Subject: Re: minor frob for 'finger' Message-ID: <199508122101.OAA07653@gndrsh.aac.dev.com> In-Reply-To: <199508121042.KAA00405@mr-p.protocorp.com> from "Mike O'Brien" at Aug 12, 95 10:42:33 am
next in thread | previous in thread | raw e-mail | index | archive | help
>
> Longtime ARPAnauts will remember that 'finger' used to work
> a little differently over the net - the closing brace around the
> host name was not printed until a net connection had been successfully
> established. That code broke in the UNIX version when stdout to a
> terminal was made line-buffered by default...and now I see the original
> code (which must have looked very mysterious) has disappeared entirely,
> in favor of having the host name printed before the connection rather
> than after, which was the effect of the breakage.
>
> I'm sorry, but I'm an old fart. I prefer finger's original
> behavior. Hence, this patch, humbly proffered:
I like the old behavior too, but this creates ugly error output.
Also please don't cut and paste patches with X, you destroyed the
tabs in this patch meaning I had to go frob the file after doing a
patch -i to put back the tabs instead of spaces :-(.
Here is what an error looks like with your patch in place:
gndrsh# obj/finger rgrimes@freebsd.org
[freebsd.org
finger: connect: Network is down
Here is my revised patch, this time without white space munging to
apply it:
Index: net.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/finger/net.c,v
retrieving revision 1.3
diff -c -r1.3 net.c
*** 1.3 1995/05/30 06:30:16
--- net.c 1995/08/12 21:00:53
***************
*** 95,106 ****
}
/* have network connection; identify the host connected with */
! (void)printf("[%s]\n", hp->h_name);
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
perror("finger: connect");
(void)close(s);
return;
}
/* -l flag for remote fingerd */
if (lflag)
--- 95,109 ----
}
/* have network connection; identify the host connected with */
! (void)printf("[%s", hp->h_name);
! (void)fflush(stdout);
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
+ (void)printf("]\n");
perror("finger: connect");
(void)close(s);
return;
}
+ (void)printf("]\n");
/* -l flag for remote fingerd */
if (lflag)
--
Rod Grimes rgrimes@gndrsh.aac.dev.com
Accurate Automation Company Reliable computers for FreeBSD
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199508122101.OAA07653>
