From: David Brown <caml-list2@davidb.org>
To: skaller <skaller@users.sourceforge.net>
Cc: Richard Jones <rich@annexia.org>, caml-list@inria.fr
Subject: Re: [Caml-list] toplevel with pre-installed printers
Date: Fri, 20 Jan 2006 08:49:14 -0800 [thread overview]
Message-ID: <20060120164914.GA15521@old.davidb.org> (raw)
In-Reply-To: <1137723843.8822.139.camel@rosella>
On Fri, Jan 20, 2006 at 01:24:03PM +1100, skaller wrote:
> You simply look at argv[0] which on some Unix systems
> is the full path name of the invoked executable.
Actually, argv[0] is almost never a full path. It is the path used to
invoke the executable. So, if the program is in the user's path, then it
will just be the filename, with no path information.
In order to find itself, a program has to search for argv[0] in $PATH.
If you don't believe me, try it:
hello.c:
#include <stdio.h>
int
main (int argc, char **argv)
{
printf ("Program name: %s\n", argv[0]);
}
% gcc -o ~/bin/hello hello.c
% hello
Program name: hello
Dave
next prev parent reply other threads:[~2006-01-20 16:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-19 16:28 Andrej Bauer
2006-01-19 16:53 ` [Caml-list] " Daniel Bünzli
2006-01-19 16:57 ` Eric Stokes
2006-01-19 17:08 ` Andrej Bauer
2006-01-19 17:49 ` Richard Jones
2006-01-19 19:12 ` Eric Cooper
2006-01-19 20:18 ` Richard Jones
2006-01-20 2:24 ` skaller
2006-01-20 16:49 ` David Brown [this message]
2006-01-20 19:29 ` skaller
2006-01-20 14:13 ` code17
2006-01-20 8:29 ` [Caml-list] " Jean-Christophe Filliatre
2006-01-20 13:13 ` Gerd Stolpmann
2006-01-19 19:40 Harrison, John R
2006-01-20 1:30 ` skaller
2006-01-20 20:19 Harrison, John R
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060120164914.GA15521@old.davidb.org \
--to=caml-list2@davidb.org \
--cc=caml-list@inria.fr \
--cc=rich@annexia.org \
--cc=skaller@users.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox