delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/12/11:39:58

Date: Thu, 12 Jun 1997 18:38:59 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Ben N Shadwick <bshadwick AT juno DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: environment variables
In-Reply-To: <19970612.064604.9222.0.bshadwick@juno.com>
Message-ID: <Pine.SUN.3.91.970612183609.9257d-100000@is>
MIME-Version: 1.0

On Thu, 12 Jun 1997, Ben N Shadwick wrote:

> It seems like there should be some kind of function to allow you to just
> browse through them all without knowing the name of each variable, in
> case you just want to look over what variables there are, but I don't
> recall any.

There is no such function, but you can examine the environment directly:

	extern char ** environ;
	char **ep = environ;

	while (*ep)
	  {
	    char *evar = *ep;
	    /* Do whatever you like with this var */
	    ep++;
	  }

The elements of the `environ' array look like so:

	"VAR=VALUE"

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019