[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: make ARGV[0] more similar to C argv[0] or shell $0

From: Aharon Robbins
Subject: Re: make ARGV[0] more similar to C argv[0] or shell $0
Date: Thu, 24 Sep 2009 21:23:41 +0300

Hi Stepan,

> Date: Thu, 24 Sep 2009 12:41:46 +0200
> From: Stepan Kasal <address@hidden>
> To: address@hidden
> Subject: make ARGV[0] more similar to C argv[0] or shell $0
> Hello,
> it was requested through Fedora bug report that GNU awk's ARGV[0]
> contains full path if awk was called with a full path.
> For example, /bin/awk 'BEGIN{print ARGV[0]}' would print "/bin/awk",
> not only "awk".
> I observe that that would make ARGV[0] consistent with analogous
> constructs in C or shell.  (At least with libc and bash on recent
> Fedora GNU/Linux.)

One problem is that different operating systems are not consistent,
particularly when gawk is invoked using #!.  On some systems you
get the full path, on others you don't....

I found it easiest to always give just the program name part, and
then I don't have to worry about people complaining that gawk is
not consistent.  If Fedora wants to fix this, in main.c just

        myname = argv[0];

But I don't see a reason to change my code to do this.

> The bug report claims that this feature gets checked by a POSIX
> compatibility test, but adds no reference.  I was not able to find
> any proof that POSIX requires this.

If and Only If someone can cite chapter and verse and prove this
contention, I'll reconsider this.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]