I have a copy of a spiral-bound booklet with yellow covers called "The C
Programmer's Reference" by Morris I. Bolsky of the Systems Training
Center, AT&T Bell Laboratories, (C) 1985. A curious little snapshot of
1980s pre-ANSI C.
I posted a picture of the front cover (with table of contents) at
https://twitter.com/fanf/status/1475407500946157570
I think I rescued it from the office clear-out in 2013 when Cambridge
University Computing Service moved out of the old city-centre offices. I
probably picked it up from a stack of old books that were to be chucked;
wherever I found it, I can't remember who it belonged to. And now I no
longer work for the University, it has come home with me.
Tony.
--
f.anthony.n.finch <dot(a)dotat.at> https://dotat.at/
Southwest Forties, Cromarty, Forth, Tyne, Dogger: Southerly or
southeasterly, backing easterly or northeasterly later, 4 to 6,
becoming variable 3 for a time in Cromarty and Forth. Moderate,
occasionally rough at first in southwest Forties, Cromarty and Dogger.
Rain or showers, fog patches developing. Moderate or good,
occasionally very poor.
> It would be nice to hear about the rationale from a primary source.
Assembly language was deemed a last resort, especially as portability
was coming to the fore. As I wrote in A Research Unix Reader,
"Assembly language and magic constants gradually declined from the
status of the 'real truth' (v4) to utterly forgotten (v8)." In v7,
assembler usage was demoted to the bottom of syscall man pages. It
could also be found in /usr/src/libc/sys/*.s
Doug
Well, hallelujah, after much travail (I've tried this every Christmas
for at least 5 years now), I have succeeded in building vi on v7 from
2bsd. Had to patch the c compiler to enlarge the symbol table, tweak
some stuff here and there, but it finally built and installed without
any errors, yay.
Now, I just want it to do some editing, preferably in visual mode. I can
call it as ex or vi:
# ex
:
or
# vi
:
and q will exit, yay, again!
I have at least two problems:
1. It's not going "full" screen, even with TERM=vt100 or TERM=ansi set
(not that I was surprised, but it'd be nice)...
2. If I type a for append and type something, there's no way to get back
to the : prompt (ESC doesn't seem to work).
3. I'd like manpages (figure they might help with the above), but
they're on the tape as .u files?
I'm hoping this triggers some, oh yeah I remember that, type responses.
Thanks,
Will
So,
in v6, it was possible to use the mesg function from the system library
with:
ed hello.s
/ hello world using external mesg routine
.globl mesg
mov sp,r5
jsr r5,mesg; <Hello, World!\n\0>; .even
sys exit
as hello.sld -s a.out -l
a.out
Hello, World!
This was because v6 included mesg in the library, in v7, it doesn't look
like mesg is included, so doing the same thing as above requires that
code to write the message out be included and in addition system call
names are not predefined, so exit and write have to be looked up in
/usr/include/sys.s, resulting in the v7 equivalent file:
ed hello2.s
/ hello world using internal mesg routine
mov sp,r5
jsr r5,mesg; <Hello, World!\n\0>; .even
sys 1
mesg:
mov r0,-(sp)
mov r5,r0
mov r5,0f
1:
tstb (r5)+
bne 1b
sub r5,r0
com r0
mov r0,0f+2
mov $1,r0
sys 0; 9f
.data
9:
sys 4; 0:..; ..
.text
inc r5
bic $1,r5
mov (sp)+,r0
rts r5
as hello2.s
a.out
Hello, World!
My questions are:
1. Is mesg or an equivalent available in v7?
2. If not, what was the v7 way of putting strings out?
3. Why aren't the system call names defined?
4. What was the v7 way of naming system calls?
Will
All,
I've completed a new version of my "Installing and Using Research Unix
Version 7 in the SimH PDP-11/45 and 11/70 Emulators" tutorial/document
(wow, that's a mouthful). I'm calling it Version 2.0 - It is a
completely reorganized, updated, and edited version of the document.
The blog post announcement is on the blog: https://decuser.blogspot.com/
and the pdf is on google drive:
https://drive.google.com/file/d/1gDBxULlpLwezH-1RO_3ou_W7trElgSgT/view?usp=…
The new doc covers building a working v7 instance from tape files that
will run on the SimH emulator. First, the reader is led through the
restoration of a pristine v7 instance from tape to disk. Next, the
reader is led through adding a regular user, making the system
multi-user. Then, the reader is shown how to make the system
multi-session cable allowing multiple simultaneous sessions. Finally,
the system is put to use with hello world, DMR style, and the learn
system is enabled. It also includes a hyperlinked table of contents.
My hope is that the new version will be more useful than the prior
version, as well as more accurate. I really appreciate the input and
feedback y'all have given me over the intervening years.
Regards,
Will
> From: John Cowan
> Why use C syntax? What was wrong with Fortran, Lisp, or Cobol syntax,
> extended to do what you wanted?
Why do all hammers look basically the same? Because there's an 'ideal
hammer', and over time hammer design has asymtoted toward that 'ideal hammer'
design. One can't just keep improving the design indefinitely - diminishing
returns set in.
So I suspect there is, to some degree, a Platonic 'ideal syntax' for a
'classic block-structured' programming language, and to me, C came pretty
close to it.
I except LISP from that assessment, because LISP is built around a
fundamentally different model of how computations/algorithms are organized,
and C and LISP aren't directly comparable.
But that realization points to a deeper bug with the 'Platonic ideal
language' concept above, which is that languages are fundamentally, albeit at
a very deep conceptual level, tied to the basic concept of the computing
hardware they are to run on. C/COBOL/FORTRAN/etc are all for von Neumann-like
(in a broad sense) computing engines - a single thread of computation, which
happens sequentially.
But we've pushed that paradigm about as far as it can go, we're into
diminishing returns territory on that one. The future, starting with the
hardware, will be very different - and will need quite different languages.
(Go, from what little I know of it, is a baby step in this direction - it is
intended to make it easy to use multiple simultaneous loci of execution,
making use of the mutiple cores that are common now.)
I suspect we'll be shifting to radically different paradigms, 50 years from
now - massively parallel computing meshes (think Connection Machines on
steroids - or the human brain), and those will use fundamentally different
computing paradigms, and programming languages for them, which in turn will
need very different syntax.
Noel
> Lisp, _that's_ elegant.
The machine shines through Lisp even more brightly than it does
through C. Lisp attains incredible power from a tiny base: car, cdr,
cons, cond, T, F, null, lambda, def, exuding elegance that survives
even in a raging sea of parentheses.
For Lisp-friendly applications nowadays, I prefer Haskell, which is
much further away from the machine. Haskell code approaches--and
sometimes surpasses--the cleanliness of good mathematical notation.
For string processing, I remember Snobol 3 with great fondness.
But for everyday work with arrays and numbers, C is the workhorse.
Still, I wish that C would evaluate comma expressions in parallel
rather than in series, as in (a,b) = (b,a).
Doug
I enabled user accounting on my v7 instance and I noticed it "growing
without bound" and while this is noted as a possibility in the ac(1) man
page, I was pretty sure the original authors didn't mean 30k a second. I
scratched my head and thought for a while and then started experimenting
to see what the heck was going on. I removed /usr/adm/wtmp (which I had
created to enable accounting in the first place) and the little red disk
write arrow on my mac went away, but not the little green disk read
arrow... hmm. Something was keeping my v7 instance very busy reading
disk, that was for sure. I went through a few (dozens) more tests and
experiments, reread a bunch of man pages, Ritchie's v7 install note, and
thought some more and here's what I came up with...
If you modify your system to add dci lines and you enable some ttys in
/etc/ttys and you enable user accounting. Then, the next time you boot
into a kernel that doesn't have dci support, init or some other process
will try and fail to read the enabled ttys, log something in
/usr/adm/wtmp, if it exists, and then loop (very quickly), over and over
and over. If you aren't paying attention, this will hardly be noticeable
on modern hardware running simh, but I'm guessing this would have been
disastrous, back in the day.
The simple solution is to boot w/dci enabled when you have ttys enabled,
and only boot w/o dci enabled when you have disabled the ttys.
I'm guessing that this wasn't really ever an issue, back in the day, as
folks prolly didn't just yank their dci's and reboot a different kernel?
But, such are the joys of simulation.
Anyhow, if this doesn't sound like a very likely or reasonable analysis
of what was happening, I'd appreciate your letting me know, or if you've
experienced something like it before, it'd be great to know that I'm not
alone in this silliness.
Will
I'm pretty sure that I asked about learn ages back, but I couldn't find
any reference to it in the archives. So, I thought I would close the
possibly imaginary loop on it. Cuz, I figured it out, and it may prove
useful to others or with my track record, even myself in the future :).
Learn works fine in v7. It just needs to be properly installed. The
command is there already, so you may not need to follow all of the steps
below, but it doesn't hurt:
I did this as root, but it could possibly be done as another user, I'm
not sure.
cd /usr/src/cmd/learn
make
make lessons
make play; make log
That's it. make will complain about missing files that it tries to
delete, but these can be safely ignored, since make then creates them
anyway.
Here's the result run as a normal user:
$ learn
These are the available courses -
files
editor
morefiles
macros
eqn
C
If you want more information about the courses,
or if you have never used 'learn' before,
type 'return'; otherwise type the name of
the course you want, followed by 'return'.
macros
If you were in the middle of this subject
and want to start where you left off, type
the last lesson number the computer printed.
To start at the beginning, just hit return.
This script deals with the use of the "-ms" macro
package to produce Bell Laboratories style documents.
Before trying it, you should be familiar with the
editor. To test that, please enter the file
typed below, exactly as is, into file "decl". Then
type "ready".
.PP
When in the course of human events, it becomes
necessary for one people to dissolve the political bands which have
connected them with another, and to assume among the
powers of the earth the separate and equal station to which
the laws of Nature and of Nature's God entitle them, a decent
respect to the opinions of mankind requires that they should
declare the causes which impel them to the separation.
$ ed decl
?decl
a
.PP
When in the course of human events, it becomes
necessary for one people to dissolve the political bands which have
connected them with another, and to assume among the
powers of the earth the separate and equal station to which
the laws of Nature and of Nature's God entitle them, a decent
respect to the opinions of mankind requires that they should
declare the causes which impel them to the separation.
.
w
410
q
$ ready
Good. Lesson 1.1a (1)
When you have some document typed in "-ms" style,
you run it off on your terminal by saying:
nroff -ms file
where "file" is the name of the file it is on. For example,
the file "decl" in this directory is in a suitable format
for running off this way. Do so. Then type "ready".
$
Interrupt.
Want to go on? n
Bye.
$
Pretty slick, really, once you realize that the $ prompt isn't really
your shell, it's a shell within learn. Also, there's no learn manpage
although there is a document in vol2 of the programmer's manual that
describes the program. I couldn't figure out the canonical way to exit,
so I just CTRL-DELETE on my mac, which I figure it CTRL-BREAK (^C?).
That seems to work.
Oh, and according to /usr/src/cmd/learn/README, if you have any trouble:
Please report problems, bad lessons, etc., to
Brian Kernighan, MH 6021, 2C-518, or
Mike Lesk, MH 6377, 2C-572. Thanks.
Enjoy, and happy New Year, folks!
Will
> Joy’s original 2BSD tape will give you UCB Pascal.
While I agree with Kernighan that Pascal is not my favorite
programming language, UCB Pascal is my favorite compiler because of
its spectacularly good syntax diagnostics. The diagnostics are
automatically generated, so they have a completely consistent style
and never go down rabbit holes trying to explain an error.
The UCB trick is to report the exact spot where LR parsing chokes and
suggest a canonical alternate token that allows progress. This simple
strategy is startlingly effective; the compiler taught me Pascal in an
evening.
It occurred to me that Pascal would be a suitable language in which to
express a certain algorithm. Having skimmed the Pascal report a year
or more earlier, I knew it was a pretty typical language, so I grabbed
a sample program from somewhere and plowed ahead. I made mistake after
mistake, but every diagnostic was instantly suggestive. By the end of
the session I had a polished working program. In due time it was
accepted for publication.
Doug
I'm tooling around doing my annual dive into operating systems ancient
and not-so-ancient and I've gotten back around to v7 because it has a
working f77 in baseline. The 3b2 has f77 as an installable package but
it crashes and burns with read statements like: read *,var - in both
sysvr2 and sysvr3. After consulting with the fortran expert, I'm gonna
chalk it up to "man there's a lot of backstory to these seemingly simple
issues" and just work with v7... in full disclosure f77 also seems to
work fine on 211bsd, but that's too new for today's dive :).
Anyhow, I ran through my install notes from back in 2017 and did a few
updates on them to update urls (would everyone just go ahead and move to
https already?), fix some clunky examples, fix some typos, and update to
a more recent host environment (although some would argue that Mojave is
out of date - just give me a drop in replacement for Adobe Acrobat Pro X
(a 32 bit app) that doesn't phone home every 5 minutes and I'll move to
Monterey). Version 1.7 of the doc is posted on the blog:
https://decuser.blogspot.com/
Anyway, now I'm ready to add stuff to my shiny new v7 instance and
document the additions. So, on to the question of the hour... I did some
looking around and couldn't easily locate any v7 software archives for
additional software that will run on v7 (not the distros, which are
adequately hosted in the Unix Archive). Stuff like pascal, fortran iv,
fortran 90, basic, lisp and the ilk. Do y'all know of any good caches?
Later,
Will
So, I was bemoaning the fact that I couldn't really make sense of the
bas command in v7. In sysv2, it works and is similar enough to modern
dialects that I was able to get a simple example working, but with v7,
the best I was able to do was use it interactively, as a calculator.
Then I went looking for v7 videos on youtube and came across this Dr.
Dave's Diversions video: https://www.youtube.com/watch?v=LZUMNZTUJos
In it Dr. Dave demos a few simple versions of 99 bottles of beer in v7.
Wow! I wondered how he'd glommed the inner workings of bas - did he read
a book, just know it naturally, phone a friend, or what? Well, as it
turned out, he... wait for it... read the bas(1) man page! Wha?!
Ridiculous. So, I pulled out my v7 phone book and read the bas(1) man
page and sure enough, it was all there... how '_' is used for negation,
how those arcane for loops work, arrays?!, function calls?!, etc and so
on, all in 3 short pages.
So, two observations:
1. Those man pages from back in the day - wow. So terse, yet so well
written. With a little help from a friend (thanks, Dr Dave), they're
really all you need, sometimes.
2. Those early apps - wow. So obscure these days, but so ahead of their
time, too (thanks, Ken for making Dec 2021 interesting by doing what you
did back in the early 70's).
And a question (you knew it was coming): Besides the bas(1) page, is
there anything else written on Ken's basic out there in the wild? Oh,
and a bonus question, draw and erase from v5 appear to still be around
in v7, but not documented in the man page. Did it work and has anyone
written a Tektronix 611 emulator that works with v7?
Thanks,
Will
I'm a little flummoxed in trying to move some directories around in
svr2. Shouldn't the following work?
mkdir a
mkdir b
mv a b
I get the following error:
mv: b exists
I tried many of the possible variants including:
mv a b/
mv: b/ exists
mv a b/a
mv: directory rename only
cd b
mv ../a .
mv: . exists
mv ../a ./
mv: ./ exists
mv ../a ./a
mv: directory rename only
If moving directories into existing directories wasn't allowed in those
days, 1) how were directories managed? and 2) when did moving
directories into directories become a thing?
Are there any extant 2.11 manuals other than the online manual and various install and configure PDFs, available for download?
Also, am I understanding correctly that 2.11 is 2.10 plus some 4.3 backports and a ton of patches? If there aren’t any 2.11 specific docs, what would be the closest of what is available?
Will
Sent from my iPhone
> From: Clem Cole
> Try it on V6 or V7 and you will get 'directory exists' as an error.
The V6 'mv' is prepared to move a directory _within_ a directory (i.e.
'rename' functionality). I'm not sure why it's not prepared to move within
a partition; probably whoever wrote it wasn't prepared to deal with all the
extra work for that (unlink from the old '..', then link to the '..' in the
new directory, etc, etc).
(The MIT PWB1 had a 'mvdir' written by Jeff Schiller, so PWB1 didn't have
'move directory' functionality before that. MIT must have been using the PWB1
system for 6.031, which I didn't recall; the comments in 'mvdir' refer to it
being used there.)
The V6 'mv' is fairly complicated (as I found out when I tried to modify it
to use 'smdate()', so that moving a file didn't change its 'last write'
date). Oddly enough, it is prepared to do cross-partition 'moves' (it forks a
'cp' to do the move). Although on V6, 'cp' only does one file; 'cp *.c
{dest}' was not supported, there was 'cpall' for that. (Why no 'mvall', I
wonder? It would have been trivial to clone 'cpall'.)
Run fact; the V6 'mv' is the place that has the famous (?) "values of B will
give rise to dom!" error message (in the directory-moing section).
> if the BSD mv command for 4.1 supported it. If it did then it was not
> atomic -- it would have had to create the new directory, move the
> contents independently and then remove the old one.
Speaking of atomic operation, in V6 'mkdir' (not being a system call) was
not atomic, so if interrupted at 'just the right time', it could leave
the FS in an inconsistent state. That's the best reason I've come across
to make 'mkdir' a system call - it can be made atomic that way.
Noel
> what was the last Unix version
> that let users make arbitrary links, such that the file system was no
> longer a DAG? I recall in v6 days hearing that earlier Unix allowed
> this, and that cleanup (via icheck and friends) got to be near
> impossible.
>From v1 on (I'm not sure about PDP-7 Unix) only the superuser could do
that, so what you heard strikes me as urban legend. Perhaps some
installations abused root privilege to scramble the file system, but I
certainly didn't see that happen in Research systems.
Doug
On Dec 29, 2021, at 8:01 AM, Bakul Shah <bakul(a)iitbombay.org> wrote:
> On Dec 29, 2021, at 7:18 AM, Clem Cole <clemc(a)ccc.com> wrote:
>>
>> Think about the UNIX FS and the link system call. How is mv implemented? You link the file to the new directory and the unlink it from the old one. But a directory file can not be in two directories at the same time as the .. link would fail.
>
> Don’t see why linking a dir in two places is a problem.
To expand on this a bit, the “cd ..” case can be handled by not storing a ..
link in a dir. in the first place! Store the $PWD path in the u struct. Then
cd .. would simply lop off the last component, if one exists. Thus .. takes
you back only on the path you used! This also takes care of the issue with
symlinks (& does what csh did in user code).
The first specific mention of moving directories in Research is in
v10, but I'm sure that was implemented considerably earlier. The only
things special about moving a directory were that it needed root
privilege and checked against moving a directory into itself. As with
ordinary files, copying (with loss of hard links) happened only when
moving between different file systems. As far as I know, no atomicity
precautions were taken.
The core system of svr2 distributed by ATT for the 3b2-400 doesn't come
with manpages installed. Does anybody know of a set of manpages for SVR2
that can be installed into the system? It's not the end of the world, if
not... the user guide is available as a pdf, but it'd be handy to have
man on the system.
Will
Is it possible to use echo to send a vt-100 escape sequence in v6/v7/sysvr2?
I can write a c program to clear the screen and go home in sysvr2:
#define ASCII_ESC 27
main()
{
printf( "%c[2J", ASCII_ESC );
printf( "%c[H", ASCII_ESC );
}
and it works fine. I can type the escape sequences in as well, but I'd
just as soon write a shell script with an echo '[[2J;[[H' or something
similar without having to compile a clear command. Is it possible and
what do I need to know :)?.
Thanks,
Will
> From: Will Senn
> anything similar to modern behavior when handling the delete/backspace
> key where the character is deleted from the input and rubbed out? The
> default, like in v6/v7 for erase and kill is # and @. I can live with
> this, if I can't get it to do the rubout, because at least you can see
> the # in the input
I use ASCII 'backspace' (^H) on my V6, and it 'sort of' works; it doesn't
erase the deleted character on the screen, but if one then types corrected
characters, they overlay the deleted ones, leaving the corrected input. That
should work on everything later than V6.
The MIT PWB1 tty handler (link in a prior message) not only supported a 'kill
line' (we generally used '^U') which actually visibly deleted the old line
contents (on screen terminals, of course; on printing terminals you're
stuck), it also had suppport for '^R' (re-type line) and some other stuff.
Noel
Did svr2 have anything similar to modern behavior when handling the
delete/backspace key where the character is deleted from the input and
rubbed out? The default, like in v6/v7 for erase and kill is # and @. I
can live with this, if I can't get it to do the rubout, because at least
you can see the # in the input, but if I can figure out how to get it to
rubout the last character, I'd map erase to DEL, which I believe to be
^U (but since it's invisible, it's confusing when it doesn't rubout).
Will
All,
Are there any bootable media available for any SVR 2 systems available
online? Or are they all under IP lock and key? If so, what's the closest
system that is available to get a feel for that variety of OS?
Happy holidays, folks.
Will
Hi all, I received an e-mail looking for the ksh-88 source code. A quick
search for it on-line doesn't reveal it. Does anybody have a copy?
Cheers, Warren
Original e-mail:
I recently built a PiDP11 and have been enjoying going back in time
to 2.11BSD.. I was at UC Davis in the the early 1980's and we had
a few PDP-11/70's running 2.8/2.9 BSD. Back then we reached out to
David Korn and he sent us the source for KSH -- this would have been
in 1985ish if I remember, and we compiled it for 2.9 & 4.1BSD, Xenix,
and some other variants that used K&R C. It may have been what was
later called ksh88. I wish I still had the files from then..
I was wondering if you might know if there's an older version like this
or one that's been ported for 2.11BSD?
Many thanks,
Joe
Hey Warren,
First and foremost; Thank you so much for maintaining this mailing list, and for including me within the subscribers list. I find myself intrigued by some of the topics that transfer over to the “COFF” mailing list. Could you include me on that mailing list as well?
Peace.