Determine the OS type by guessing
At first, the environment variable OS
is checked, which is usually
found on Windows. Then, OSTYPE
is read in and compared with common
names. If this fails too, check the existence of files that can be
found on specific system types only.
Returns OS_UNKNOWN if the operating system cannot be determined.
calling POSIX or C routines would be far better, M_system::like system_uname(3f) but trying to use portable Fortran. If assume compiled by certain compilers could use their extensions as well. Most have a uname(3f) function.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | OS_CYGWIN | = | 4 | |
integer, | public, | parameter | :: | OS_FREEBSD | = | 6 | |
integer, | public, | parameter | :: | OS_LINUX | = | 1 | |
integer, | public, | parameter | :: | OS_MACOS | = | 2 | |
integer, | public, | parameter | :: | OS_OPENBSD | = | 7 | |
integer, | public, | parameter | :: | OS_SOLARIS | = | 5 | |
integer, | public, | parameter | :: | OS_UNKNOWN | = | 0 | |
integer, | public, | parameter | :: | OS_WINDOWS | = | 3 | |
logical, | public | :: | file_exists | ||||
integer, | public | :: | r | ||||
character(len=80), | public | :: | scratch | ||||
character(len=G_var_len), | public | :: | val |