From owner-freebsd-questions Fri May 18 11:10:23 2001 Delivered-To: freebsd-questions@freebsd.org Received: from mail2.wmptl.com (mail2.wmptl.com [216.94.6.26]) by hub.freebsd.org (Postfix) with ESMTP id 1265437B62F for ; Fri, 18 May 2001 11:10:17 -0700 (PDT) (envelope-from webmaster@wmptl.com) Received: from wmptl.com ([10.0.0.168]) by mail2.wmptl.com (8.9.3/8.9.3) with ESMTP id OAA18380 for ; Fri, 18 May 2001 14:12:33 -0400 (EDT) (envelope-from webmaster@wmptl.com) Message-ID: <3B056427.9090809@wmptl.com> Date: Fri, 18 May 2001 14:04:23 -0400 From: Nathan Vidican Reply-To: nathan@vidican.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; m18) Gecko/20010131 Netscape6/6.01 X-Accept-Language: en MIME-Version: 1.0 To: questions@freebsd.org Subject: OT: accessing environment variables using C/C++ Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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 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. -- -- Nathan Vidican webmaster@wmptl.com Windsor Match Plate & Tool Ltd. http://home.wmptl.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message