Subject: finger(1) hostname printing
To: None <netbsd-bugs@NetBSD.ORG>
From: Frank van der Linden <vdlinden@fwi.uva.nl>
List: netbsd-bugs
Date: 01/26/1995 19:40:54
short description: finger(1) prints hostname connected to too early.
-----------------

applies to:  1.0 and -current.
----------

files: /usr/src/usr.bin/finger/net.c
-----

detailed description:
--------------------
Maybe not everyone would call this a bug, but finger(1) prints the name
of the host connected to (if any) before it is actually connected. This
is confusing for people who are used to finger(1) printing the hostname
when actually having made the connection. The hostname appearing on
your screen gives you an indication of whether the host you are trying to
finger to is down/unreachable. I think it is the behavior of most other
systems to do it the other way around, and it matches the comment in
the source code too.

The patch is supplied below.

- Frank

*** net.c.orig	Thu Jan 26 19:24:47 1995
--- net.c	Thu Jan 26 19:27:17 1995
***************
*** 91,103 ****
  		return;
  	}
  
- 	/* 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)
--- 91,104 ----
  		return;
  	}
  
  	if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
  		perror("finger: connect");
  		(void)close(s);
  		return;
  	}
+ 
+ 	/* have network connection; identify the host connected with */
+ 	(void)printf("[%s]\n", hp->h_name);
  
  	/* -l flag for remote fingerd  */
  	if (lflag)