NAME
9pcon – 9P to text translator

SYNOPSIS
aux/9pcon [ –cn ] [ –m msize ] service

DESCRIPTION
9pcon provides a textual interface to service, a conventional 9P server. By default, 9pcon interprets service as a file to be opened. The –c flag causes 9pcon to interpret service as a command to run which will carry out a (binary) 9P conversation over file descriptors 0 and 1. The –n flag causes 9pcon to interpret service as a network address to dial.

Once the connection is established, 9pcon prints R–messages as they arrive from the server, and sends T–messages as they are typed on standard input. There is no prompt. Lines beginning with # are ignored. The syntax for T–messages is one of:
Tversion msize version
Tauth afid uname aname
Tattach fid afid uname aname
Twalk fid newfid wname...
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
Tflush oldtag

See intro(5) for a description of the fields in each message. For the most part, the syntax mirrors the description of the messages in section 5. The exceptions are that the tags on the T–messages are added automatically; Twalk's nwname count is inferred from the number of wnames given; and Twstat's dir is in expanded form rather than being an opaque byte sequence. Note that since commands are parsed with tokenize (see getfields(2)), it is easy to pass empty strings for absent name, uid, and gid fields. To ease specifying default integer fields, the Twstat message recognizes ~0 in the mode, mtime, and length arguments. For example,
Twstat 101 '' '' sys ~0 ~0 ~0
sends a wstat message that attempts to change the group id associated with fid 101.

SOURCE
/sys/src/cmd/aux/9pcon.c

SEE ALSO
intro(5)

BUGS
There should be a flag to wait for responses, to facilitate scripting.