authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-12-18 00:01:18 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-12-18 00:01:18 -08:00
logc9b47dd116ee7627b1914dc9374d5dde829c9f7e
treed0542cd0e113e18b2b72fe7f5cf8b20ca10f5b3e
parent6e779d9740046f181a001d6290eebcff283aa532

zig-sys rework


3 files changed, 6 insertions(+), 8 deletions(-)

licenses.txt+1-3
...@@ -1,10 +1,8 @@...@@ -1,10 +1,8 @@
1MIT:1MIT:
2= https://spdx.org/licenses/MIT2= https://spdx.org/licenses/MIT
3- This3- This
4- git https://github.com/nektro/zig-errno
5- git https://github.com/nektro/zig-extras4- git https://github.com/nektro/zig-extras
6- git https://github.com/nektro/zig-libc5- git https://github.com/nektro/zig-sys-linux
7- git https://github.com/nektro/zig-sys-libc
86
9Unspecified:7Unspecified:
10- system_lib c8- system_lib c
src/lib.zig+4-4
...@@ -2,7 +2,7 @@ const std = @import("std");...@@ -2,7 +2,7 @@ const std = @import("std");
2const string = []const u8;2const string = []const u8;
3const List = std.ArrayList(string);3const List = std.ArrayList(string);
4const extras = @import("extras");4const extras = @import("extras");
5const libc = @import("sys-libc");5const linux = @import("sys-linux");
66
7var singles: std.StringArrayHashMap(string) = undefined;7var singles: std.StringArrayHashMap(string) = undefined;
8var multis: std.StringArrayHashMap(List) = undefined;8var multis: std.StringArrayHashMap(List) = undefined;
...@@ -68,7 +68,7 @@ pub fn parse(k: FlagDashKind) !std.process.ArgIterator {...@@ -68,7 +68,7 @@ pub fn parse(k: FlagDashKind) !std.process.ArgIterator {
68 }68 }
69 }69 }
70 std.log.err("Unrecognized argument: {s}{s}", .{ dash, name });70 std.log.err("Unrecognized argument: {s}{s}", .{ dash, name });
71 libc.exit(1);71 linux.exit(1);
72 }72 }
73 return argiter;73 return argiter;
74}74}
...@@ -79,7 +79,7 @@ pub fn parseEnv() !void {...@@ -79,7 +79,7 @@ pub fn parseEnv() !void {
79 for (singles.keys(), singles.values()) |k, *v| {79 for (singles.keys(), singles.values()) |k, *v| {
80 const u = try fixNameForEnv(alloc, k);80 const u = try fixNameForEnv(alloc, k);
81 defer alloc.free(u);81 defer alloc.free(u);
82 if (libc.getenv(u)) |value| {82 if (linux.getenv(u)) |value| {
83 v.* = value;83 v.* = value;
84 }84 }
85 }85 }
...@@ -90,7 +90,7 @@ pub fn parseEnv() !void {...@@ -90,7 +90,7 @@ pub fn parseEnv() !void {
90 defer alloc.free(u);90 defer alloc.free(u);
91 const w = try std.fmt.allocPrintZ(alloc, "{s}_{d}", .{ u, n });91 const w = try std.fmt.allocPrintZ(alloc, "{s}_{d}", .{ u, n });
92 defer alloc.free(w);92 defer alloc.free(w);
93 if (libc.getenv(w)) |value| {93 if (linux.getenv(w)) |value| {
94 try v.append(value);94 try v.append(value);
95 continue;95 continue;
96 }96 }
zig.mod+1-1
...@@ -5,4 +5,4 @@ license: MIT...@@ -5,4 +5,4 @@ license: MIT
5description: Config management for Zig.5description: Config management for Zig.
6dependencies:6dependencies:
7 - src: git https://github.com/nektro/zig-extras7 - src: git https://github.com/nektro/zig-extras
8 - src: git https://github.com/nektro/zig-sys-libc8 - src: git https://github.com/nektro/zig-sys-linux