From owner-freebsd-hackers Mon Aug 31 17:11:08 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA06836 for freebsd-hackers-outgoing; Mon, 31 Aug 1998 17:11:08 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from mail.camalott.com (mail.camalott.com [208.203.140.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA06830 for ; Mon, 31 Aug 1998 17:11:06 -0700 (PDT) (envelope-from joelh@gnu.org) Received: from detlev.UUCP (tex-119.camalott.com [208.229.74.119]) by mail.camalott.com (8.8.7/8.8.5) with ESMTP id TAA04450; Mon, 31 Aug 1998 19:11:26 -0500 Received: (from joelh@localhost) by detlev.UUCP (8.9.1/8.9.1) id TAA11460; Mon, 31 Aug 1998 19:08:58 -0500 (CDT) (envelope-from joelh) Date: Mon, 31 Aug 1998 19:08:58 -0500 (CDT) Message-Id: <199809010008.TAA11460@detlev.UUCP> To: bright@hotjobs.com CC: matthew@wolfepub.com, hackers@FreeBSD.ORG In-reply-to: (message from Alfred Perlstein on Mon, 31 Aug 1998 15:41:29 -0500 (EST)) Subject: Re: Environment of a process From: Joel Ray Holveck Reply-to: joelh@gnu.org References: Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >> Where does a process get its environment if it is not executed from the >> command line? I have a program that connects to a database and relies on >> several ENV VARS to be set. > man exec, look at: > int exect(const char *path, char *const argv[], char *const envp[]) > also note getenv(3), man 3 getenv You can also use setenv, preferably between the fork and exec. (There was recently a thread about a memory leak if this is done frequently, tho. I don't know the details.) Best, joelh -- Joel Ray Holveck - joelh@gnu.org - http://www.wp.com/piquan Fourth law of programming: Anything that can go wrong wi sendmail: segmentation violation - core dumped To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message