diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 23:22:02 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | e3cf9c1ffb54a64ee519f02afec17e6859ef8242 (patch) | |
| tree | 5c719091bd3cb04272f1f6b86d0c13ef218ca0d4 /src/ninep/cols.zig | |
| parent | 9dc93a8d31f08f5aec81e7c076220b598db37cbb (diff) | |
| download | pardes-e3cf9c1ffb54a64ee519f02afec17e6859ef8242.tar.gz pardes-e3cf9c1ffb54a64ee519f02afec17e6859ef8242.zip | |
A ctl refusal quotes the offending word alone, everywhere: wrong #args in control message "Newcol", not "Newcol 2"
Some refusals quoted the whole line, arguments and all ("Newcol 2",
"Verbose maybe", "lock x"), others the word alone ("Theme", "Mount"),
so a script matching one could not match the other. Every ctl
refusal, the root's, a pane's and a column's, now quotes the message's
word alone, and one too long to quote whole gives up its middle.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/cols.zig')
| -rw-r--r-- | src/ninep/cols.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig index b2e62d28..e3b456ba 100644 --- a/src/ninep/cols.zig +++ b/src/ninep/cols.zig @@ -167,10 +167,10 @@ pub fn writeCtl(p: *Pardes, req: Req, serial: u32) Reply { } else false; // Plan 9's words for it, so a mount's errno is EINVAL as the root's // and a pane's ctl give (9ns reads "control message"). - if (!takes) return tree.failText(req.tag, E.INVAL, std.fmt.bufPrint(&p.fs.ename, "unknown control message \"{s}\": a column's ctl takes Delcol, Joincol, New or Tty", .{line[0..@min(line.len, 64)]}) catch "unknown control message"); + if (!takes) return tree.failText(req.tag, E.INVAL, std.fmt.bufPrint(&p.fs.ename, "unknown control message \"{s}\": a column's ctl takes Delcol, Joincol, New or Tty", .{pardes.ctlfs.ctl.firstWord(line)[0..@min(pardes.ctlfs.ctl.firstWord(line).len, 64)]}) catch "unknown control message"); // Only Tty takes a word (its shell); `New extra` is no New. if (!std.mem.eql(u8, word, "Tty") and word.len != line.len) - return tree.failText(req.tag, E.INVAL, std.fmt.bufPrint(&p.fs.ename, "wrong #args in control message \"{s}\"", .{line[0..@min(line.len, 64)]}) catch "wrong #args in control message"); + return tree.failText(req.tag, E.INVAL, std.fmt.bufPrint(&p.fs.ename, "wrong #args in control message \"{s}\"", .{pardes.ctlfs.ctl.firstWord(line)[0..@min(pardes.ctlfs.ctl.firstWord(line).len, 64)]}) catch "wrong #args in control message"); const col = layout.columnBySerial(p, serial) orelse return Reply.fail(req.tag, E.NOENT); p.exec_column = col; defer p.exec_column = null; |
