Mail Archives: djgpp/1997/06/25/12:04:06
At 19:44 24/06/97 +0000, John M. Aldrich wrote:
>Martin Bernreuther wrote:
>>
>> I like to write a small tool to add a path to the PATH variable
>> only if it's not already in.
>> How can I get a hold of the environment variables?
>> Is there already a tool to do this?
>> Is there maybe a tool just to search a environment variable for
>> a string?
>
>getenv(). Look it up in the libc docs. See also its complement,
>putenv().
Humm...John, I'm affraid that won't cut in the Martin's desires!
Putenv will only change the environment of the program and its children but
not the main environment, so is if you add a path to the path variable,
after your program return you loose your modification.
AFAIK, messing _permanently_ in the environment requres hacking into DOS.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Cesar Scarpini Rabak E-mail: csrabak AT ipt DOT br
DME/ASC Phone: 55-11-268-3522 Ext.350
IPT - Instituto de Pesquisas Tecnologicas Fax: 55-11-268-5996
Av. Prof. Almeida Prado, 532. Sao Paulo - SP 05508-901 BRAZIL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Raw text -