🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #6524

SunSparc10 & gethostbyname (broken)

#6524
From: Filip Gieszczykiewicz
Date: Tue, 16 Nov 1993 08:04
76 lines
3377 bytes
	Greetings. I'm having a hard time with this Sparc10 (sun4m) and
	the way it converts "word" addresses to "number" addresses. Namely,
	the "gethostbyname" is broken. As a result, programs such as archie, 
	rn, trn, etc. croak when given a (usually internal) address. I have 
	proof:

	1) Script from a VAX 9000 (correct)
	2) Script from this Sun (broken)
	3) The test program (very short)

	What I'm looking for is more than just a simple fix... could
	someone tell me how to routinely correct this problem? Some of the
	programs I have to build (soon) never heard of a sun and as such
	make life difficult (unless I do a global replace of the address -
	but then if that site changes the IP address, I have to rebuild...)

	What does this have to do with this group? Well, trn and rn require
	an NNTPSERVER when in client mode. This address is usually in the
	form "machine.domain" and so it breaks under sun. If I convert it
	to IP address, all is fine. This, however, is unacceptable.

	Thanks, in advance, for all your help! BTW, I've posted this to the
	SunOS groups and will post a summary here.

	Take care.

--------------------------------------------------------------------------------
Script started on Tue Nov 16 01:32:24 1993
/tmp> uname -a
ULTRIX unixd2.cis.pitt.edu 4.2 0 RISC
/tmp> cc try.c
/tmp> ./a.out
Hostname = archie.rutgers.edu
Official Name = dorm.Rutgers.EDU
/tmp> exit
script done on Tue Nov 16 01:32:42 1993
--------------------------------------------------------------------------------
Script started on Tue Nov 16 01:35:18 1993
/tmp> uname -a
SunOS alpha.smi 4.1.3 1 sun4m
/tmp> cc try.c
/tmp> ./a.out
Hostname = archie.rutgers.edu
Sucking mud
/tmp> exit
script done on Tue Nov 16 01:35:39 1993
--------------------------------------------------------------------------------
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>

main()
{
struct	hostent	*host;
char	name[30];

strcpy(name,"archie.rutgers.edu\0");
printf("Hostname = %s\n",name);
host = gethostbyname(name);

if (host == NULL)
{
	printf ("Sucking mud\n");
	exit(1);
}

printf ("Official Name = %s\n",host->h_name);
}
--------------------------------------------------------------------------------
-- 
+--> Filip "I'll buy a vowel" Gieszczykiewicz. |  Best e-mail "fmgst+@pitt.edu"
| If you would like to receive the latest version of the SCI.ELECTRONICS FAQ,
| E-mail me and I will send you the INDEX to confirm address. Feedback Welcome!
| I live for my EE major, Windsurfing, SCA, programming, and assorted dreams.
Technical Details
Message-ID: <7119@blue.cis.pitt.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!pipex!uunet!pitt.edu!beta.smi.med.pitt.edu!fmg

Show Full Headers
Complete Article Headers
Message-ID: <7119@blue.cis.pitt.edu>
Subject: SunSparc10 & gethostbyname (broken)
Date: Tue, 16 Nov 1993 08:04:22 +0000
From: fmg@beta.smi.med.pitt.edu (Filip Gieszczykiewicz)
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!pipex!uunet!pitt.edu!beta.smi.med.pitt.edu!fmg
Newsgroups: news.software.readers
Summary: searching for solution
Keywords: (uname -a) SunOS alpha.smi 4.1.3 1 sun4m
Sender: news+@pitt.edu
Followup-To: comp.sys.sun.misc
Organization: Medical Informatics, Pittsburgh, PA USA
Lines: 76