[comp.unix.questions] ENV settings

tclark@hawk.ulowell.edu (T.C. Clark) (12/03/88)

	I'm writing a C program in which I would like to
	use some of the settings in the user's ENVIRONMENT
	(i.e. PRINTER, LOGNAME, etc...).

	Could someone tell me how to read these into a string?


		thanks,
			tom ----> tclark@hawk.ulowell.edu
--------------------------------------------------------------
MEMO TO MYSELF:
	do the dumb things I gotta do.
	touch the puppet head.

					TMBG

daveh@marob.MASA.COM (Dave Hammond) (12/15/88)

In article <10447@swan.ulowell.edu> tclark@hawk.ulowell.edu writes:
>
>	I'm writing a C program in which I would like to
>	use some of the settings in the user's ENVIRONMENT
>	(i.e. PRINTER, LOGNAME, etc...).
>
>	Could someone tell me how to read these into a string?

The getenv() function returns the string value of an environ parameter, e.g.:

char *getenv(), *p;
if ((p = getenv("LOGNAME")))
	printf("Your LOGNAME is %s\n", p);

--
Dave Hammond
...!uunet!masa.com!{marob,dsix2}!daveh