The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] pre-more pager?
@ 2017-11-09 16:19 Norman Wilson
  2017-11-09 16:48 ` Arthur Krewat
  0 siblings, 1 reply; 42+ messages in thread
From: Norman Wilson @ 2017-11-09 16:19 UTC (permalink / raw)


Random832:

  ... and "p" (which is very minimalistic, despite using a few
  V8-specific library features, but V8 isn't in the web-accessible source
  archive) from Version 8 research unix.

====

p actually originated outside Bell Labs.  I think it was
written in the late 1970s at the University of Toronto.

I first saw it at Caltech, on the UNIX systems in the
High Energy Physics group that I ran for four years.
The first few of those systems were set up by Rob Pike,
who was at Caltech working on his masters degree (in
astrophysics, I think); p was there because Rob brought
it.

For those who don't know it, p has quite an elegant
design.  Its default page size is 22 lines, which
nicely fit the world of its time: allowed a couple
of lines of context between pages on a 24-line CRT;
evenly divided the 66-line pages (still!) output
by nroff and pr.  It uttered no prompt and required
neither raw nor cbreak nor even no-echo mode: it
printed the final line of each page sans newline;
to continue, you typed return, which was echoed,
completing that line before the next was printed.
It buffered text internally to allow backing up a few
pages, so it was possible to back up even when input
didn't come from a file (something I'm not sure the
more of the time could do).

Internally the buffering was done with a standalone
library that could have been used in other programs,
though I don't know whether it ever was.

p also led me to an enlightening programming story.
One day I was looking over the code, trying to understand
just how the buffering worked; part of it made no sense
to me.  To figure it out, I decided to write my own
simple, straightforward version with the same interface;
test and debug it carefully; then lay printouts of the
two implementations side-by-side, and walk through some
test cases.  This revealed that the clever code I couldn't
make out in the original was actually buggy: it scrambled
data (I forget the details) when read returned less than
a full buffer.

p (my version) is one of the several programs I bring along
to every new UNIX-derivative environment.  I use it daily.
I have also recently noticed a new bug: on OpenBSD, it
sometimes scrambles the last few lines of a file.  I have
figured out that that has something to do with whether
fclose (my version uses stdio) is called explicitly or
by exit(3), but I don't know yet whether it's the library's
fault or my own.

Even the simplest programs have things to teach us.

Norman Wilson
Toronto ON


^ permalink raw reply	[flat|nested] 42+ messages in thread
* [TUHS] pre-more pager?
@ 2017-11-09 13:33 Doug McIlroy
  0 siblings, 0 replies; 42+ messages in thread
From: Doug McIlroy @ 2017-11-09 13:33 UTC (permalink / raw)


>> head -20 < filename

> 
> too bad head doesn't exist on v7.

sed -20q:   same effect, same amount of typing.



^ permalink raw reply	[flat|nested] 42+ messages in thread
* [TUHS] pre-more pager?
@ 2017-11-08 22:58 Doug McIlroy
  0 siblings, 0 replies; 42+ messages in thread
From: Doug McIlroy @ 2017-11-08 22:58 UTC (permalink / raw)


> In the meantime, how did folks page through text like man sh

Chuckle. "Text like man sh" wasn't very long back then.
.,.20p was quite an effective pager. It could go backward,
and it didn't wipe out the screen (which can destroy the
record of the problem that caused you to consult a reference).
I still do it from time to time.

Doug


^ permalink raw reply	[flat|nested] 42+ messages in thread
* [TUHS] pre-more pager?
@ 2017-11-08 22:02 Paul Ruizendaal
  2017-11-08 22:20 ` Will Senn
  0 siblings, 1 reply; 42+ messages in thread
From: Paul Ruizendaal @ 2017-11-08 22:02 UTC (permalink / raw)


> 
> Regarding the links and old bsd's. The binary cr3 on 1bsd works in v7. 
> Also, the book I'm reading has a c program that does paging. But, I'm 
> always off down the rabbit hole... I tried to compile the cr3.c source 
> and I get this error:
> 
> # cc cr3.c
> Undefined:
> _fout
> _flush
> _getc
> _end
> 
> My understanding is that cc includes libc by default, so these must not 
> be in libc. But getc is standard lib, so what am I missing?

That source is for V6 not V7. V6 did not have the stdio lib yet, but a precursor to that.
The binary you are using has the older io routines statically linked in.

Paul



^ permalink raw reply	[flat|nested] 42+ messages in thread
* [TUHS] pre-more pager?
@ 2017-11-08 20:28 Noel Chiappa
  0 siblings, 0 replies; 42+ messages in thread
From: Noel Chiappa @ 2017-11-08 20:28 UTC (permalink / raw)


    > From: Clem Cole

    > many (most) Unix sites used Able DHDM's which were cheaper than DEC DZ's

Oh, our DZ's weren't DEC, but some off-brand (I forget what). We were too poor
to afford DEC gear! :-) (Our machines, first a /40, and later a /45, were
hand-me-down's.)

	Noel


^ permalink raw reply	[flat|nested] 42+ messages in thread
* [TUHS] pre-more pager?
@ 2017-11-08 20:02 Noel Chiappa
  2017-11-08 20:11 ` Forrest, Jon
                   ` (2 more replies)
  0 siblings, 3 replies; 42+ messages in thread
From: Noel Chiappa @ 2017-11-08 20:02 UTC (permalink / raw)


    > From: Jon Forrest

    > In the early days of Unix I was told that it wasn't practical to write a
    > pager because such a thing would have to run in raw mode in order to
    > process single letter commands, such as the space character for going on
    > to the next page. Since raw mode introduced a significant amount of
    > overhead on already overtaxed machines, it was considered an anti-social
    > thing to do.

Something sounds odd here.

One could have written a pager which used 'Return' for each new page, and run
it in cooked mode and not used any less cycles (in fact, more, IIRC the
cooked/raw differences in handling in the TTY driver).

But that's all second-order effects anyway. If one were using a serial line
hooked up to a DZ (and those were common - DH's were _much_ more expensive, so
poor places like my lab at MIT used DZ's), then _every character printed_
caused an interrupt. So the overhead from printing each screen-ful of text was
orders of magnitude greater than the overhead of the user's input to get the
next screen.

    > IIRC later versions of Unix added the ability to respond to a specific
    > list of single characters without going into raw mode. Of course, that
    > didn't help when full-screen editors like vi and the Rand editor came
    > out.

Overhead was definitely an issue with EMACS on Multics, where waking up a
process on each character of input was significant. I think Bernie's Multics
EMACS document discusses this. I'm pretty sure they used the Telnet RCTE
option to try and minimize the overhead.

       Noel


^ permalink raw reply	[flat|nested] 42+ messages in thread
* [TUHS] pre-more pager?
@ 2017-11-08 19:23 Noel Chiappa
  0 siblings, 0 replies; 42+ messages in thread
From: Noel Chiappa @ 2017-11-08 19:23 UTC (permalink / raw)


    > From: Will Senn

    > how did folks page through text like man sh and such before more?

We wrote our own versions of more. Here is one from the roughly-PWB1 systems
at MIT:

  http://ana-3.lcs.mit.edu/~jnc/tech/unix/s2/p.c

but on looking at it, I'm not 100% sure it's the one I used there (which is
documented in the MIT UPM).

Here's one I wrote for myself for use on V6:

  http://mercury.lcs.mit.edu/~jnc/tech/V6Unix.html#UCmds

before I retrieved all the MIT sources (above), if you want somthing to
actually use on V6/V7.

       Noel


^ permalink raw reply	[flat|nested] 42+ messages in thread
* [TUHS] pre-more pager?
@ 2017-11-08 18:54 Will Senn
  2017-11-08 18:59 ` Clem Cole
                   ` (4 more replies)
  0 siblings, 5 replies; 42+ messages in thread
From: Will Senn @ 2017-11-08 18:54 UTC (permalink / raw)


Hi,

In looking around the system v7 environment, I don't see a more command anywhere. I downloaded, converted, and attached 1bsd, 2bsd, and finally 3bsd and it was there that I found source for more... 3bsd looks like it's for VAX, not PDP-11, and it doesn't want to compile (looking for some externs that I gather are part of the distro's clib).

I may jump ship on V7 and head over to 2.9BSD, which, as I understand it, is a V7 with fixes and these kind of additional tools...

In the meantime, how did folks page through text like man sh and such before more? I know how to view sections of text using sed and ed's ok for paging file text (painful, but workable). I just can't seem to locate the idiomatic way of keeping everything from constantly scrolling out of view! Obviously, this isn't a problem on my mac as terminal works fine, but I like to try to stay in character as a 1970 time traveling unix user :).

Thanks,

Will

Sent from my iPhone


^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2017-11-10  7:31 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-09 16:19 [TUHS] pre-more pager? Norman Wilson
2017-11-09 16:48 ` Arthur Krewat
2017-11-09 17:19   ` Steve Nickolas
2017-11-09 18:15     ` Don Hopkins
2017-11-09 18:26     ` Arthur Krewat
  -- strict thread matches above, loose matches on Subject: below --
2017-11-09 13:33 Doug McIlroy
2017-11-08 22:58 Doug McIlroy
2017-11-08 22:02 Paul Ruizendaal
2017-11-08 22:20 ` Will Senn
2017-11-08 20:28 Noel Chiappa
2017-11-08 20:02 Noel Chiappa
2017-11-08 20:11 ` Forrest, Jon
2017-11-10  5:26   ` Random832
2017-11-10  7:31     ` Otto Moerbeek
2017-11-08 20:18 ` Clem Cole
2017-11-08 20:28   ` Ron Natalie
2017-11-08 22:47 ` Dave Horsfall
2017-11-08 19:23 Noel Chiappa
2017-11-08 18:54 Will Senn
2017-11-08 18:59 ` Clem Cole
2017-11-08 19:06 ` Arthur Krewat
2017-11-08 19:31   ` Jeremy C. Reed
2017-11-08 22:43   ` Dave Horsfall
2017-11-08 22:47     ` Arthur Krewat
2017-11-08 23:21       ` Dave Horsfall
2017-11-09  4:38         ` Will Senn
2017-11-09 13:18           ` Dan Cross
2017-11-09 14:29             ` Will Senn
2017-11-09 20:53           ` Dave Horsfall
2017-11-10  0:15             ` Arthur Krewat
2017-11-10  2:14               ` Ralph Corderoy
2017-11-08 19:12 ` Bakul Shah
2017-11-08 19:22 ` Random832
2017-11-08 21:18   ` Will Senn
2017-11-08 21:59     ` Ron Natalie
2017-11-08 22:00     ` Clem Cole
2017-11-08 22:18       ` Will Senn
2017-11-09  2:01   ` Steve Johnson
2017-11-09  2:16     ` Lyndon Nerenberg
2017-11-08 19:29 ` Forrest, Jon
2017-11-08 19:43   ` Ron Natalie
2017-11-08 21:03   ` Mark Green

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).