delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/04/16:56:11

Message-Id: <m0yhh0i-000S3EC@inti.gov.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT gov DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar>
Organization: INTI
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>, Josh Rubin <jlrubin AT bway DOT net>,
djgpp AT delorie DOT com, Andris Pavenis <pavenis AT lanet DOT lv>, pavenis AT lanet DOT lv
Date: Thu, 4 Jun 1998 17:56:38 +0000
MIME-Version: 1.0
Subject: Re: Possible cause for "gcc just hangs"
References: <B0000031684 AT stargate DOT astr DOT lu DOT lv>
In-reply-to: <Pine.SUN.3.91.980604204839.2197W-100000@is>

Eli Zaretskii <eliz AT is DOT elta DOT co DOT il> 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019