Next: Initialization File, Previous: Single Query Mode, Up: smapc [Contents][Index]
If insufficient number of arguments is given in the command line,
smapc
enters interactive mode. In this mode it reads
commands from the standard input, executes them and displays the
results on the standard output. If the standard input is connected to
a terminal, the readline and history facilities are enabled
(see Command Line Editing in GNU
Readline Library).
When in interactive mode, smapc
displays its prompt and
waits for you to enter a command. The default prompt is the name
of the program, enclosed in parentheses:
(smapc) _
Depending on the first character, your input is recognized either as
a smapc
command, or as a query. All smapc
commands begin with a single punctuation character, called
command prefix. The default command prefix is a dot, but it can
be changed using the prefix
command (see prefix). The prefix is not a part of the command, it is merely a
means by which smapc
recognizes that it has been given a
command. So, when explaining commands below, we will refer to them by
their name, without the prefix.
The most important command is ‘open’. It takes a server URL as its argument and opens a connection to that server:
(smapc) .open unix:///var/run/smap/sockmap
Now, if you type two or more words (the first of them not starting
with the command prefix), smapc
builds a query using
the first word as of them is used as a map name and the rest of them
as a key. It then sends the request to the server using the socket
opened with the open
command and displays the
result on the standard output:
(smapc) aliases root@domain.com OK smith dmk <rev@another.domain>
If you wish to change to another URL, give another ‘open’ command. Do not bother to close the previously opened socket: it will be done automatically.
If you are going to send a series of queries using the same map, you will save yourself some typing by declaring the default map, e.g.:
(smapc) .map aliases
From now on, every non-command input you give will be treated as lookup keys for that map name, e.g.:
(smapc) root@domain.com OK smith dmk <rev@another.domain> (smapc) postmaster OK root (smapc) daemon NOTFOUND
If you forget what map you are currently using, type the map command without arguments. It will display the map name:
(smapc) .map current map is aliases
Finally, to forget the default map and return to typing map name before the key, use ‘nomap’:
(smapc) .nomap
To quit the program, type ‘.quit’. Typing end-of-file character (C-d) has the same effect.
To obtain a listing of available commands with a short description for each of them, type ‘help’ or ‘?’.
• Command Summary |
Next: Initialization File, Previous: Single Query Mode, Up: smapc [Contents][Index]