Retrieves the value of an environment variable, if any.
fn var<S>(name: S) -> Result<&'static CStr, Errno>
where S: AsRef<[u8]>,| Name | Description |
|---|---|
| name | The name of the variable to be found. |
Returns the value of the variable with name name or an empty string if the variable does not have a value.
This function iterates over all environment variables. If if finds a variable whose whole string is equal to name, the empty string is returned. Otherwise it tries to split the variable at the first = character and compares the part before the = to name. If they compare equal, the part after the = is returned.