Blob


1 .TH 9P 1
2 .SH NAME
3 9p \- read and write files on a 9P server
4 .SH SYNOPSIS
5 .B 9p
6 [
7 .B -a
8 .I addr
9 ]
10 .B read
11 .I path
12 .br
13 .B 9p
14 [
15 .B -a
16 .I addr
17 ]
18 .B readfd
19 .I path
20 .PP
21 .B 9p
22 [
23 .B -a
24 .I addr
25 ]
26 .B write
27 [
28 .B -l
29 ]
30 .I path
31 .br
32 .B 9p
33 [
34 .B -a
35 .I addr
36 ]
37 .B writefd
38 .I path
39 .PP
40 .B 9p
41 [
42 .B -a
43 .I addr
44 ]
45 .B stat
46 .I path
47 .PP
48 .B 9p
49 .B rdwr
50 .I path
51 .SH DESCRIPTION
52 .I 9p
53 is a trivial 9P client that can access a single file on a 9P server.
54 It can be useful for manual interaction with a 9P server or for
55 accessing simple 9P services from within shell scripts.
56 .PP
57 The first argument is a command, one of:
58 .TP
59 .B read
60 print the contents of
61 .I path
62 to standard output
63 .TP
64 .B write
65 write data on standard input to
66 .IR path ;
67 the
68 .B -l
69 option causes
70 .I write
71 to write one line at a time
72 .TP
73 .BR readfd ", " writefd
74 like
75 .B read
76 and
77 .B write
78 but use
79 .IR openfd (9p)
80 instead of
81 .IR open ;
82 this masks errors and is mainly useful for debugging
83 the implementation of
84 .I openfd
85 .TP
86 .B stat
87 execute
88 .I stat (9p)
89 on
90 .I path
91 and print the result
92 .TP
93 .B rdwr
94 Open
95 .I path
96 for reading and writing.
97 Then repeat until end-of-file on standard input:
98 copy a line from the file to standard output,
99 copy a line from standard input to the file.
100 Print errors, but don't give up.
101 .B Rdwr
102 is useful for interacting with servers like
103 .IR factotum (4).
104 .PD
105 .PP
106 .I 9p
107 dials
108 .I address
109 to connect to the 9P server.
110 If the
111 .B -a
112 option is not given,
113 .I 9p
114 requires the
115 .I path
116 to be of the form
117 .IB service / subpath \fR;
118 it connects to the Unix domain socket
119 .I service
120 in the name space directory
121 (see
122 .IR intro (4))
123 and then accesses
124 .IR subpath .
125 .SH EXAMPLE
126 To update
127 .IR plumber (4)'s
128 copy of your plumbing rules after editing
129 .BR $HOME/lib/plumbing :
130 .IP
131 .EX
132 cat $HOME/lib/plumbing | 9p write plumb/rules
133 .EE
134 .PP
135 To display the contents of the current
136 .IR acme (4)
137 window:
138 .IP
139 .EX
140 9p read acme/$winid/body
141 .EE
142 .SH SOURCE
143 .B \*9/src/cmd/9p.c
144 .SH SEE ALSO
145 .IR intro (4),
146 .IR intro (9p),
147 .IR 9pclient (3)