From c34cfba8ab10d5cf2dc69c01d55f3e244295cc6f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:51:05 -0300 Subject: main: --9p-quic goes (its help line, its parse and its refusals; QUIC leaves the build), and --tty-toggle and --tty-toggle= are parsed by one branch; flags.zig's QUIC rows go, and quicIncluded says a pardes with no --9p-quic serves none Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/main.zig | 35 ++++++++--------------------------- test/process/flags.zig | 3 --- 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/src/main.zig b/src/main.zig index 4b0d5220..58f9541a 100644 --- a/src/main.zig +++ b/src/main.zig @@ -97,8 +97,7 @@ const help_text = \\ The socket is under $XDG_RUNTIME_DIR, falling \\ back to ~/.local/state/pardes. \\ --9p-tcp= also serve 9P at tcp!!. - \\ --9p-quic= also serve at quic!! (-Dquic=true). - \\ --mount== mount a 9P session or Unix/TCP/QUIC endpoint under /n/. + \\ --mount== mount a 9P session or Unix/TCP endpoint under /n/. \\ Repeat for more mounts; os and self are reserved. \\ --detach run this session with no terminal (no window) \\ until one attaches; its panes, shells and files @@ -441,18 +440,15 @@ fn nativeMain(std_init: std.process.Init) !void { const a = args[i]; if (std.mem.eql(u8, a, "--tty")) { explicit_tty = true; - } else if (std.mem.startsWith(u8, a, "--tty-toggle=")) { + } else if (std.mem.eql(u8, a, "--tty-toggle") or std.mem.startsWith(u8, a, "--tty-toggle=")) { session_only = false; new_session = true; - opts.tty_toggle = parseCtrlKey(a["--tty-toggle=".len..]) orelse - badArgs(init.io, "--tty-toggle wants one letter, not '{s}'", .{a["--tty-toggle=".len..]}); - } else if (std.mem.eql(u8, a, "--tty-toggle")) { - session_only = false; - new_session = true; - i += 1; - if (i >= args.len) badArgs(init.io, "--tty-toggle needs a letter after it", .{}); - opts.tty_toggle = parseCtrlKey(args[i]) orelse - badArgs(init.io, "--tty-toggle wants one letter, not '{s}'", .{args[i]}); + const key = if (a.len > "--tty-toggle".len) a["--tty-toggle=".len..] else next: { + i += 1; + if (i >= args.len) badArgs(init.io, "--tty-toggle needs a letter after it", .{}); + break :next args[i]; + }; + opts.tty_toggle = parseCtrlKey(key) orelse badArgs(init.io, "--tty-toggle wants one letter, not '{s}'", .{key}); } else if (std.mem.eql(u8, a, "-n")) { session_only = false; new_session = true; @@ -485,19 +481,6 @@ fn nativeMain(std_init: std.process.Init) !void { opts.ninep_tcp = dial; } else if (std.mem.eql(u8, a, "--9p-tcp")) { badArgs(init.io, "--9p-tcp needs tcp!!", .{}); - } else if (std.mem.startsWith(u8, a, "--9p-quic=")) { - new_session = true; - const dial = a["--9p-quic=".len..]; - if (!std.mem.startsWith(u8, dial, "quic!")) - badArgs(init.io, "--9p-quic needs quic!!", .{}); - _ = @import("9p_io.zig").networkAddress(dial, true) catch - badArgs(init.io, "--9p-quic needs quic!!", .{}); - if (opts.ninep_quic != null) badArgs(init.io, "--9p-quic was specified twice", .{}); - if (!@import("9p_io.zig").quic_enabled) - badArgs(init.io, "QUIC is not included; rebuild with -Dquic=true", .{}); - opts.ninep_quic = dial; - } else if (std.mem.eql(u8, a, "--9p-quic")) { - badArgs(init.io, "--9p-quic needs quic!!", .{}); } else if (std.mem.startsWith(u8, a, "--mount=")) { new_session = true; const mount = a["--mount=".len..]; @@ -581,8 +564,6 @@ fn nativeMain(std_init: std.process.Init) !void { badArgs(init.io, "--9p names a session's own socket, and --attach has none of its own", .{}); if (opts.ninep_tcp != null and attach != null) badArgs(init.io, "--9p-tcp opens a session's own listener, and --attach has none of its own", .{}); - if (opts.ninep_quic != null and attach != null) - badArgs(init.io, "--9p-quic opens a session's own listener, and --attach has none of its own", .{}); if (opts.mounts.len != 0 and attach != null) badArgs(init.io, "--mount configures a session's own core, and --attach has none of its own", .{}); if (!new_session and !opts.nested and detach == null and attach == null and !resuming) forwarding: { diff --git a/test/process/flags.zig b/test/process/flags.zig index 7a1118f0..c9aa12fb 100644 --- a/test/process/flags.zig +++ b/test/process/flags.zig @@ -117,9 +117,6 @@ fn refusals(gpa: std.mem.Allocator, exe: [:0]const u8) !void { .{ &.{"--9p-tcp=quic!127.0.0.1!5640"}, "--9p-tcp needs" }, .{ &.{ "--9p-tcp=tcp!127.0.0.1!5640", "--9p-tcp=tcp!127.0.0.1!5641" }, "specified twice" }, .{ &.{ "--attach=work", "--9p-tcp=tcp!127.0.0.1!5640" }, "--attach has none" }, - .{ &.{"--9p-quic"}, "--9p-quic needs" }, - .{ &.{"--9p-quic="}, "--9p-quic needs" }, - .{ &.{"--9p-quic=tcp!127.0.0.1!5640"}, "--9p-quic needs" }, .{ &.{"--mount=os=work"}, "invalid mount name" }, .{ &.{"--mount=peer="}, "invalid mount name or dial" }, .{ &.{ "--mount=peer=one", "--mount=peer=two" }, "duplicate mount" }, -- cgit v1.3