]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man/man3/program_invocation_name.3
man/, share/mk/: Move man*/ to man/
[thirdparty/man-pages.git] / man / man3 / program_invocation_name.3
CommitLineData
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.\"
5ba917a9 24.TH program_invocation_name 3 (date) "Linux man-pages (unreleased)"
900064d4
MK
25.SH NAME
26program_invocation_name, program_invocation_short_name \- \
27obtain name used to invoke calling program
6676488b
AC
28.SH LIBRARY
29Standard C library
8fc3b2cf 30.RI ( libc ", " \-lc )
900064d4
MK
31.SH SYNOPSIS
32.nf
b80f966b 33.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
900064d4 34.B #include <errno.h>
c6d039a3 35.P
900064d4
MK
36.BI "extern char *" program_invocation_name ;
37.BI "extern char *" program_invocation_short_name ;
38.fi
39.SH DESCRIPTION
40.I program_invocation_name
41contains the name that was used to invoke the calling program.
c13182ef 42This is the same as the value of
900064d4 43.I argv[0]
c13182ef 44in
900064d4 45.IR main (),
c13182ef 46with the difference that the scope of
900064d4
MK
47.I program_invocation_name
48is global.
c6d039a3 49.P
900064d4 50.I program_invocation_short_name
c13182ef 51contains the basename component of name that was used to invoke
900064d4
MK
52the calling program.
53That is, it is the same value as
54.IR program_invocation_name ,
55with all text up to and including the final slash (/), if any, removed.
c6d039a3 56.P
d9bfdb9c 57These variables are automatically initialized by the glibc run-time
900064d4 58startup code.
4131356c 59.SH VERSIONS
900064d4 60The Linux-specific
4131356c 61.IR /proc/ pid /cmdline
900064d4 62file provides access to similar information.
4131356c
AC
63.SH STANDARDS
64GNU.
900064d4 65.SH SEE ALSO
0a4f8b7b 66.BR proc (5)