]>
Commit | Line | Data |
---|---|---|
c11b1abf | 1 | .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com> |
900064d4 | 2 | .\" |
7c576f45 | 3 | .\" %%%LICENSE_START(PERMISSIVE_MISC) |
900064d4 MK |
4 | .\" Permission is hereby granted, free of charge, to any person obtaining |
5 | .\" a copy of this software and associated documentation files (the | |
6 | .\" "Software"), to deal in the Software without restriction, including | |
7 | .\" without limitation the rights to use, copy, modify, merge, publish, | |
8 | .\" distribute, sublicense, and/or sell copies of the Software, and to | |
9 | .\" permit persons to whom the Software is furnished to do so, subject to | |
10 | .\" the following conditions: | |
11 | .\" | |
12 | .\" The above copyright notice and this permission notice shall be | |
13 | .\" included in all copies or substantial portions of the Software. | |
14 | .\" | |
15 | .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
16 | .\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
17 | .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
18 | .\" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY | |
19 | .\" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
20 | .\" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE | |
21 | .\" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
8ff7380d | 22 | .\" %%%LICENSE_END |
7c576f45 | 23 | .\" |
4b8c67d9 | 24 | .TH INVOCATION_NAME 3 2017-09-15 "GNU" "Linux Programmer's Manual" |
900064d4 MK |
25 | .SH NAME |
26 | program_invocation_name, program_invocation_short_name \- \ | |
27 | obtain name used to invoke calling program | |
28 | .SH SYNOPSIS | |
29 | .nf | |
b80f966b | 30 | .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" |
900064d4 | 31 | .B #include <errno.h> |
dbfe9c70 | 32 | .PP |
900064d4 MK |
33 | .BI "extern char *" program_invocation_name ; |
34 | .BI "extern char *" program_invocation_short_name ; | |
35 | .fi | |
36 | .SH DESCRIPTION | |
37 | .I program_invocation_name | |
38 | contains the name that was used to invoke the calling program. | |
c13182ef | 39 | This is the same as the value of |
900064d4 | 40 | .I argv[0] |
c13182ef | 41 | in |
900064d4 | 42 | .IR main (), |
c13182ef | 43 | with the difference that the scope of |
900064d4 MK |
44 | .I program_invocation_name |
45 | is global. | |
847e0d88 | 46 | .PP |
900064d4 | 47 | .I program_invocation_short_name |
c13182ef | 48 | contains the basename component of name that was used to invoke |
900064d4 MK |
49 | the calling program. |
50 | That is, it is the same value as | |
51 | .IR program_invocation_name , | |
52 | with all text up to and including the final slash (/), if any, removed. | |
847e0d88 | 53 | .PP |
d9bfdb9c | 54 | These variables are automatically initialized by the glibc run-time |
900064d4 | 55 | startup code. |
47297adb | 56 | .SH CONFORMING TO |
2b2581ee MK |
57 | These variables are GNU extensions, and should not be |
58 | used in programs intended to be portable. | |
900064d4 MK |
59 | .SH NOTES |
60 | The Linux-specific | |
61 | .I /proc/[number]/cmdline | |
62 | file provides access to similar information. | |
900064d4 | 63 | .SH SEE ALSO |
0a4f8b7b | 64 | .BR proc (5) |