1 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" Permission is hereby granted, free of charge, to any person obtaining
4 .\" a copy of this software and associated documentation files (the
5 .\" "Software"), to deal in the Software without restriction, including
6 .\" without limitation the rights to use, copy, modify, merge, publish,
7 .\" distribute, sublicense, and/or sell copies of the Software, and to
8 .\" permit persons to whom the Software is furnished to do so, subject to
9 .\" the following conditions:
11 .\" The above copyright notice and this permission notice shall be
12 .\" included in all copies or substantial portions of the Software.
14 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 .\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 .\" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 .\" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 .\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 .\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 .TH INVOCATION_NAME 3 2006-04-29 "GNU" "Linux Programmer's Manual"
23 program_invocation_name, program_invocation_short_name \- \
24 obtain name used to invoke calling program
27 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
30 .BI "extern char *" program_invocation_name ;
31 .BI "extern char *" program_invocation_short_name ;
34 .I program_invocation_name
35 contains the name that was used to invoke the calling program.
36 This is the same as the value of
40 with the difference that the scope of
41 .I program_invocation_name
44 .I program_invocation_short_name
45 contains the basename component of name that was used to invoke
47 That is, it is the same value as
48 .IR program_invocation_name ,
49 with all text up to and including the final slash (/), if any, removed.
51 These variables are automatically initialized by the glibc run-time
54 These variables are GNU extensions, and should not be
55 used in programs intended to be portable.
58 .I /proc/[number]/cmdline
59 file provides access to similar information.