summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.zig4
-rw-r--r--src/main.zig2
2 files changed, 2 insertions, 4 deletions
diff --git a/src/config.zig b/src/config.zig
index c89ab2e6..98dd1ae3 100644
--- a/src/config.zig
+++ b/src/config.zig
@@ -1009,9 +1009,7 @@ pub const Runtime = struct {
fn switchedTo(argument: ?[]const u8) error{NotOnOrOff}!?bool {
const text = std.mem.trim(u8, argument orelse "", " \t\r\n");
if (text.len == 0) return null;
- if (std.mem.eql(u8, text, "on")) return true;
- if (std.mem.eql(u8, text, "off")) return false;
- return error.NotOnOrOff;
+ return (std.meta.stringToEnum(enum { on, off }, text) orelse return error.NotOnOrOff) == .on;
}
// Slices are borrowed for one writeReport call. A root ctl read
diff --git a/src/main.zig b/src/main.zig
index 7b6fd6d4..3401c0b4 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -157,7 +157,7 @@ fn pageInto(io: std.Io, gpa: std.mem.Allocator, dial: []const u8, text: []const
if (c < ' ' or c == 0x7f) break false;
} else !pardes.filesystem.deniedAbove(cwd);
var line_buf: [4200]u8 = undefined;
- const dir_line = std.fmt.bufPrint(&line_buf, "{s}\n", .{if (plain) cwd else ""}) catch "\n";
+ const dir_line = std.fmt.bufPrint(&line_buf, "{s}\n", .{if (plain) cwd else ""}) catch unreachable; // a cwd of 4096 fits 4200
// Its serial read back on the open that asked, once the text is in:
// another client's exec meanwhile can never send it into that
// client's pane.