🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Adri Verhoef Wed, 08 Apr 1992 14:55
Re: v29i019: tin - threaded full screen newsreader v1.1P1, Part01/12
#57
Author: Adri Verhoef
Date: Wed, 08 Apr 1992 14:55
39 lines
1746 bytes
Tin has a built-in inews.  When posting articles, the hostname is fetched by:

	#if defined(BSD) || defined(sinix) || defined(RS6000)
		gethostname (host_name, sizeof (host_name)); 
	#else	
		uname (host_name);
	#endif

But this does not always resolve to the Fully Qualified Domain Name.

My hostname is "tintin" (yes, double "tin" :-) and my domainname is rivm.nl.

So, the call above puts "tintin" in host_name[], but lacks the domainname.
I wrote a few C-lines to demonstrate what really should be there.  See below.

Furthermore, I think that it is not always desirable to have the hostname
in the address, some people want to hide their hostnames, and they only
want to see their domainnames in the address.
This should be made into a compile-time option.

Now for the few C-lines I wrote:
In the BSD case (I can't speak for the others at the mo') I would like to see:

****
#include <netdb.h>

	struct hostent *he;

		gethostname (host_name, sizeof (host_name)); 
		he = gethostbyname(host_name);
		strcpy(host_name, he->h_name);
****

Probably even use strncpy(), while you're at it.
-- 
* Slade Mailing List:  slade-request@rivm.nl
* European top 20		: a3@rivm.nl
* Nederlandse songfragmentenquiz: a3@rivm.nl (Adri Verhoef)
* Dutch Artists Lyrics Quiz	: a3@rivm.nl
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads