[comp.sys.transputer] gethostname

spahni@cui.unige.ch (SPAHNI Stephane) (08/30/90)

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