unix-2.8.2.1: POSIX functionality
Copyright(c) The University of Glasgow 2002
LicenseBSD-style (see the file libraries/base/LICENSE)
Maintainerlibraries@haskell.org
Stabilityprovisional
Portabilitynon-portable (requires POSIX)
Safe HaskellNone
LanguageHaskell2010

System.Posix.Env.PosixString

Description

POSIX environment support

Synopsis

Environment Variables

getEnv Source #

Arguments

:: PosixString

variable name

-> IO (Maybe PosixString)

variable value

getEnv looks up a variable in the environment.

getEnvDefault Source #

Arguments

:: PosixString

variable name

-> PosixString

fallback value

-> IO PosixString

variable value or fallback value

getEnvDefault is a wrapper around getEnv where the programmer can specify a fallback as the second argument, which will be used if the variable is not found in the environment.

getEnvironment Source #

Arguments

:: IO [(PosixString, PosixString)]
[(key,value)]

getEnvironment retrieves the entire environment as a list of (key,value) pairs.

setEnvironment Source #

Arguments

:: [(PosixString, PosixString)]
[(key,value)]
-> IO () 

setEnvironment resets the entire environment to the given list of (key,value) pairs.

putEnv Source #

Arguments

:: PosixString

"key=value"

-> IO () 

putEnv function takes an argument of the form name=value and is equivalent to setEnv(key,value,True{-overwrite-}).

setEnv Source #

Arguments

:: PosixString

variable name

-> PosixString

variable value

-> Bool

overwrite

-> IO () 

The setEnv function inserts or resets the environment variable name in the current environment list. If the variable name does not exist in the list, it is inserted with the given value. If the variable does exist, the argument overwrite is tested; if overwrite is False, the variable is not reset, otherwise it is reset to the given value.

unsetEnv Source #

Arguments

:: PosixString

variable name

-> IO () 

The unsetEnv function deletes all instances of the variable name from the environment.

clearEnv :: IO () Source #

The clearEnv function clears the environment of all name-value pairs.

Program arguments

getArgs :: IO [PosixString] Source #

Computation getArgs returns a list of the program's command line arguments (not including the program name), as PosixStrings.

Unlike getArgs, this function does no Unicode decoding of the arguments; you get the exact bytes that were passed to the program by the OS. To interpret the arguments as text, some Unicode decoding should be applied.