1PROGRAM_INVOCATION_NAME(3) Library Functions Manual PROGRAM_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
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 initialised by the glibc run-time
28 startup code.
29
31 The Linux-specific /proc/[number]/cmdline file provides access to simi‐
32 lar information.
33
35 These variables are GNU extensions, and should not be used in programs
36 intended to be portable.
37
39 proc(5), feature_test_macros(7)
40
41
42
43GNU 2006-04-29 PROGRAM_INVOCATION_NAME(3)