]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/program_invocation_name.3
Fix inconsistencies in .TH line
[thirdparty/man-pages.git] / man3 / program_invocation_name.3
CommitLineData
900064d4
MK
1.\" Copyright (C) 2006 Michael Kerrisk <mtk-manpages@gmx.net>
2.\"
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:
10.\"
11.\" The above copyright notice and this permission notice shall be
12.\" included in all copies or substantial portions of the Software.
13.\"
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.
05eabe65 21.TH PROGRAM_INVOCATION_NAME 3 2006-04-29 "GNU" "Linux Programmer's Manual"
900064d4
MK
22.SH NAME
23program_invocation_name, program_invocation_short_name \- \
24obtain name used to invoke calling program
25.SH SYNOPSIS
26.nf
27.B #define _GNU_SOURCE
28.B #include <errno.h>
29
30.BI "extern char *" program_invocation_name ;
31.BI "extern char *" program_invocation_short_name ;
32.fi
33.SH DESCRIPTION
34.I program_invocation_name
35contains the name that was used to invoke the calling program.
c13182ef 36This is the same as the value of
900064d4 37.I argv[0]
c13182ef 38in
900064d4 39.IR main (),
c13182ef 40with the difference that the scope of
900064d4
MK
41.I program_invocation_name
42is global.
43
44.I program_invocation_short_name
c13182ef 45contains the basename component of name that was used to invoke
900064d4
MK
46the calling program.
47That is, it is the same value as
48.IR program_invocation_name ,
49with all text up to and including the final slash (/), if any, removed.
50
c13182ef 51These variables are automatically initialised by the glibc run-time
900064d4
MK
52startup code.
53.SH NOTES
54The Linux-specific
55.I /proc/[number]/cmdline
56file provides access to similar information.
57.SH "CONFORMING TO"
58These variables are GNU extensions, and should not be
59used in programs intended to be portable.
60.SH SEE ALSO
0a90178c
MK
61.BR proc (5),
62.BR feature_test_macros (7)