The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Norman Wilson <norman@oclsc.org>
To: tuhs@tuhs.org
Subject: Re: [TUHS] earliest Unix roff
Date: Thu, 19 Sep 2019 14:42:58 -0400	[thread overview]
Message-ID: <1568918582.18253.for-standards-violators@oclsc.org> (raw)

Clem Cole:

  Exactly!!!!   That's what Eric did when he wrote more(ucb) -  he *added to
  Unix*.   The funny part was that USG thought more(ucb) was a good idea and
  then wrote their own, pg(att); which was just as arrogant as the info
  behavior from the Gnu folks!!!

======

And others wrote their own too, of course.  The one I know
best is p(1), written by Rob Pike in the late 1970s at the
University of Toronto.  I encountered at Caltech on the
system Rob had set up before leaving for Bell Labs (and
which I cared for and hacked on for the next four years
before following him).  By the time I reached BTL it was
a normal part of the Research system; I believe it's in
all of the Eighth, Ninth, and Tenth Edition manuals.

p is interesting because it's so much lighter-weight, and
because it has rather a different interior design:

Rather than doing termcappy things, p just prints 22 lines
(or the number specified in an option), then doesn't print
the newline after the 22nd line.  Hit return and it will
print the next 22 lines, and so on.  The resulting text just
flows up the glass-tty screen without any fuss, cbreak, or
anything.  (I believe the first version predated V7 and
therefore cbreak.)

Why 22 lines instead of 24, the common height of glass ttys
back then?  Partly because that means you keep a line or two
of context when advancing pages, making reading simpler.
But also because in those days, a standard page destined for
a printer (e.g. from pr or nroff, and therefore from man) was
66 lines long.  22 evenly divides 66, so man something | p
never gives you a screen spanning pages.

p was able to back up: type - (and return) instead of just
return, and it reprints the previous 22-line page; -- (return)
the 22 lines before that; and so on.  This was implemented
in an interesting and clever way: a wrapper around the standard
I/O library which kept a circular buffer of some fixed number
of characters (8KiB in early versions, I think), and a new
call that, in effect, backed up the file pointer by one character
and returned the character just backed over.  That made it easy
to back over the previous N lines: just make that call until
you've seen N newlines, then discard the newline you've just
backed over, and you're at the beginning the first line you want
to reprint.

As I vaguely recall, more was able to back up, but only when
reading from a real file, not a pipeline.  p could do (limited
but sufficient) backup from a pipeline too.

As a creature of its pre-window-system era, you could also type
!command when p paused as well.

I remember being quite interested in that wrapper as a
possible library for use in other things, though I never
found a use for it.

I also remember a wonderful Elements-of-Programming-Style
adventure with Rob's code.  I discovered it had a bug under some
specific case when read returned less than a full bufferful.
I read the code carefully and couldn't see what was wrong.
So I wrote my own replacement for the problematic subroutine
from scratch, tested it carefully in corner cases, then with
listings of Rob's code and mine side-by-side walked through
each with the problem case and found the bug.

I still carry my own version of p (rewritten from scratch mainly
to make it more portable--Rob's code was old enough to be too
clever in some details) wherever I go; ironically, even back to
U of T where I have been on and off for the past 30 years.
more and less and pg and the like are certainly useful programs;
for various reasons they're not to my taste, but I don't scorn
them.  But I can't help being particular fond of p because it
taught me a few things about programming too.

Norman Wilson
Toronto ON

             reply	other threads:[~2019-09-19 18:43 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-19 18:42 Norman Wilson [this message]
2019-09-19 22:42 ` Rob Pike
2019-09-19 22:55   ` Bakul Shah
  -- strict thread matches above, loose matches on Subject: below --
2019-09-19 18:50 [TUHS] [OT] " Norman Wilson
2019-09-19 19:00 ` Nemo Nusquam
2019-09-19 20:18   ` Larry McVoy
2019-09-19 20:42     ` [TUHS] " Andy Kosela
2019-09-19 18:10 Norman Wilson
2019-09-19 18:37 ` Clem Cole
2019-09-19 18:44   ` Jon Steinhart
2019-09-19 19:44 ` Steffen Nurpmeso
2019-09-19 20:38   ` John P. Linderman
2019-09-20 13:41     ` Steffen Nurpmeso
2019-09-20 15:03       ` Steffen Nurpmeso
2019-09-19 20:53 ` Bakul Shah
2019-09-15 22:07 Doug McIlroy
2019-09-17  0:20 ` Steve Johnson
2019-09-17  1:11   ` Arthur Krewat
2019-09-17  1:17     ` Larry McVoy
2019-09-17  1:26       ` Clem cole
2019-09-17  1:33         ` Larry McVoy
2019-09-17 22:39           ` Dave Horsfall
2019-09-17  1:36         ` Richard Salz
2019-09-17  1:57       ` Bakul Shah
2019-09-17  1:19   ` Bakul Shah
2019-09-15  2:45 Doug McIlroy
2019-09-13  3:20 [TUHS] My EuroBSDcon talk (preview for commentary) Warner Losh
2019-09-13 19:47 ` Clem Cole
2019-09-13 20:02   ` Clem Cole
2019-09-13 20:06     ` Clem Cole
2019-09-13 20:24       ` Jon Steinhart
2019-09-13 20:43         ` Clem Cole
2019-09-13 20:53           ` Diomidis Spinellis
2019-09-13 21:45             ` Clem Cole
2019-09-13 22:13               ` [TUHS] earliest Unix roff Warren Toomey
2019-09-13 22:55                 ` Clem Cole
2019-09-14  2:02                   ` Larry McVoy
2019-09-14  2:44                     ` Warren Toomey
2019-09-15  2:56                       ` U'll Be King of the Stars
2019-09-15  6:54                         ` arnold
2019-09-15  7:01                           ` Dave Horsfall
2019-09-15 16:17                             ` Jon Steinhart
2019-09-15 17:23                               ` Ronald Natalie
2019-09-15 19:48                             ` Clem Cole
2019-09-15 21:16                               ` Dave Horsfall
2019-09-15  7:32                           ` U'll Be King of the Stars
2019-09-15  7:46                             ` arnold
2019-09-15 19:37                           ` Clem Cole
2019-09-16  5:52                             ` arnold
2019-09-16 12:10                               ` Clem Cole
2019-09-16 12:26                                 ` Lars Brinkhoff
2019-09-16 13:42                                   ` Clem Cole
2019-09-16 14:54                                     ` Larry McVoy
2019-09-16 16:09                                     ` Paul Winalski
2019-09-16 22:05                                     ` Dave Horsfall
2019-09-16 22:33                                       ` reed
2019-09-17  0:11                                         ` Dave Horsfall
2019-09-17  0:02                                       ` Nemo Nusquam
2019-09-17  0:21                                         ` Arthur Krewat
2019-09-17 11:12                                         ` Thomas Paulsen
2019-09-17  0:46                                       ` Clem Cole
2019-09-16 13:13                                 ` Chet Ramey
2019-09-16 14:51                                 ` Larry McVoy
2019-09-16 14:57                                   ` Clem Cole
2019-09-16 15:14                                     ` Richard Salz
2019-09-16 15:48                                       ` Ronald Natalie
2019-09-16 16:10                                       ` Larry McVoy
2019-09-16 16:16                                         ` Jon Steinhart
2019-09-16 16:26                                           ` Larry McVoy
2019-09-16 16:31                                             ` Richard Salz
2019-09-16 16:45                                               ` Larry McVoy
2019-09-16 17:19                                                 ` KatolaZ
2019-09-16 17:24                                                   ` Larry McVoy
2019-09-16 17:32                                                     ` Jon Steinhart
2019-09-16 17:35                                                     ` Clem Cole
2019-09-16 17:37                                                   ` Jon Steinhart
2019-09-16 18:04                                                   ` Chet Ramey
2019-09-16 18:19                                                     ` KatolaZ
2019-09-16 23:24                                                     ` Dave Horsfall
2019-09-16 17:24                                                 ` Clem Cole
2019-09-16 17:00                                               ` Clem Cole
2019-09-17 11:20                                         ` Thomas Paulsen
2019-09-16 19:13                                       ` Steffen Nurpmeso
2019-09-16 19:31                                       ` Bakul Shah
2019-09-16 22:35                                     ` Dave Horsfall
2019-09-17  7:53                                   ` arnold
2019-09-17 14:21                                     ` Clem Cole
2019-09-17 15:03                                       ` arnold
2019-09-17 15:58                                     ` Christopher Browne
2019-09-17 18:15                                       ` arnold
2019-09-17 18:32                                         ` Warner Losh
2019-09-18  0:42                                         ` Adam Thornton
2019-09-16 21:42                                 ` Dave Horsfall
2019-09-16 21:48                                   ` Larry McVoy
2019-09-16 21:54                                     ` Jon Steinhart
2019-09-16 21:59                                       ` Larry McVoy
2019-09-17  5:07                                         ` Lars Brinkhoff
2019-09-16 22:10                                       ` Bakul Shah
2019-09-17  0:16                                   ` Greg 'groggy' Lehey
2019-09-17  0:31                                     ` Jon Steinhart
2019-09-17 12:20                                     ` David
2019-10-05 19:44                                 ` Michael Parson
2019-09-15 19:35                         ` Clem Cole
2019-09-15 20:49                           ` U'll Be King of the Stars
2019-09-16  6:20                             ` arnold
2019-09-16 12:13                               ` Clem Cole
2019-09-16 12:34                                 ` arnold
2019-09-16 14:52                                 ` Larry McVoy
2019-09-15 19:27                       ` Clem Cole
2019-09-15 19:31                         ` Jon Steinhart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1568918582.18253.for-standards-violators@oclsc.org \
    --to=norman@oclsc.org \
    --cc=tuhs@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).