Debian Codegraph @

doc/FindExec.3

raw
1 '\"
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 .TH Tcl_FindExecutable 3 8.1 Tcl "Tcl Library Procedures"
8 .so man.macros
9 .BS
10 .SH NAME
11 Tcl_FindExecutable, Tcl_GetNameOfExecutable \- identify or return the name of the binary file containing the application
12 .SH SYNOPSIS
13 .nf
14 \fB#include <tcl.h>\fR
15 .sp
16 void
17 \fBTcl_FindExecutable\fR(\fIargv0\fR)
18 .sp
19 const char *
20 \fBTcl_GetNameOfExecutable\fR()
21 .SH ARGUMENTS
22 .AS char *argv0
23 .AP char *argv0 in
24 The first command-line argument to the program, which gives the
25 application's name.
26 .BE
27
28 .SH DESCRIPTION
29 .PP
30 The \fBTcl_FindExecutable\fR procedure computes the full path name of
31 the executable file from which the application was invoked and saves
32 it for Tcl's internal use.
33 The executable's path name is needed for several purposes in
34 Tcl. For example, it is needed on some platforms in the
35 implementation of the \fBload\fR command.
36 It is also returned by the \fBinfo nameofexecutable\fR command.
37 .PP
38 On UNIX platforms this procedure is typically invoked as the very
39 first thing in the application's main program; it must be passed
40 \fIargv[0]\fR as its argument. It is important not to change the
41 working directory before the invocation.
42 \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 On Windows platforms this procedure is typically invoked as the very
49 first thing in the application's main program as well; Its \fIargv[0]\fR
50 argument is only used to indicate whether the executable has a stderr
51 channel (any non-null value) or not (the value null). If \fBTcl_SetPanicProc\fR
52 is never called and no debugger is running, this determines whether
53 the panic message is sent to stderr or to a standard system dialog.
54 .PP
55 \fBTcl_GetNameOfExecutable\fR simply returns a pointer to the
56 internal full path name of the executable file as computed by
57 \fBTcl_FindExecutable\fR. This procedure call is the C API
58 equivalent to the \fBinfo nameofexecutable\fR command. NULL
59 is returned if the internal full path name has not been
60 computed or unknown.
61
62 .SH KEYWORDS
63 binary, executable file