.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) .\" .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" License. .\" Modified Sat Jul 24 19:53:02 1993 by Rik Faith (faith@cs.unc.edu) .\" FIXME Many more values for 'name' are supported, some of which .\" are documented under 'info confstr'. .\" See for the rest. .\" These should all be added to this page. .\" See also the POSIX.1-2001 specification of confstr() .\" .\" Japanese Version Copyright (c) 1997 Hiroaki Nagoya .\" all rights reserved. .\" Translated by Hiroaki Nagoya .\" Updated 2005-09-06, Akihiro MOTOKI .\" Updated 2006-07-20, Akihiro MOTOKI , LDP v2.36 .\" .TH CONFSTR 3 2010-02-03 "GNU" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O confstr \- get configuration dependent string variables confstr \- コンフィグレーションに依存した文字列変数の取得 .\"O .SH SYNOPSIS .SH 書式 .nf .B #include .sp .BI "size_t confstr(int " "name" ", char *" buf ", size_t " len ); .fi .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .BR confstr (): _POSIX_C_SOURCE\ >=\ 2 || _XOPEN_SOURCE .\"O .SH DESCRIPTION .SH 説明 .\"O .BR confstr () .\"O gets the value of configuration-dependent string variables. .BR confstr () はコンフィグレーションに依存した文字列変数の値を取得する。 .PP .\"O The .\"O .I name .\"O argument is the system variable to be queried. .\"O The following variables are supported: 引き数 .I name は、問い合わせ内容を表すシステム変数である。 以下の変数がサポートされている。 .TP .\"O .BR _CS_GNU_LIBC_VERSION " (GNU C library only; since glibc 2.3.2)" .\"O A string which identifies the GNU C library version on this system .\"O (e.g, "glibc 2.3.4"). .BR _CS_GNU_LIBC_VERSION " (GNU C library 限定; glibc 2.3.2 以降)" そのシステムの GNU C ライブラリのバージョンを示す文字列 (例えば "glibc 2.3.4")。 .TP .\"O .BR _CS_GNU_LIBPTHREAD_VERSION " (GNU C library only; since glibc 2.3.2)" .\"O A string which identifies the POSIX implementation supplied by this .\"O C library (e.g, "NPTL 2.3.4" or "linuxthreads-0.10"). .BR _CS_GNU_LIBPTHREAD_VERSION " (GNU C library 限定; glibc 2.3.2 以降)" その C ライブラリが提供している POSIX 実装を示す文字列 (例えば "NPTL 2.3.4" や "linuxthreads-0.10")。 .TP .B _CS_PATH .\"O A value for the .\"O .B PATH .\"O variable which indicates where all the POSIX.2 standard utilities can .\"O be found. すべての POSIX.2 標準ユーティリティが見つかるような .B PATH の値。 .PP .\"O If .\"O .I buf .\"O is not NULL and .\"O .I len .\"O is not zero, .\"O .BR confstr () .\"O copies the value of the string to .\"O .I buf .\"O truncated to .\"O .I len \- 1 .\"O characters if necessary, with a null byte (\(aq\\0\(aq) as termination. .I buf が NULL でなく、かつ .I len が 0 でなければ .BR confstr () は取得した文字列の内容を .I buf にコピーする。必要ならば長さは .I len \- 1 文字に切り捨てられて、NULL バイト (\(aq\\0\(aq) で終端される。 .\"O This can be detected by comparing the return value of .\"O .BR confstr () .\"O against .\"O .IR len . 末尾が切り捨てられたかどうかを判定するには、 .BR confstr () の返り値を .I len と比較すればよい。 .PP .\"O If .\"O .I len .\"O is zero and .\"O .I buf .\"O is NULL, .\"O .BR confstr () .\"O just returns the value as defined below. .I len が 0 で .I buf が NULL ならば、 .BR confstr () は以下で定義された値 (訳注: 切り捨てる前の、取得した文字列の長さ) を返す。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O If .\"O .I name .\"O is a valid configuration variable, .\"O .BR confstr () .\"O returns the number of bytes (including the terminating null byte) .\"O that would be required to hold the entire value of that variable. .\"O This value may be greater than .\"O .IR len , .\"O which means that the value in .\"O .I buf .\"O is truncated. .I name が有効なコンフィギュレーション変数の場合、 .BR confstr () はその変数の値全体を保持するのに必要であったバイト数を返す (文字列終端のヌルバイトも含む)。この値は .I len より大きいこともある。この場合には、 .I buf に格納された値の末尾が切り詰められたことを意味する。 .\"O If .\"O .I name .\"O is a valid configuration variable, .\"O but that variable does not have a value, then .\"O .BR confstr () .\"O returns 0. .I name が有効なコンフィギュレーション変数だが、 変数が値を持っていない場合、 .BR confstr () は 0 を返す。 .\"O If .\"O .I name .\"O does not correspond to a valid configuration variable, .\"O .BR confstr () .\"O returns 0, and .\"O .I errno .\"O is set to .\"O .BR EINVAL . .I name が有効なコンフィグレーション変数に対応していなければ、 .BR confstr () は 0 を返し、 .I errno に .B EINVAL を設定する。 .\"O .SH ERRORS .SH エラー .\"O .TP .\"O .B EINVAL .\"O If the value of .\"O .I name .\"O is invalid. .TP .B EINVAL .I name の値が不正である。 .\"O .SH "CONFORMING TO" .SH 準拠 POSIX.1-2001. .\"O .SH EXAMPLE .SH 例 .\"O The following code fragment determines the path where to find .\"O the POSIX.2 system utilities: 次の部分的なコードは、 POSIX.2 システムのユーティリティがあるパス を取得するものである。 .br .nf .in +4n char *pathbuf; size_t n; n = confstr(_CS_PATH,NULL,(size_t) 0); pathbuf = malloc(n); if (pathbuf == NULL) abort(); confstr(_CS_PATH, pathbuf, n); .in .fi .\"O .SH "SEE ALSO" .SH 関連項目 .BR sh (1), .BR exec (3), .BR system (3)