Provided by: manpages-ja-dev_0.5.0.0.20221215+dfsg-1_all bug

名前

       clearenv - 環境 (environment) をクリアする

書式

       #include <stdlib.h>

       int clearenv(void);

   glibc 向けの機能検査マクロの要件 (feature_test_macros(7)  参照):

       clearenv():
           /* Glibc since 2.19: */ _DEFAULT_SOURCE
               || /* Glibc versions <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE

説明

       The clearenv()  function clears the environment of all name-value pairs and sets the value
       of the external variable environ to NULL.  After this call, new variables can be added  to
       the environment using putenv(3)  and setenv(3).

返り値

       clearenv()  関数は、成功した場合は 0 を返し、 失敗した場合は 0 以外を返す。

バージョン

       glibc 2.0 以降で利用可能。

属性

       この節で使用されている用語の説明については、 attributes(7) を参照。

       ┌─────────────────┬───────────────┬─────────────────────┐
       │インターフェース属性                  │
       ├─────────────────┼───────────────┼─────────────────────┤
       │clearenv()       │ Thread safety │ MT-Unsafe const:env │
       └─────────────────┴───────────────┴─────────────────────┘

準拠

       (DG/UX,  HP-UX,  QNX,  などの)  多くの  UNIX  系 OS。 (FORTRAN77 へのバインディングである)
       POSIX.9。 POSIX.1-1996 では clearenv()  と putenv(3)  は採用されなかったが、  方針が変更さ
       れ、この標準規格の以降の号   (§   B.4.6.1  を参照)  では  採用されることになった。  しかし
       POSIX.1-2001 では putenv(3) だけが追加され、 clearenv()  の追加は否決された。

注意

       On systems where clearenv()  is unavailable, the assignment

           environ = NULL;

       というように変数 environ を設定すればよい。

       The clearenv()  function may be useful in security-conscious  applications  that  want  to
       precisely  control the environment that is passed to programs executed using exec(3).  The
       application would do this by  first  clearing  the  environment  and  then  adding  select
       environment variables.

       Note that the main effect of clearenv()  is to adjust the value of the pointer environ(7);
       this function does not erase the  contents  of  the  buffers  containing  the  environment
       definitions.

       DG/UX  と  Tru64  man  ページには次のように記されている: environputenv(3), getenv(3),
       clearenv()  関数以外で変更された場合、 clearenv()   はエラーを返し、プロセス環境は変更前の
       ままにされる。

関連項目

       getenv(3), putenv(3), setenv(3), unsetenv(3), environ(7)

この文書について

       この man ページは Linux man-pages プロジェクトのリリース 5.10 の一部である。プロジェクトの
       説明とバグ報告に関する情報は https://www.kernel.org/doc/man-pages/ に書かれている。