program_invocation_nameのヘルプ・マニュアル
日本語 英語
program_invocation_name --help
man program_invocation_name
INVOCATION_NAME(3) Linux Programmer’s Manual INVOCATION_NAME(3)
名前
program_invocation_name, program_invocation_short_name - プログラムの起
動に使われた名前を取得する
書式
#define _GNU_SOURCE
#include
extern char *program_invocation_name;
extern char *program_invocation_short_name;
説明
program_invocation_name は、呼び出し元プログラムの起動に使用された名 前
を 保 持する。内容は main() の argv[0] の値と同じだが、 program_invoca-
tion_name の方はスコープがグローバルである点が異なる。
program_invocation_short_name は、呼び出し元プログラムの起動に使用さ れ
た 名前の basename 部分を保持する。つまり、この変数の内容は、最後のスラ
ッシュ (/) とそれより前の部分がある場合、 program_invocation_name か ら
この部分を削除したものとなる。
これらの変数は glibc のランタイム・スタートアップ・コードで自動的に初期
化される。
準拠
これらの変数は GNU の拡張であり、移植性が必要なプログラムでは使用すべき
でない。
備考
Linux 独自のファイル /proc/[number]/cmdline でも同様の情報を得ることが
できる。
関連項目
proc(5), feature_test_macros(7)
GNU 2006-04-29 INVOCATION_NAME(3)
INVOCATION_NAME(3) Linux Programmer’s Manual INVOCATION_NAME(3)
NAME
program_invocation_name, program_invocation_short_name - obtain name
used to invoke calling program
SYNOPSIS
#define _GNU_SOURCE
#include
extern char *program_invocation_name;
extern char *program_invocation_short_name;
DESCRIPTION
program_invocation_name contains the name that was used to invoke the
calling program. This is the same as the value of argv[0] in main(),
with the difference that the scope of program_invocation_name is
global.
program_invocation_short_name contains the basename component of name
that was used to invoke the calling program. That is, it is the same
value as program_invocation_name, with all text up to and including the
final slash (/), if any, removed.
These variables are automatically initialized by the glibc run-time
startup code.
CONFORMING TO
These variables are GNU extensions, and should not be used in programs
intended to be portable.
NOTES
The Linux-specific /proc/[number]/cmdline file provides access to simi-
lar information.
SEE ALSO
proc(5), feature_test_macros(7)
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
GNU 2006-04-29 INVOCATION_NAME(3)