Message-Id: <1.5.4.32.19970625160147.00679f4c@dce03.ipt.br> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Wed, 25 Jun 1997 13:01:47 -0300 To: fighteer AT cs DOT com, djgpp AT delorie DOT com From: Cesar Scarpini Rabak Subject: Re: How to read/modify environment variables? Precedence: bulk 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~