1 |
578 |
markom |
'\"
|
2 |
|
|
'\" Copyright (c) 1995-1996 Sun Microsystems, Inc.
|
3 |
|
|
'\"
|
4 |
|
|
'\" See the file "license.terms" for information on usage and redistribution
|
5 |
|
|
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
6 |
|
|
'\"
|
7 |
|
|
'\" RCS: @(#) $Id: FindExec.3,v 1.1.1.1 2002-01-16 10:25:23 markom Exp $
|
8 |
|
|
'\"
|
9 |
|
|
.so man.macros
|
10 |
|
|
.TH Tcl_FindExecutable 3 7.5 Tcl "Tcl Library Procedures"
|
11 |
|
|
.BS
|
12 |
|
|
.SH NAME
|
13 |
|
|
Tcl_FindExecutable, Tcl_GetNameOfExecutable \- identify or return the name of the binary file containing the application
|
14 |
|
|
.SH SYNOPSIS
|
15 |
|
|
.nf
|
16 |
|
|
\fB#include \fR
|
17 |
|
|
.sp
|
18 |
|
|
char *
|
19 |
|
|
\fBTcl_FindExecutable\fR(\fIargv0\fR)
|
20 |
|
|
.sp
|
21 |
|
|
CONST char *
|
22 |
|
|
\fBTcl_GetNameOfExecutable\fR()
|
23 |
|
|
.SH ARGUMENTS
|
24 |
|
|
.AS char *argv0 in
|
25 |
|
|
.AP char *argv0 in
|
26 |
|
|
The first command-line argument to the program, which gives the
|
27 |
|
|
application's name.
|
28 |
|
|
.BE
|
29 |
|
|
|
30 |
|
|
.SH DESCRIPTION
|
31 |
|
|
.PP
|
32 |
|
|
The \fBTcl_FindExecutable\fR procedure computes the full path name of
|
33 |
|
|
the executable file from which the application was invoked and saves
|
34 |
|
|
it for Tcl's internal use.
|
35 |
|
|
The executable's path name is needed for several purposes in
|
36 |
|
|
Tcl. For example, it is needed on some platforms in the
|
37 |
|
|
implementation of the \fBload\fR command.
|
38 |
|
|
It is also returned by the \fBinfo nameofexecutable\fR command.
|
39 |
|
|
.PP
|
40 |
|
|
On UNIX platforms this procedure is typically invoked as the very
|
41 |
|
|
first thing in the application's main program; it must be passed
|
42 |
|
|
\fIargv[0]\fR as its argument. \fBTcl_FindExecutable\fR uses \fIargv0\fR
|
43 |
|
|
along with the \fBPATH\fR environment variable to find the
|
44 |
|
|
application's executable, if possible. If it fails to find
|
45 |
|
|
the binary, then future calls to \fBinfo nameofexecutable\fR
|
46 |
|
|
will return an empty string.
|
47 |
|
|
.PP
|
48 |
|
|
\fBTcl_GetNameOfExecutable\fR simply returns a pointer to the
|
49 |
|
|
internal full path name of the executable file as computed by
|
50 |
|
|
\fBTcl_FindExecutable\fR. This procedure call is the C API
|
51 |
|
|
equivalent to the \fBinfo nameofexecutable\fR command. NULL
|
52 |
|
|
is returned if the internal full path name has not been
|
53 |
|
|
computed or unknown.
|
54 |
|
|
|
55 |
|
|
.SH KEYWORDS
|
56 |
|
|
binary, executable file
|