aboutsummaryrefslogtreecommitdiff
path: root/slowbaud.rst
diff options
context:
space:
mode:
Diffstat (limited to 'slowbaud.rst')
-rw-r--r--slowbaud.rst49
1 files changed, 38 insertions, 11 deletions
diff --git a/slowbaud.rst b/slowbaud.rst
index 13e9e64..e88f890 100644
--- a/slowbaud.rst
+++ b/slowbaud.rst
@@ -21,9 +21,11 @@ simulate a low bitrate serial connection
SYNOPSIS
========
-**slowbaud** *<bits-per-sec>* [*<file>* ...]
+**slowbaud** [*<bits-per-sec>*] [*<file>* ...]
-**slowbaud** *<bits-per-sec>* **-c** [*<command>* [*<arg>* ...]]
+**slowbaud** [*<bits-per-sec>*] **-c** [*<command>* [*<arg>* ...]]
+
+**slowbaud** [*<bits-per-sec>*] **-e** *<string>* [*<string>* ...]
DESCRIPTION
===========
@@ -31,21 +33,40 @@ DESCRIPTION
slowbaud by default acts as a filter, or like the **cat(1)** command. It
reads files or its standard input, and writes the contents unmodified
to standard output... but slowly, at the given bits-per-second rate.
-Output is unbuffered.
+Input and output are unbuffered.
+
+slowbaud can also act like **echo(1)** (the **-e** option), or run an
+interactive command (the **-c** option).
+
+The *<bits-per-sec>* argument is optional. If it's not given, the
+bit rate will be set from **SLOWBAUD_BPS** in the environment, or a
+built-in default of 2400 if not set.
+
+OPTIONS
+=======
-With the **-c** option, it creates a pseudo-tty and runs the given command
-in it (or an interactive shell, if no command is given).
+**bits-per-sec**
+ The bit ("baud") rate to simulate. This must be the first argument.
+ slowbaud assumes that if the first argument is a number, it's the bit rate.
+ If you're trying to pass a filename that consists only of digits, give
+ **--** as the first argument, or use e.g. *./filename*.
-The *<bits-per-sec>* argument supports a range of 1 to 500000. Timing
-accuracy depends on your OS, kernel config (HZ and/or NO_HZ on Linux),
-and system load. No "fancy" techniques like realtime scheduling
-or hardware event timers are used. At bitrates up to 57600, on a
-typical unloaded Linux system, the timing should be around 99.7%
-accurate.
+**-e**
+ Echo mode. Prints all further arguments as strings to stdout, separated
+ by a single space, at the given bit rate. Does not support backslash-escapes, or any of
+ the options of the regular **echo** command.
+
+**-c**
+ Command mode. Next argument (if present) is the command to run, any remaining arguments
+ become arguments to the command. With no arguments after **-c**, a shell is spawned.
+ This creates a pseudo-tty, so the command can be interactive.
ENVIRONMENT
===========
+**SLOWBAUD_BPS**
+ Can be used to set the bit rate, when no *<bits-per-sec>* argument is used.
+
**SLOWBAUD_DEBUG**
Set this (to any value) in the environment to see verbose debug
output on stderr, including timing accuracy stats.
@@ -69,6 +90,12 @@ Of course, the child process could also exit with status 127...
NOTES
=====
+The bitrate has a range of 1 to 500000. Timing accuracy depends on
+your OS, kernel config (HZ and/or NO_HZ on Linux), and system load. No
+"fancy" techniques like realtime scheduling or hardware event timers
+are used. At bitrates up to 57600, on a typical unloaded Linux system,
+the timing should be at least 99.7% accurate.
+
We can't really insert a delay between the bits of a byte, since
I/O is done with byte granularity. For calculation purposes,
*<bits-per-sec>* is divided by 10 to get bytes per second. This