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 Standard C library (libc, -lc)
11
13 #define _GNU_SOURCE /* See feature_test_macros(7) */
14 #include <errno.h>
15
16 extern char *program_invocation_name;
17 extern char *program_invocation_short_name;
18
20 program_invocation_name contains the name that was used to invoke the
21 calling program. This is the same as the value of argv[0] in main(),
22 with the difference that the scope of program_invocation_name is
23 global.
24
25 program_invocation_short_name contains the basename component of name
26 that was used to invoke the calling program. That is, it is the same
27 value as program_invocation_name, with all text up to and including the
28 final slash (/), if any, removed.
29
30 These variables are automatically initialized by the glibc run-time
31 startup code.
32
34 The Linux-specific /proc/pid/cmdline file provides access to similar
35 information.
36
38 GNU.
39
41 proc(5)
42
43
44
45Linux man-pages 6.04 2023-03-30 program_invocation_name(3)