[manual index][section index]


main - operators on the basic Alphabet types


load alphabet
type /string
type /fd
type /wfd
type /status
type /cmd


Main refers to operators defined Alphabet's (see sh-alphabet(1)) root typeset (/).

In the following description of the modules provided, an entry such as:

echo string -> fd

describes a verb echo, which takes one argument of type string, and the result of which is of type fd. If the type is not one of those described above, it should be taken to be of type string.

All types and modules names are taken to be relative to the typeset root, /.

Modules defined within main include:

auth [-v] [-k keyfile] [-C alg] wfd -> wfd
Auth authenticates to a server connected to its argument wfd, and optionally adds encryption to the stream. If keyfile is given, it gives the filename of a key file (by default /usr/user/keyring/default is used). If alg is given, it specifies the encryption/hash algorithm to push (e.g. rc4_256/md5). If the -v flag is given, auth will print the name of the authenticated user to its diagnostic stream.
cat [fd...] -> fd
Cat reads all the data from each fd in sequence and writes it to its resulting fd.
create fd f -> status
Create creates a file named f and writes to it all the data from fd. Status will be empty if the writing has completed successfully.
dial addr -> wfd
Dial makes a connection to network address addr (see dial(2) for the address format), and returns the resulting connection.
echo [-n] string -> fd
Echo writes its argument string to its resulting fd. If the -n option is given, no newline will be appended.
export dir -> wfd
Export exports the namespace rooted at dir and serves it as a styx service on wfd.
fd n -> wfd
Fd takes file descriptor n, and makes it available for reading and/or writing as wfd.
filter fd cmd arg... -> fd
Filter starts the shell command cmd, and pipes through this all the data from its argument fd to its resulting fd. The provided arguments are accessible in the shell command as $*.
mount [-abc] [-x aname] wfd dir -> status
Mount mounts a connection to a styx server (wfd) onto dir. The meaning of the -a, -b, and -c flags is the same as for mount(1). Aname, if given, gives the attach name that will be passed with the mount request. '".TP '"par status... -> status '".B Par '"allows all its arguments to run in parallel. '"Its exit status is that of the last argument that '"returned a non-clean status.
parse string -> cmd
Parse parses string as a shell command or alphabet expression, and returns the result.
print fd n -> status
Print writes all the data from fd to file descriptor n.
pretty cmd -> string
Pretty returns a string representation of the alphabet expression cmd which is intended to be easier to read.
read f -> fd
Read reads the data from file f and writes it to its resulting fd.
rewrite [-d dsttype] cmd cmd -> cmd
Rewrite rewrites an alphabet expression to its canonical form, applying all auto-conversions, expanding all definitions, expanding pipe notation and checking that all types are compatible. The first cmd argument gives the alphabet expression to be rewritten; the second cmd should contain shell commands acceptable to sh-alphabet(1), declaring all the modules used in the expression. If dsttype is given, it specifies the return type of the final expression; auto-conversions will be applied to attain this type, if possible. '".TP '"seq [-ao] status... -> status '".B Seq '"allows each of its arguments to run in sequence. '"If the '".B -a '"flag is given, the first non-clean status it encounters '"will cause it to terminate all subsequent arguments. '"If the '".B -o '"flag is given, the first '".I clean '"status does the same. '"Note that some commands (e.g. '".BR create ) '"do some work regardless of sequence. '"The resulting status is that of the last command '"that was not terminated.
unparse cmd -> string
Unparse is the inverse operation to parse: it converts cmd to a string, and returns the result.
2fd wfd -> fd
2fd converts the read-write file wfd to the read-only fd.




sh-alphabet(1), alphabet-main(2), sh(1)

ALPHABET-MAIN(1 ) Rev:  Tue Mar 31 02:42:38 GMT 2015