Re: Help with C clearenv and setenv

2018-06-06 Thread Sam Habiel
Eliot Moss, This worked perfectly: char *dummy = NULL; environ = &dummy; Thank you so much. --Sam On Mon, Jun 4, 2018 at 4:22 PM, Sam Habiel wrote: > Thank you! > > On Mon, Jun 4, 2018 at 3:39 PM, Ken Brown wrote: >> On 5/31/2018 9:43 AM, Eric Blake wrote: >>> >>> On 05/30/2018 09:48 AM, Sam

Re: Help with C clearenv and setenv

2018-06-04 Thread Sam Habiel
Thank you! On Mon, Jun 4, 2018 at 3:39 PM, Ken Brown wrote: > On 5/31/2018 9:43 AM, Eric Blake wrote: >> >> On 05/30/2018 09:48 AM, Sam Habiel wrote: >>> >>> I have code for a database I am porting to Cygwin. >>> >>> Part of that code is a clearenv() then a couple of setenvs. There is >>> an ifde

Re: Help with C clearenv and setenv

2018-06-04 Thread Ken Brown
On 5/31/2018 9:43 AM, Eric Blake wrote: On 05/30/2018 09:48 AM, Sam Habiel wrote: I have code for a database I am porting to Cygwin. Part of that code is a clearenv() then a couple of setenvs. There is an ifdef for Cygwin, as it doesn't implement clearenv. It wouldn't be hard to implement cle

Re: Help with C clearenv and setenv

2018-05-31 Thread Keith Christian
You're welcome, Sam. Keith On Wed, May 30, 2018 at 8:22 PM, Sam Habiel wrote: > Thank you Keith for you reply; but I am actually looking for the C APIs to > manipulate the environment; esp. to clear it. > > On Wed, May 30, 2018 at 6:05 PM, Keith Christian > wrote: > >> Sam, >> >> Here is a shor

Re: Help with C clearenv and setenv

2018-05-31 Thread Eric Blake
On 05/30/2018 09:48 AM, Sam Habiel wrote: I have code for a database I am porting to Cygwin. Part of that code is a clearenv() then a couple of setenvs. There is an ifdef for Cygwin, as it doesn't implement clearenv. It wouldn't be hard to implement clearenv() for a future release of Cygwin,

Re: Help with C clearenv and setenv

2018-05-31 Thread Eliot Moss
On 5/30/2018 11:56 PM, Marco Atzeri wrote: > On 5/30/2018 4:48 PM, Sam Habiel wrote: > environ = calloc(1, sizeof(*environ)) Indeed, this does not surprise me since environ is supposed to be a pointer to an array of char *, whose last entry is NULL. So the above line is the one needed. It *mig

Re: Help with C clearenv and setenv

2018-05-30 Thread Marco Atzeri
On 5/30/2018 4:48 PM, Sam Habiel wrote: I have code for a database I am porting to Cygwin. Part of that code is a clearenv() then a couple of setenvs. There is an ifdef for Cygwin, as it doesn't implement clearenv. It just sets environ = NULL. Well--that really breaks setenv! It returns a "Bad P

Re: Help with C clearenv and setenv

2018-05-30 Thread Sam Habiel
Thank you Keith for you reply; but I am actually looking for the C APIs to manipulate the environment; esp. to clear it. On Wed, May 30, 2018 at 6:05 PM, Keith Christian wrote: > Sam, > > Here is a short demonstration of how to detect unset (possibly null, > too?) variables in BASH. Not sure if

Re: Help with C clearenv and setenv

2018-05-30 Thread Keith Christian
Sam, Here is a short demonstration of how to detect unset (possibly null, too?) variables in BASH. Not sure if this is exactly what you are looking for but presented for info. set -x;A_VAR="${RANDOM}";echo "1. ${A_VAR}";echo "2. ${A_VAR:?IS_NOT_SET}";unset A_VAR;set +x + set -x + A_VAR=28641 + e

Help with C clearenv and setenv

2018-05-30 Thread Sam Habiel
I have code for a database I am porting to Cygwin. Part of that code is a clearenv() then a couple of setenvs. There is an ifdef for Cygwin, as it doesn't implement clearenv. It just sets environ = NULL. Well--that really breaks setenv! It returns a "Bad Poniter" error (-1). What is the correct w