diff options
Diffstat (limited to 'src/ninep/pane.zig')
| -rw-r--r-- | src/ninep/pane.zig | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index 48095c46..90934791 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -854,20 +854,14 @@ fn writeFlag(p: *Pardes, req: Req, pane: *Pane, file: PaneFile) Reply { return .{ .tag = req.tag, .written = @intCast(req.data.len) }; } -/// Writing `name` renames the buffer: a relative name resolves against the -/// pane's directory, as the tag's name field does. -/// acme's refusal of a name with a blank or a control character in it -/// (editors/acme/xfid.c:650-652). A blank inside a name is taken here, as -/// pardes names files with spaces; one at either end is refused, not -/// quietly cut off, so the name a script wrote is the name it gets. +/// acme's words for a name it refuses (editors/acme/xfid.c:650-652), the +/// reason after them. pub const e_name_char = "bad character in file name"; -/// Why `name` is not one file name, with the reason, or null: a newline, a -/// control byte, DEL or a C1 control (U+0080-U+009F), a blank at either -/// end, or bytes that are not UTF-8. -/// What no file name can hold, said: a newline (a name is one line) and -/// a NUL. Any other byte a file system takes is taken, controls and bytes -/// not UTF-8 included, so a name read from `name` writes back as it was. +/// What no file name can hold, said: a newline (a name is one line), a +/// NUL, a component over 255 bytes. Any other byte a file system takes is +/// taken, blanks, controls and bytes not UTF-8 included, so a name read +/// from `name` writes back as it was. fn nameFault(name: []const u8) ?[]const u8 { if (std.mem.indexOfScalar(u8, name, '\n') != null) return e_name_char ++ ": a newline (a name is one line)"; if (std.mem.indexOfScalar(u8, name, 0) != null) return e_name_char ++ ": a NUL"; @@ -895,6 +889,8 @@ pub fn heldNameFault(p: *Pardes, serial: u32, held: []const u8) ?[]const u8 { return null; } +/// Writing `name` renames the buffer: a relative name resolves against the +/// pane's directory, as the tag's name field does. fn writeName(p: *Pardes, req: Req, id: usize, pane: *Pane) Reply { // One name: its newline ends it, as `echo` writes it, and it is one. const name = if (std.mem.endsWith(u8, req.data, "\n")) req.data[0 .. req.data.len - 1] else req.data; |
