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 standard library.
std › Io › Dispatch › processReplace Private Function processReplace Doc Source Private Function std.Io.Dispatch.processReplace
fn processReplace (userdata : ?*anyopaque , options : process .ReplaceOptions ) process .ReplaceError Params userdata : ?*anyopaque options : process .ReplaceOptions File Io/Dispatch.zig: 4079
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105 fn processReplace (userdata : ?*anyopaque , options : process .ReplaceOptions ) process .ReplaceError {
const ev : *Evented = @ptrCast (@alignCast (userdata ));
if (!process .can_replace ) return error .OperationUnsupported ;
ev .scan_environ .once (ev , &scanEnviron ); // for PATH
const PATH = ev .environ .string .PATH orelse default_PATH ;
var arena_allocator = std .heap .ArenaAllocator .init (ev .allocator ());
defer arena_allocator .deinit ();
const arena = arena_allocator .allocator ();
const argv_buf = try arena .allocSentinel (?[*:0 ]const u8 , options .argv .len , null );
for (options .argv , 0 ..) |arg , i | argv_buf [i ] = (try arena .dupeSentinel (u8 , arg , 0 )).ptr ;
const env_block = env_block : {
const prog_fd : i32 = -1 ;
if (options .environ_map ) |environ_map | break :env_block try environ_map .createPosixBlock (arena , .{
.zig_progress_fd = prog_fd ,
});
break :env_block try ev .environ .process_environ .createPosixBlock (arena , .{
.zig_progress_fd = prog_fd ,
});
};
return ev .execv (options .expand_arg0 , argv_buf .ptr [0 ].?, argv_buf .ptr , env_block , PATH );
}