Function getenvZ [src]
Get an environment variable with a null-terminated name.
See also getenv.
Prototype
pub fn getenvZ(key: [*:0]const u8) ?[:0]const u8
Parameters
key: [*:0]const u8
Source
pub fn getenvZ(key: [*:0]const u8) ?[:0]const u8 {
if (builtin.link_libc) {
const value = system.getenv(key) orelse return null;
return mem.sliceTo(value, 0);
}
if (native_os == .windows) {
@compileError("std.posix.getenvZ is unavailable for Windows because environment string is in WTF-16 format. See std.process.getEnvVarOwned for cross-platform API or std.process.getenvW for Windows-specific API.");
}
return getenv(mem.sliceTo(key, 0));
}