.\" Copyright 2001 John Levon .\" .\" 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. .\" .\" Additions, aeb, 2001-10-17. .\" .\" Japanese Version Copyright (c) 2001-2002 Yuichi SATO .\" all rights reserved. .\" Translated Sun Nov 4 22:46:03 JST 2001 .\" by Yuichi SATO .\" Updated & Modifined Mon Jul 15 02:10:29 JST 2002 by Yuichi SATO .\" .TH CLEARENV 3 2010-10-04 "Linux" "Linux Programmer's Manual" .SH 名前 clearenv \- 環境 (environment) をクリアする .SH 書式 .nf .B #include .sp .B "int clearenv(void);" .fi .sp .in -4n glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .BR clearenv (): _SVID_SOURCE || _BSD_SOURCE .SH 説明 .BR clearenv () 関数は、名前と値が組になった全ての環境をクリアする。 さらに外部変数 .I environ の値を NULL にする。 .SH 返り値 .BR clearenv () 関数は、成功した場合は 0 を返し、 失敗した場合は 0 以外を返す。 .\" UNIX 系 OS の多くは、エラーの場合に \-1 を返す。 .\" もしくはエラーの場合でも何も返さない。 .\" glibc の info と Watcom C ライブラリには、 .\" 「0 以外の値 (を返す)」と記述されている。 .SH バージョン libc4, libc5 では使用できない。 glibc 2.0 以降の glibc で使用できる。 .SH 準拠 (DG/UX, HP-UX, QNX, などの) 多くの UNIX 系 OS。 (FORTRAN77 へのバインディングである) POSIX.9。 POSIX.1-1996 では .BR clearenv () と .BR putenv (3) は採用されなかったが、 方針が変更され、この標準規格の以降の号 (B.4.6.1 を参照) では 採用されることになった。 しかし POSIX.1-2001 では .BR putenv (3) しか追加されず、 .BR clearenv () の追加は否決された。 .SH 注意 この関数はセキュリティに考慮したアプリケーションで使われる。 この関数が使用できない場合は、 .nf environ = NULL; .fi というように変数 environ を設定すればよい。 .LP DG/UX と Tru64 man ページには次のように記されている: .I environ が .BR putenv (3), .BR getenv (3), .BR clearenv () 関数以外で変更された場合、 .BR clearenv () はエラーを返し、プロセス環境は変更前のままにされる。 .\" .LP .\" HP-UX には ENOMEM エラーがある。 .SH 関連項目 .BR getenv (3), .BR putenv (3), .BR setenv (3), .BR unsetenv (3), .BR environ (7)