| APS(1) | General Commands Manual | APS(1) |
aps — audio player
server
aps |
[command] |
The aps server maintains a queue of names
and manages the player. When the first item is added to the queue, the
player is executed with that item as it's final argument, if the player then
exits with a status of zero, the player is executed again on the next item
in the queue. This loop goes on until the player fails or a command like
stop is issued: the queue is circularly
linked.
aps listens for clients on a UNIX socket
bound to /tmp/aps (but see
ENVIRONMENT). Before entering the main
loop, aps will
fork(2) and execute
apc(1) to re-configure the itself. Once
aps is fully initialized and listening for clients,
it will fork(2) and
exit(2). (Utilizing this, it's easy to know
when you can issue commands as shown in the
EXAMPLES.)
After a client is accepted, aps waits for
a command (as described in Command
Syntax) to be sent, and, once received, executes responds with it's
output and return status, detailed in
Responses.
The available commands, their arguments, and their functions are listed below:
add
[name ...]closecommandslist
[pattern]lognextpauseSIGSTOP).play
[pattern]SIGCONT if one already exists). If
pattern is given, first seek to the first item
pattern matches.player
[player [argument ...]]previousremove
[pattern]root
[path]seek
patternstatusstopSIGTERM. After the
signal is sent, the player process may continue to exist, but is
ignored.terminatetoggletruncate
[name ...]Commands are line delimited; command arguments are whitespace separated, but may be quoted as described in Quoting to include whitespace.
Responses consist of zero or more lines (the command output) followed by a status line. A status line can either be ‘ok’, for successful completion of the command, or ‘error:’ followed by an error message if there was an issue.
If a line which would be interpreted as a status line is output by the command, it will be quoted before being sent. (See Quoting.)
Multi-word lines are currently possible, but only occur in the player command and may be removed in the future.
Quoting works as in the rc(1) shell from plan9/9front: Single quotes surround the string. To insert a single quote into the string, put two together.
There are three types of patterns: numeric, regex, and string.
Numeric patterns begin with a digit or minus. A single number or a comma separated range may be provided. Numbers refer to the offset from the current item, making zero the current item. Ranges are inclusive.
Regular expression patterns begin with a slash (‘/’) (forward-searching) or a question mark (‘?’) (backward-searching), or an exclamation point (‘!’) followed by a slash or question mark to negate the result. The regular expression is extended and ignores case distinctions, additionally, if prefixed
String expressions begin with a double quote (‘’) and only match items which match it exactly.
The player status can be one of
SIGTSTP or SIGSTOP.The aps utility exits 0 on success,
and >0 if an error occurs.
Log to /tmp/apslog:
$ aps 2>/tmp/apslogAdd items to the queue once aps is up and
running:
$ aps && apc add foo bar
bazThe player can be changed to be any program using the player command, so anyone with access to the socket can execute an arbitrary program as the server.
Jacob R. Edwards <jacob@jacobedwards.org>
| May 26, 2023 | jacob |