xref: /inferno-os/man/1/alphabet-main (revision 46439007cf417cbd9ac8049bb4122c890097a0fa)
ALPHABET-MAIN 1
NAME
main - operators on the basic Alphabet types
SYNOPSIS
.EX load alphabet type /string type /fd type /wfd type /status type /cmd

DESCRIPTION
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:

10 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:

10 \f5auth [\f5-v] [\f5-k keyfile] [\f5-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.

\f5cat [fd...] -> fd Cat reads all the data from each fd in sequence and writes it to its resulting fd .

\f5create 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.

\f5dial addr -> wfd Dial makes a connection to network address addr (see dial (2) for the address format), and returns the resulting connection.

\f5echo [-n] string -> fd Echo writes its argument string to its resulting fd . If the -n option is given, no newline will be appended.

\f5export dir -> wfd Export exports the namespace rooted at dir and serves it as a styx service on wfd .

\f5fd n -> wfd Fd takes file descriptor n , and makes it available for reading and/or writing as wfd .

\f5filter 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 arg uments are accessible in the shell command as $* .

\f5mount [\f5-abc] [\f5-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
\f5par 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.

\f5parse string -> cmd Parse parses string as a shell command or alphabet expression, and returns the result.

\f5print fd n -> status Print writes all the data from fd to file descriptor n .

\f5pretty cmd -> string Pretty returns a string representation of the alphabet expression cmd which is intended to be easier to read.

\f5read f -> fd Read reads the data from file f and writes it to its resulting fd .

\f5rewrite [\f5-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
\f5seq [\f5-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.

\f5unparse cmd -> string Unparse is the inverse operation to parse : it converts cmd to a string, and returns the result.

\f52fd wfd -> fd 2fd converts the read-write file wfd to the read-only fd .

SOURCE
/appl/alphabet/alphabet.b

/appl/alphabet/main/*.b

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