delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/12/15/21:06:06

To: mlist-djgpp AT nntp-server DOT caltech DOT edu
Path: russel.klab.caltech.edu!ccwf
From: ccwf AT russel DOT klab DOT caltech DOT edu (Charles Fu)
Newsgroups: mlist.djgpp
Subject: Re: Getting a path in argv[0]
Date: 15 Dec 1994 21:55:09 GMT
Organization: California Institute of Technology, Pasadena
Lines: 22
References: <3bklfv$nth AT sunforest DOT mantis DOT co DOT uk> <199412020056 DOT SAA14699 AT saucer DOT cc DOT umr DOT edu> <3bn4kb$13h AT sunforest DOT mantis DOT co DOT uk>
Nntp-Posting-Host: russel.klab.caltech.edu

In article <3bn4kb$13h AT sunforest DOT mantis DOT co DOT uk>,
Olly Betts <olly AT mantis DOT co DOT uk> wrote:
>>At anyrate, the portable solution is to manully check the path().
>>
>>I remember when I played around with the DLD package, it had a
>>routine for checking the path to do just this.  I just had to
>>modify it slightly to use ; as path separators rather than ;.
>>Check out prep.ai.mit.edu in pub/gnu/dld323.tar.gz (or some
>>similar name).
>
>I'll take a look at that.  It'd be useful for the UNIX version not
>to need an environmental variable set.

It's a little unclear what you environment variable you are referring to.  This
is off-topic, but if you are looking for a portable foolproof way to recover
the executable's path from argv[0] or anything else under UNIX, it doesn't
exist.  (You can make educated but possibly incorrect guesses, however.  Some
flavors of UNIX do allow getting this information, but such features are not
widespread and are not poartable.)  This is well covered, I believe, in the
comp.unix.shell and programmer FAQs.

-ccwf

- Raw text -


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