Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/wapython
Path: blob/main/core/kernel/src/wasm/posix/stdlib.zig
1068 views
1
pub fn keepalive() void {}
2
const stdlib = @cImport(@cInclude("stdlib.h"));
3
const std = @import("std");
4
const expect = std.testing.expect;
5
6
// "The secure_getenv() function is intended for use in general-purpose libraries to avoid
7
// vulnerabilities that could occur if set-user-ID or set-group-ID programs accidentally
8
// trusted the environment." It is equal to getenv when this isn't an issue, and for
9
// webassembly it isn't.
10
export fn secure_getenv(name: [*:0]const u8) ?[*:0]u8 {
11
return std.c.getenv(name);
12
}
13
14
// This is missing from zig's libc for some reason, so i just ported it from
15
// zig/lib/libc/wasi/libc-top-half/musl/src/locale/strtod_l.c
16
// since it is needed by numpy and is part of stdlib officially.
17
18
// long double strtold_l(const char *restrict s, char **restrict p, locale_t l)
19
export fn strtold_l(s: [*c]const u8, p: [*c][*c]u8, l: *anyopaque) f128 {
20
_ = l;
21
return stdlib.strtold(s, p);
22
}
23
24