[Starkit] Re: starpack as cgi

Arjen Markus arjen.markus at wldelft.nl
Wed Jun 22 15:31:09 CEST 2005


David Welton wrote:
> 
> > So until that gets fixed, I guess a workaround is necessary if
> > starpacks are to work as CGI's.
> 
> One ugly hack that would, however, work would be something like this:
> 
> set execname [info nameofexecutable]
> if { $execname eq "" && [info exists ::env(SCRIPT_FILENAME)] } {
>     set execname $::env(SCRIPT_FILENAME)
> }
> 
> I think that ought to work - here for instance, env(SCRIPT_FILENAME) =
> /usr/lib/cgi-bin/prova.cgi.
> 
> It's kind of ugly, maybe there are better ways.  Perhaps looking at
> [pwd] + argv0 to see if that is an executable file?
> 

Hm, in some of my programs I have had very similar problems.
That is: I need to know where the executable lives and not in all 
circumstances (*) argv[0] (C programs) would contain the path.

So instead of only relying on the information in argv[0], I also
scan the path environment variable to see what directories it
might live in. Perhaps that could be done here too?

(*) The Bourne shell does not include the path name for instance.

Regards,

Arjen



More information about the Starkit mailing list