OSDN Git Service

(split) LDP: Update original to LDP v3.38.
[linuxjm/LDP_man-pages.git] / original / man3 / program_invocation_name.3
1 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
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.
21 .TH INVOCATION_NAME 3 2006-04-29 "GNU" "Linux Programmer's Manual"
22 .SH NAME
23 program_invocation_name, program_invocation_short_name \- \
24 obtain name used to invoke calling program
25 .SH SYNOPSIS
26 .nf
27 .BR "#define _GNU_SOURCE" "         /* See feature_test_macros(7) */"
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
35 contains the name that was used to invoke the calling program.
36 This is the same as the value of
37 .I argv[0]
38 in
39 .IR main (),
40 with the difference that the scope of
41 .I program_invocation_name
42 is global.
43
44 .I program_invocation_short_name
45 contains the basename component of name that was used to invoke
46 the calling program.
47 That is, it is the same value as
48 .IR program_invocation_name ,
49 with all text up to and including the final slash (/), if any, removed.
50
51 These variables are automatically initialized by the glibc run-time
52 startup code.
53 .SH "CONFORMING TO"
54 These variables are GNU extensions, and should not be
55 used in programs intended to be portable.
56 .SH NOTES
57 The Linux-specific
58 .I /proc/[number]/cmdline
59 file provides access to similar information.
60 .SH SEE ALSO
61 .BR proc (5)