[comp.protocols.nfs] $HOME variable under PC-NFS

fort@imag.imag.fr (Didier FORT) (10/25/90)

	Hello,

	Just a little question :

	Does someone knows how to read the $HOME variable defined by PC-NFS
on a PC ? (read in a C program)

				Thanks in advance

					Didier
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| Didier Fort   |   76.51.46.00 poste 5120    |       fort@imag.imag.fr |
| L.G.I.  I.M.A.G. M043  | BP 53 X 38041 GRENOBLE CEDEX    |    FRANCE  |
-------------------------------------------------------------------------
| La bonne longueur pour les jambes? Lorsque les pieds touchent le sol  |
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

wnp@iiasa.AT (wolf paul) (10/27/90)

In article <14598@imag.imag.fr> fort@imag.fr (Didier FORT) writes:
>	Does someone knows how to read the $HOME variable defined by PC-NFS
>on a PC ? (read in a C program)

How about
			char *ptr, *getenv();
			ptr = getenv("HOME");

That would work on reasonably standard C compilers such as
MSC or Turbo C. It also works under UNIX.

On some compilers you need to pass **envptr as a third argument to
main(), and step through it like through **argv to find a string
starting with "HOME=", the remainder of the string would be the value.
I believe that the final pointer in the array **envptr is (char *)NULL.

-- 
Wolf N. Paul, IIASA, A - 2361 Laxenburg, Austria, Europe
PHONE: +43-2236-71521-465     FAX: +43-2236-71313      UUCP: uunet!iiasa.at!wnp
INTERNET: wnp%iiasa.at@uunet.uu.net      BITNET: tuvie!iiasa!wnp@awiuni01.BITNET
       * * * * Kurt Waldheim for President (of Mars, of course!) * * * *