[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gm2] gm2 cannot detect itself
From: |
Gaius Mulley |
Subject: |
Re: [Gm2] gm2 cannot detect itself |
Date: |
Wed, 06 Oct 2010 20:28:52 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Manfred Hollstein <address@hidden> writes:
> If argv[0] is an absolute path name for an existing file which can be
> executed, I'd trust it because it's probably the file that the caller
> has been attempting to invoke directly; this might be due to a shell
> having found it along $PATH, or, as I said, by a user specifying a
> special version. Something like the following should work from my point
> of view:
>
> if (access (argv[0], X_OK) == 0)
> {
> /* File exists, take its name and trust it... */
> }
> else
> {
> /* File name must have been found via $PATH, just use "gm2". */
> }
Hi Manfred,
thanks for the hints - yes this does seem a sensible approach..
I'll implement this..
regards,
Gaius