By default, destination is the name of a file, typically one end of a named pipe. The -n option causes destination to be interpreted as a network address, as accepted by dial (2) (or listen with -s ). If destination is not provided, styxchat reads and writes 9P messages on its standard input, using /dev/cons where it would usually use its standard input and output.
Each line of standard input has the form:
Tversion " messagesize version"
Tauth " afid uname aname"
Tflush " oldtag"
Tattach " fid afid uname aname"
Twalk " fid newfid \f1[ name \f1... ]"
Topen " fid mode"
Tcreate " fid name perm mode"
Tread " fid offset count"
Twrite " fid offset data"
Tclunk " fid"
Tremove " fid"
Tstat " fid"
Twstat " fid name uid gid mode mtime length"
nexttag " \f1[ tag \f1]"
dump
The input is interpreted as space-separated fields using the quoting conventions of sh (1), allowing fields to contain spaces. Empty lines and lines beginning with # are ignored. The first field on each line is normally the name of a T-message. Subsequent fields provide parameter values for the corresponding message. Integers are given in the format accepted for integers by the Limbo compiler (e.g. 16rffff ): a tag is 16 bits, offset and length are 64 bits, and all others are 32-bit integers. If the an integer parameter field contains ~0 , it is taken to be the `all ones' value of appropriate size for that parameter; this is particularly useful with Twstat , where that value represents `no change'. In the ``mode'' field of a qid, letters can be given, representing mode bits: d for QTDIR , l for QTEXCL , a for QTAPPEND , and u for QTAUTH . In an Rstat message, the qid mode bits are copied into the Rstat mode field in the appropriate place.
Following the sh (1) quoting rules, an empty string is represented by a field containing \f5''\f1. The data field is sent as its UTF-8 representation as an array of bytes. The value for fid can be nofid (or NOFID ) to represent the `no fid' value in the protocol. The tag for each message is automatically supplied by styxchat , starting from 1, and incremented with each successful message transmission. The nexttag command will cause subsequent tags to start from tag ; if none is given, it will print the next tag value. The tag may be notag to represent the `no tag' value ( 16rFFFF ).
The dump command has the same effect as a -v option, allowing data display to be enabled later.
By default, styxchat sends a 9P client's T-messages and prints a server's R-messages. The -s option causes it to present a server's view: it prints the T-messages from 9P clients, and sends R-messages as it reads a textual representation of them from standard input:
Rversion " tag messagesize version"
Rauth " tag aqid"
Rflush " tag"
Rerror " tag ename"
Rattach " tag qid"
Rwalk " tag qid ..."
Ropen " tag qid iounit"
Rcreate " tag qid iounit"
Rread " tag data"
Rwrite " tag count"
Rclunk " tag"
Rremove " tag"
Rstat " tag qid mode atime mtime length name uid gid muid"
Rwstat " tag"
dump
The input conventions are as above, except that tags are required. A qid is a single field of the form path\f1\f5.\f1vers\f1[\f5.\f1type\f1], where the three values are decimal integers.