Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › std/ › start.zig › mainWithoutEnv
mainWithoutEnv
start.mainWithoutEnv
fn mainWithoutEnv (c_argc : c_int , c_argv : [*][*:0 ]c_char ) callconv (.c ) c_int
File
Code
fn mainWithoutEnv (c_argc : c_int , c_argv : [*][*:0 ]c_char ) callconv (.c ) c_int {
const argv = @as ([*][*:0 ]u8 , @ptrCast (c_argv ))[0 ..@intCast (c_argc )];
const environ : [:null ]?[*:0 ]u8 = switch (builtin .os .tag ) {
.wasi , .emscripten => environ : {
const c_environ = std .c .environ ;
var env_count : usize = 0 ;
while (c_environ [env_count ] != null ) : (env_count += 1 ) {}
break :environ c_environ [0 ..env_count :null ];
},
else => &.{},
};
const env_block : std .process .Environ .Block = .{ .slice = environ };
if (std .Options .debug_threaded_io ) |t | {
if (@sizeOf (std .Io .Threaded .Argv0 ) != 0 ) t .argv0 .value = argv [0 ];
t .environ = .{ .process_environ = .{ .block = env_block } };
t .environ_initialized = env_block .isEmpty ();
}
return callMain (argv , env_block );
}