From owner-freebsd-questions Fri May 18 11:20: 7 2001 Delivered-To: freebsd-questions@freebsd.org Received: from res142a-008.rh.rit.edu (res142a-008.rh.rit.edu [129.21.142.8]) by hub.freebsd.org (Postfix) with ESMTP id DDD8637B422 for ; Fri, 18 May 2001 11:20:00 -0700 (PDT) (envelope-from vega@res142a-008.rh.rit.edu) Received: by res142a-008.rh.rit.edu (Postfix, from userid 1000) id 3C683901A6D; Fri, 18 May 2001 14:17:44 -0400 (EDT) Date: Fri, 18 May 2001 14:17:44 -0400 From: Michael Dungan To: nathan@vidican.com Cc: questions@freebsd.org Subject: Re: OT: accessing environment variables using C/C++ Message-ID: <20010518141744.A49140@rit.edu> Reply-To: mpd6334@cs.rit.edu References: <3B056427.9090809@wmptl.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3B056427.9090809@wmptl.com>; from webmaster@wmptl.com on Fri, May 18, 2001 at 02:04:23PM -0400 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, May 18, 2001 at 02:04:23PM -0400, Nathan Vidican wrote: > Not sure where else to ask, I've tried a myriad of IRC channels, etc to > no avail. So I figured I'd ask here, seeing as how the broad range of > people who are on this list will most likely have someone who's done > this before me. > > What I need to know, is how to access an environment variable from C. I > usually program in PERL, and have a very limited amount of experience > with C/C++. This will be my first attempt at creating an application. I > am trying to convert something I wrote in PERL to C. > > It's a simple CGI script, which accesses a few server-side environment > variables. In PERL for example, I can access the value of HTTP_REFERER, > using the hash of environment variables, and the key HTTP_REFERER; like > so: $ENV{'HTTP_REFERER'}. However I want to try and do the same from C, > but that far have been unable to figure out how to call upon environment > variables. > > In short, if anyone could provide me a quick blotch of code, (say a > declaration, and an assignment), which demonstrates the usage of an > environment variable it would be much appreciated. Is getenv(3) what you want? > Nathan Vidican > webmaster@wmptl.com mpd -- ___________________________________________________________ Little Girl: "MAY I GROW 3005 PLANTS??" Pokey the Penguin: "NO" - from "3005 PLANTS" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message