authorgravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2024-06-25 20:40:50+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-05 04:45:44-04:00
logb3afba8a70af984423fc24e5b834df966693b50a
treef953444df0560c4fafb7d1e22228757d4471fe8f
parent0d7aa1b637b26f87025b7c8b5dc20d9a92fbb7ab

std.c: Add setlocale()


1 files changed, 21 insertions(+), 0 deletions(-)

lib/std/c.zig+21
...@@ -1895,6 +1895,27 @@ pub extern "c" fn setlogmask(maskpri: c_int) c_int;...@@ -1895,6 +1895,27 @@ pub extern "c" fn setlogmask(maskpri: c_int) c_int;
18951895
1896pub extern "c" fn if_nametoindex([*:0]const u8) c_int;1896pub extern "c" fn if_nametoindex([*:0]const u8) c_int;
18971897
1898/// These are implementation defined but share identical values in at least musl and glibc:
1899/// - https://git.musl-libc.org/cgit/musl/tree/include/locale.h?id=ab31e9d6a0fa7c5c408856c89df2dfb12c344039#n18
1900/// - https://sourceware.org/git/?p=glibc.git;a=blob;f=locale/bits/locale.h;h=0fcbb66114be5fef0577dc9047256eb508c45919;hb=c90cfce849d010474e8cccf3e5bff49a2c8b141f#l26
1901pub const LC = enum(c_int) {
1902 CTYPE = 0,
1903 NUMERIC = 1,
1904 TIME = 2,
1905 COLLATE = 3,
1906 MONETARY = 4,
1907 MESSAGES = 5,
1908 ALL = 6,
1909 PAPER = 7,
1910 NAME = 8,
1911 ADDRESS = 9,
1912 TELEPHONE = 10,
1913 MEASUREMENT = 11,
1914 IDENTIFICATION = 12,
1915};
1916
1917pub extern "c" fn setlocale(category: LC, locale: ?[*:0]const u8) [*:0]const u8;
1918
1898pub const getcontext = if (builtin.target.isAndroid())1919pub const getcontext = if (builtin.target.isAndroid())
1899 @compileError("android bionic libc does not implement getcontext")1920 @compileError("android bionic libc does not implement getcontext")
1900else if (native_os == .linux and builtin.target.isMusl())1921else if (native_os == .linux and builtin.target.isMusl())