A Socket Map Server
|Smap Manual (split by section):||?|
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 (readline)Command Line Editing section `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:
Depending on the first character, your input is recognized either as
smapc command, or as a query. All
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 section 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 firstname.lastname@example.org OK smith dmk <email@example.com>
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) firstname.lastname@example.org OK smith dmk <email@example.com> (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’:
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 ‘?’.
This subsection lists all available
commands along with their short description and a reference to the
part of this manual where they are described in detail. The command
names are given without prefix.
Open connection to socket map server at the given url. See smapc-open.
Close previously opened connection.
Show URL of the currently opened connection.
Display short command usage summary.
Set the default map name. Without arguments, print the name of the map currently in use. See smapc-defmap.
Clear the default map name. After this command, map names must be given explicitly with each query. See nomap.
With argument, sets the source address for outgoing queries. Without argument, displays currently used source address.
Sets the debug level. See section Tracing and Debugging, for a description of spec.
If char is given, sets it as the command prefix. If called without arguments, displays the currently selected command prefix.
Redefines the command prompt. Without arguments, prints the current prompt.
Prints the history of recently issued commands.
Quits interactive mode.
This command command toggles the display of
startup banner. When started,
smapc prints a short list
of information useful for beginning users: the program version and
warranty conditions and a command to get help, e.g.:
smapc (smap) 1.1 Copyright (C) 2010 Sergey Poznyakoff License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type ? for help summary (smapc) _
If you find this output superfluous and useless, you can suppress it by setting
in your initialization file.
Displays the package name and version number.
Displays the copyright statement.
|Smap Manual (split by section):||?|
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.