| ... | ... | @@ -1,9 +1,15 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); |
| 2 | 3 | const string = [:0]const u8; |
| 3 | 4 | const List = std.ArrayList(string); |
| 4 | 5 | const extras = @import("extras"); |
| 5 | 6 | const linux = @import("sys-linux"); |
| 6 | 7 | |
| 8 | const sys = switch (builtin.target.os.tag) { |
| 9 | .linux => linux, |
| 10 | else => unreachable, // TODO: |
| 11 | }; |
| 12 | |
| 7 | 13 | var singles: std.ArrayHashMap(string, string, std.array_hash_map.StringContext, true) = undefined; |
| 8 | 14 | var multis: std.ArrayHashMap(string, List, std.array_hash_map.StringContext, true) = undefined; |
| 9 | 15 | |
| ... | ... | @@ -68,7 +74,7 @@ pub fn parse(k: FlagDashKind) !std.process.ArgIterator { |
| 68 | 74 | } |
| 69 | 75 | } |
| 70 | 76 | std.log.err("Unrecognized argument: {s}{s}", .{ dash, name }); |
| 71 | | linux.exit(1); |
| 77 | sys.exit(1); |
| 72 | 78 | } |
| 73 | 79 | return argiter; |
| 74 | 80 | } |
| ... | ... | @@ -77,7 +83,7 @@ pub fn parseEnv() !void { |
| 77 | 83 | const alloc = singles.allocator; |
| 78 | 84 | |
| 79 | 85 | for (singles.keys(), singles.values()) |k, *v| { |
| 80 | | if (linux.getenv(k)) |value| { |
| 86 | if (sys.getenv(k)) |value| { |
| 81 | 87 | v.* = value; |
| 82 | 88 | } |
| 83 | 89 | } |
| ... | ... | @@ -86,7 +92,7 @@ pub fn parseEnv() !void { |
| 86 | 92 | while (true) : (n += 1) { |
| 87 | 93 | const w = try std.fmt.allocPrintZ(alloc, "{s}_{d}", .{ k, n }); |
| 88 | 94 | defer alloc.free(w); |
| 89 | | if (linux.getenv(w)) |value| { |
| 95 | if (sys.getenv(w)) |value| { |
| 90 | 96 | try v.append(value); |
| 91 | 97 | continue; |
| 92 | 98 | } |