Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: Eli Zaretskii , Josh Rubin , djgpp AT delorie DOT com, Andris Pavenis , pavenis AT lanet DOT lv Date: Thu, 4 Jun 1998 17:56:38 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Possible cause for "gcc just hangs" References: In-reply-to: Precedence: bulk Eli Zaretskii wrote: > On Thu, 4 Jun 1998 pavenis AT lanet DOT lv wrote: > > > So please DEFINE it. I'll try to look what I can do to avoid dark screen > > up to pressing Ctrl-Break. I think simplest would be outputing > > fatal error message that %DJGPP% is not defined. > > It is better to fall back to some default location (like c:/djgpp), if > that's possible. I'll suggest another option. That's what I use in my editor: My editor needs an eviroment variable pointing to the directory where the data files are stored. In the first public realease I put it very clear in the docs, but as with the djgpp's readme.1st the people ignored it producing some side effects. So in the next release I put a message like Andris said here, but I figured out that it isn't a very good thing because after all the tree structure is ever the same if you uncompress with directories, so now I simply try to figure out where is the directory just using the argv[0]. I simply take a look to where the .exe is and then make a simple definition of the enviroment variable. The whole process is like this: 1) I look for my enviroment variable, if is there I use it. 2) If the fool, sorry user ;-), didn't make the definition I look argv[0] and reconstruct the variable Note: in my case argv[0] will look like this: drive:path/bin/setedit.exe So I remove all the things after the second slash (walking from the end to the start) and then I add share/setedit so I get: drive:path/share/setedit If all was uncompressed in the right way that's the correct definition for the enviroment variable. 3) I look if that is valid. In my case I look for some files, in the gcc case we can look for djgpp.env. 4) If the constructed directory is OK I simply make something equivalent to putenv() and go on. 5) If isn't ok I abort explaining what's going on. I tried it and works very well and is very robust. Of course is a little crazy to make such a tricks to avoid errors from part of the user but .... works. SET ------------------------------------ 0 -------------------------------- Visit my home page: http://set-soft.home.ml.org/ or http://www.geocities.com/SiliconValley/Vista/6552/ Salvador Eduardo Tropea (SET). (Electronics Engineer) Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org ICQ: 2951574 Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA TE: +(541) 759 0013