🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #16

Re: BASH release 0.99

#16
From: Chet Ramey
Date: Mon, 19 Jun 1989 14:31
38 lines
1560 bytes
In article <8906161707.AA15949@aurel.caltech.edu> bfox@ai.mit.edu writes:
>
>   6. I know you havent finished the SYSv ports yet, but \h in the
>      PS1 variable above comes out as 'localhost'. I looked at the
>      code in bash and could see that you just hard coded that until
>      you'd got the code right.
>
>What is the right code?  I don't have a sys v system.  If you tell me
>what it is, I'll just put it in.
>
>Brian Fox

Here is a version of `gethostname()' for sys v systems that should do
what the Foxes (;-) want.  Now Sys 5 systems don't have to be special-cased
there.


#include <sys/utsname.h>

gethostname(name, namlen) 
char *name;
int namlen;
{
	int i;
	struct utsname uts;

	uname(&uts);
	i = strlen(uts.nodename) + 1;
	strncpy(name, uts.nodename, i < namlen ? i : namlen);
	return 0;
}

Chet Ramey

Chet Ramey     Network Services Group, CWRU    chet@cwjcc.INS.CWRU.Edu

"The flagon with the dragon has the potion with the poison;
	the vessel with the pestle holds the brew that is true!"
Technical Details
Message-ID: <368@cwjcc.CWRU.Edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!cwjcc!cwns5!chet
References: <13628.8906160947@alice.marlow.uucp> <8906161707.AA15949@aurel.caltech.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!cwjcc!cwns5!chet
From: chet@cwns5.INS.CWRU.Edu (Chet Ramey)
Newsgroups: gnu.bash.bug
Subject: Re: BASH release 0.99
Message-ID: <368@cwjcc.CWRU.Edu>
Date: 19 Jun 89 14:31:04 GMT
References: <13628.8906160947@alice.marlow.uucp> <8906161707.AA15949@aurel.caltech.edu>
Sender: news@cwjcc.CWRU.Edu
Reply-To: chet@cwns5.CWRU.EDU ()
Distribution: gnu
Organization: Case Western Reserve Univ. Cleveland, Ohio, (USA)
Lines: 38