Article View: comp.sys.transputer
Article #949gethostname()
From: SPAHNI Stephane
Date: Thu, 30 Aug 1990 13:27
Date: Thu, 30 Aug 1990 13:27
24 lines
1241 bytes
1241 bytes
I have a problem with the "gethostname()" procedure from Meiko: it seems
to return nothing... I am using a MK200 board hosted in a Sun-3.
I tried the following program:
main()
{
char buffer[1000];
int code;
buffer[0] = '\0';
code = gethostname (buffer, sizeof buffer);
printf ("Host %s Code %d\n", buffer, code);
}
When run on a Sun, it returns the hostname of the machine. When run on a
transputer with mrun, it returns a code of 0 (no error), but the buffer is
left unchanged (if you don't initialize it, you don't get the '\0' !). In the
manual, it is written that it returns "the host machine being used to run the
server". It is correct to assume that it should be the hostname of the Sun ?
If not, how can I set the hostname ? (there is no "sethostname" procedure !).
Stephane Spahni
University of Geneva
spahni@cuisun.unige.ch
Technical Details
Message-ID:
<3242@cui.unige.ch>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!mcsun!cernvax!chx400!ugun2b!cui!spahniShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!uunet!mcsun!cernvax!chx400!ugun2b!cui!spahni From: spahni@cui.unige.ch (SPAHNI Stephane) Newsgroups: comp.sys.transputer Subject: gethostname() Keywords: meiko, gethostname Message-ID: <3242@cui.unige.ch> Date: 30 Aug 90 13:27:32 GMT Organization: University of Geneva, Switzerland Lines: 24