maux
Star on GitHub Buy me a coffee

man and more

Watch / man

Filmed on the Apple IIe 80-column display. The same session on the Videx UltraTerm: same keys, same text.

The Videx UltraTerm was an 80-column video card for the Apple IIe, with its own video memory and character generator, real hardware scrolling and more screen modes than the IIe's own 80 columns. This demo runs on either display; the UltraTerm film shows the original Videx UltraTerm, emulated.

The manual is on the disk. man sh opens the shell page on the alternate screen, SPACE shows the next page, / searches, and q brings the shell screen back exactly as it was.

What it types

Everything it types, in order. A line starting with $ is a command at the shell, RET included; keys lines are single keystrokes to a program (RET, ESC and the control keys are named).

$ man sh
  keys: <SPACE>/trap<RET>q

Between steps it presses ^L to clear the screen.

What the captions say

  1. Here RTFM is not a brush-off: the whole manual is on the disk.
  2. SPACE for the next page.
  3. / searches, the way it does in ed, ex and vi.
  4. q, and the shell screen comes back as it was.

The gate that proves it

This film is made by site/demos/man.py. Run as assertions, the same file is make check-demo-man, and it runs with the rest of the tests. It requires that the title row is the first line of the page, that the second page starts one screenful on, that the search puts the matching line on the top row, and that after q the shell screen is back untouched. The rows are computed on the host from the bytes of the manual page on the image. The checks themselves were tested: with more replaced by a copy of cat, or man by true, the demo fails at "the first page is up".

Transcript

The screen at every checkpoint the test checks, as the recorder saved it:

== host: the page is long and the second screenful is not blank (t=0.0 s)
$

== the first screenful is the page's first 23 lines (t=8.9 s)
SH(1)                General Commands Manual               SH(1)

NAME
       sh - command language

SYNOPSIS
       sh
       sh [-exE] script [arg ...]
       sh -s [arg ...]
       sh [-exE] -c string [name [arg ...]]
       sh -E

DESCRIPTION
       Sh is a command programming language that executes
       commands read from a terminal or a file.  A simple
       command is a sequence of nonblank words separated by
       blanks (a tab or a space). The first word specifies the
       name of the command; the remaining words are passed as
       arguments.  The value of a command is its exit status.

       Invocation.  With no operands sh reads standard input,
       prompting if it is a terminal.  The first operand after
       the options -e (exit on error) and -x (trace) names a
--More--(3%)

== the second screenful is the next 23 lines (t=16.2 s)
       script file, leaving standard input free for that
       script's commands; $0 is the script's path and the
       operands after it are $1, $2 and so on.  With -s the
       commands come from standard input and every operand is a
       positional parameter ($0 stays sh).  With -c the first
       operand is a command string, run as one line with no
       prompt and no line editor, and sh then exits with the
       status of the last command (usage error, status 2, if the
       string is missing); the next operand, if any, is $0 and
       the operands after it are $1, $2 and so on, as in POSIX
       sh -c.  The string is a single line: a newline inside it
       is not a command separator.  Standard input is untouched,
       so the string's commands read it.

       A script file may be in the system's standard text form
       (ProDOS TXT: low ASCII bytes, a carriage return $0D
       ending each line) as well as sh's own high-bit form; it
       runs as written.  This holds for a file named as the
       script, a file read by the . command and a file
       redirected to standard input, and not for text arriving
       on a pipe or typed at a terminal.

       Simple commands.  A command may be prefixed by
--More--(8%)

== the search puts the matching line on top (t=25.9 s)
       times, trap, unset, and exec with no command) persist in
       the shell, and so do those of a command that has no name
       (A=1 B=2, or A=1 > file).  Each stage of a pipeline takes
       its own.  A NAME=value word after the command name is an
       ordinary argument, and there is no -k.  Eight variables
       is the limit: an assignment that needs a ninth, or that
       names a readonly variable, stops the command with a
       message.  A name that does not fit the kernel's argument
       region is refused with a message and the command does not
       run.

       Line editing.  When standard input is the console and sh
       is reading a command at its own prompt, sh edits the line
       itself, with the console in raw mode for the length of
       that one line (a $( ) substitution, a script, a sourced
       file, a pipe or sh < file is read as before, and every
       command sh starts runs with the console cooked again).
       Bindings: Control-A and Control-E go to the start and end
       of the line; Control-B, Control-F and the left and right
       arrows move a character; Open Apple plus f or b (or ESC
       f, ESC b) move a word; Control-P, Control-N and the up
       and down arrows walk the history; Open Apple plus k (or
       ESC k), or Option plus k, deletes to the end of the line
--More--(16%)

== the top row holds the word (t=25.9 s)
       times, trap, unset, and exec with no command) persist in
       the shell, and so do those of a command that has no name
       (A=1 B=2, or A=1 > file).  Each stage of a pipeline takes
       its own.  A NAME=value word after the command name is an
       ordinary argument, and there is no -k.  Eight variables
       is the limit: an assignment that needs a ninth, or that
       names a readonly variable, stops the command with a
       message.  A name that does not fit the kernel's argument
       region is refused with a message and the command does not
       run.

       Line editing.  When standard input is the console and sh
       is reading a command at its own prompt, sh edits the line
       itself, with the console in raw mode for the length of
       that one line (a $( ) substitution, a script, a sourced
       file, a pipe or sh < file is read as before, and every
       command sh starts runs with the console cooked again).
       Bindings: Control-A and Control-E go to the start and end
       of the line; Control-B, Control-F and the left and right
       arrows move a character; Open Apple plus f or b (or ESC
       f, ESC b) move a word; Control-P, Control-N and the up
       and down arrows walk the history; Open Apple plus k (or
       ESC k), or Option plus k, deletes to the end of the line
--More--(16%)

== the shell screen is back, untouched (t=33.7 s)
$ man sh
$