Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!NUSVM.BITNET!GBOPOLY1
From: GBOPOLY1@NUSVM.BITNET (fclim)
Newsgroups: comp.sys.apollo
Subject: gethostname (was: gpr_$borrow and ^q)
Message-ID: <8809211104.AA01967@umix.cc.umich.edu>
Date: 21 Sep 88 11:05:47 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The Internet
Lines: 36
X-Unparsable-Date: Wed, 21 Sep 88 19:01:46 SST

hi,
    earlier, i query with

>     my program also needs to write to a file in /tmp.  i need the
>full absolute pathname of this file right from the network root //.
>so i use the unix system call, gethostname(host, strlen(host)).
>but this returns -1 and *host == NULL.
>
>     before adding the above code to my program, i used hostname(1).
>at a csh level, i issued
>           % hostname
>           wm
>so i expect gethostname(host, strlen(host)) to return 0 and put
>"wm" into host.
>
>     when we set up our network, we use the aegis commands like
>uctnode and ctnode.  we did not use hostname.
>

well, silly old me had used strlen instead of the correct sizeof
operator.  the call gethostname(host, strlen(host)) misled
gethostname(2) to think that host is an array of zero size.
the correct call gethostname(host, sizeof host) pass the elemental
size of host.

my apologies to those who have considerable time trying
to solve my problem.


ps:  i found out that name_$get_path() does a better job of what
     i had in mind.

fclim          --- gbopoly1 % nusvm.bitnet @ cunyvm.cuny.edu
computer centre
singapore polytechnic
dover road
singapore 0513.