sysdepenv-common.f90

Path: sysdepenv-common.f90
Last Update: Sat Nov 18 02:16:00 JST 2006

SysdepEnv - 環境依存性ルーチン (環境変数取得)

Authors:Yasuhiro MORIKAWA
Version:$Id: sysdepenv-common.f90,v 1.1 2006/11/17 17:16:00 morikawa Exp $
Tag Name:$Name: gt4f90io-20070729 $
Copyright:Copyright (C) GFD Dennou Club, 2006. All rights reserved.
License:See COPYRIGHT

通常の処理系では getenv というサービスサブルーチンが 用意されている. (残念ながら、これらは Fortran90/95 の規格には 含まれていない)。これを使えない処理系では適宜対処が必要である。

Methods

Public Instance methods

Subroutine :
env :character(len = *), intent(in)
: 環境変数名
str :character(len = *), intent(out)
: 環境変数の値

この手続きは env に指定した環境変数の値を str へ返します. env 指定した環境変数が定義されていない場合は空文字が str へ 返ります. 処理系が GETENV() を有していない場合は常に空文字が str へ 返ります.

This procedure returns environment variable which is specified by env to str. If the environment variable is not set, blank is returned to str. If GETENV() is not implemented, blank is returned to str at all times.

[Source]

subroutine SysdepEnvGet(env, str)
  !
  ! この手続きは *env* に指定した環境変数の値を *str* へ返します.
  ! *env* 指定した環境変数が定義されていない場合は空文字が *str* へ
  ! 返ります.
  ! 処理系が <b>GETENV()</b> を有していない場合は常に空文字が *str* へ
  ! 返ります.
  !
  ! This procedure returns environment variable which is specified
  ! by *env* to *str*.
  ! If the environment variable is not set, blank is returned to *str*.
  ! If <b>GETENV()</b> is not implemented, blank is returned to *str*
  ! at all times.
  !
  implicit none
  character(len = *), intent(in)  :: env ! 環境変数名
  character(len = *), intent(out) :: str ! 環境変数の値
continue
  call getenv(trim(adjustl(env)), str)
end subroutine SysdepEnvGet

[Validate]