Problem with getenv()
From: Roby (nada_at_nada.net)
Date: 03/31/04
- Next message: raf: "Re: Micro$oft cheaper than TCoDT"
- Previous message: nessuno: "How to handle .wpd files under Linux?"
- Next in thread: William Winkler: "Re: Problem with getenv()"
- Reply: William Winkler: "Re: Problem with getenv()"
- Reply: Lew Pitcher: "Re: Problem with getenv()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 31 Mar 2004 15:25:20 GMT
Why are some of my environment variables ignored by getenv?
For example, entering set in a bash shell shows me a list which includes
OSTYPE=linux-gnu
SHLVL=2
getenv finds "SHLVL" but not "OSTYPE"
Code:
// evar.c
#include <stdlib.h>
int main( int argc, char **argv )
{
char *P;
if( argc != 2 )
{
puts( "Syntax: evar <e-var name>" );
puts( " Displays the value assigned to e-var" );
return( 1 );
}
if( ( P = getenv( argv[ 1 ] ) ) == NULL )
P = "( not found )";
printf( "%s = %s\n", argv[ 1 ], P );
return( 0 );
} /* main */
Thanks!
- Next message: raf: "Re: Micro$oft cheaper than TCoDT"
- Previous message: nessuno: "How to handle .wpd files under Linux?"
- Next in thread: William Winkler: "Re: Problem with getenv()"
- Reply: William Winkler: "Re: Problem with getenv()"
- Reply: Lew Pitcher: "Re: Problem with getenv()"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|