mctc_env_system Module

Module collecting commands to conveniently interface with system commands


Functions

public pure function dirname(path) result(dir)

Extract directory component from a file path (“.” if none is present)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: path

Input file path

Return Value character(len=:), allocatable

Extracted directory path

public function is_unix()

Try to determine if we run on Unix and probably can rely on POSIX compliance

Arguments

None

Return Value logical

Operating system seems to be Unix

public function is_windows()

Try to determine if we run on Windows and don’t have POSIX compliance around

Arguments

None

Return Value logical

Operating system seems to be Windows

public function join_path(a1, a2) result(path)

Join directory and leaf path segments with OS file separator

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: a1

Leading path segment

character(len=*), intent(in) :: a2

Trailing path segment

Return Value character(len=:), allocatable

Joined path string


Subroutines

public subroutine get_argument(idx, arg)

Obtain the command line argument at a given index

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: idx

Index of command line argument, range [0:command_argument_count()]

character(len=:), intent(out), allocatable :: arg

Command line argument

public subroutine get_variable(var, val)

Obtain the value of an environment variable

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: var

Name of variable

character(len=:), intent(out), allocatable :: val

Value of variable