1INVOCATION_NAME(3) Linux Programmer's Manual INVOCATION_NAME(3)
2
3
4
6 program_invocation_name, program_invocation_short_name - obtain name
7 used to invoke calling program
8
10 #define _GNU_SOURCE /* See feature_test_macros(7) */
11 #include <errno.h>
12
13 extern char *program_invocation_name;
14 extern char *program_invocation_short_name;
15
17 program_invocation_name contains the name that was used to invoke the
18 calling program. This is the same as the value of argv[0] in main(),
19 with the difference that the scope of program_invocation_name is
20 global.
21
22 program_invocation_short_name contains the basename component of name
23 that was used to invoke the calling program. That is, it is the same
24 value as program_invocation_name, with all text up to and including the
25 final slash (/), if any, removed.
26
27 These variables are automatically initialized by the glibc run-time
28 startup code.
29
31 These variables are GNU extensions, and should not be used in programs
32 intended to be portable.
33
35 The Linux-specific /proc/[number]/cmdline file provides access to simi‐
36 lar information.
37
39 proc(5)
40
42 This page is part of release 5.04 of the Linux man-pages project. A
43 description of the project, information about reporting bugs, and the
44 latest version of this page, can be found at
45 https://www.kernel.org/doc/man-pages/.
46
47
48
49GNU 2017-09-15 INVOCATION_NAME(3)