The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] Remember the ed thread?
@ 2021-03-29 14:34 Larry McVoy
  2021-03-29 15:09 ` Anders Damsgaard
                   ` (2 more replies)
  0 siblings, 3 replies; 34+ messages in thread
From: Larry McVoy @ 2021-03-29 14:34 UTC (permalink / raw)
  To: tuhs

I had *.clients.your-server.de crawling mcvoy.com in violation of my
robots.txt.  For whatever reason, the tty settings (or something) 
made vi not work, I dunno what the deal is, stty -tabs didn't help.

So I had to resort to ed to write and debug the little program below.
It was surprisingly pleasant, it's probably the first time I've used ed
for anything real in at least a decade.  My fingers still know it.

+1 for ed.  It's how many decades old and still useful?


#!/usr/libexec/bitkeeper/bk tclsh

int
main(void)
{
        FILE    log = popen("/var/log/apache2/dns.l", "r");
        string  buf, ip;
	string	dropped{string};

	fconfigure(log, buffering: "line");
        while (buf = <log>) {
                unless (buf =~ /([^ ]+\.your-server\.de\.) /) continue;
                ip = $1; 
		if (defined(dropped{ip})) continue;
		dropped{ip} = "yes";
		warn("DROP ${ip}\n");
		system("/sbin/iptables -I INPUT -s ${ip} -j DROP");
        }
}

^ permalink raw reply	[flat|nested] 34+ messages in thread
* Re: [TUHS] Remember the ed thread?
@ 2021-03-29 15:58 Norman Wilson
  2021-03-30  0:11 ` John Cowan
  0 siblings, 1 reply; 34+ messages in thread
From: Norman Wilson @ 2021-03-29 15:58 UTC (permalink / raw)
  To: tuhs

ed is the standard editor, they say.

The b command (stands for browse) came from late-1970s
U of T; rob probably brought it to 1127.  There were a
handful of other syntactic conveniences, like being
allowed to leave off the final delimeter of an s command,
and declaring that a missing address means 1 before the
comma or semicolon and $ after, so
	3,s/fish/&head
works over all lines from 3 to the last, and , standing
alone addresses the whole buffer.

Also the idea that s followed by a digit N means start
with the Nth instance of the pattern:
	s3/fish/&head/
affects only the third fish, and
	s3/fish/&head/g
every fish after the second.

I have all those tweaks, plus a few others, embedded in
my fingers from the qed produced by the same Toronto
hacks.  I contracted it from the copy rob left behind
at Caltech, which means it has been my editor of choice
for 40 years now (with sam as an alternate favourite
since its inception 35 years or so ago).  That qed
has a lot of cryptic programming stuff that I have
mostly forgotten because it was never that useful, but
what really hooked me was
a.  Multiple buffers, with the ability to move and
copy text between them reasonably smoothly (both with
the m and t commands and with an interpolate-into-input
magic character);
b.  The > < | commands, which respectively send the
addressed lines to a shell command (default ,), replace
the addressed lines or append after the single addressed
line the standard output of the shell command (default .),
and replaced addressed lines with what you get by
sending them (default ,) to the shell command, replacing
them with its standard output.

The last operators make qed into a kind of workbench,
both for massaging data and for constructing a list
of commands to send to the shell.

I gather current Linux/BSD eds have > and <, spelled
r ! and w !, but without | it just ain't the same,
rather like the way | revolutionized the shell.

I believe the credit for U of T ed and qed go mainly
to Rob Pike, Tom Duff, Hugh Redelmeier, and the (alas
now late) David Tillbrook.  David remained an avid
user of qed, continuing to add stuff to it.

Norman Wilson
Toronto ON

PS: this message, as most of my e-mail, composed by
typing it into qed, editing as needed, then running
	>mail tuhs@tuhs.org

^ permalink raw reply	[flat|nested] 34+ messages in thread
* Re: [TUHS] Remember the ed thread?
@ 2021-03-29 23:21 M Douglas McIlroy
  2021-03-30  3:39 ` Rich Morin
  0 siblings, 1 reply; 34+ messages in thread
From: M Douglas McIlroy @ 2021-03-29 23:21 UTC (permalink / raw)
  To: TUHS main list

> the hammer fired to make an impression the ribbon on the paper, which was
> caused the noise people associated with computer printers.

GE outdid the printer with a fantastically fast pneumatic card reader. The make
and break of the suction on each card repeated at aural frequency and so loud
that I hied off to the instrument stockroom to borrow a noise meter. It was 90db
at the operator's position.

^ permalink raw reply	[flat|nested] 34+ messages in thread
[parent not found: <CAKH6PiXmR6Jv0bkyOtHuk1ZLV64aeW7bnQkUnzV9-G_JaUVDAA@mail.gmail.com>]
* Re: [TUHS] Remember the ed thread?
@ 2021-03-31  0:54 Norman Wilson
  2021-03-31  1:29 ` John Cowan
  0 siblings, 1 reply; 34+ messages in thread
From: Norman Wilson @ 2021-03-31  0:54 UTC (permalink / raw)
  To: tuhs

John Cowan:

  We need a Great Unification of Line Editors.

====

A standard for the standard editor?

I thought the nice thing about standards was that there
were so many of them.

Norman Wilson
Toronto ON

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

end of thread, other threads:[~2021-03-31  2:34 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 14:34 [TUHS] Remember the ed thread? Larry McVoy
2021-03-29 15:09 ` Anders Damsgaard
2021-03-29 15:26   ` Brantley Coile
2021-03-29 15:36     ` Mark van Atten
2021-03-29 15:43       ` Brantley Coile
2021-03-29 15:52         ` Mark van Atten
2021-03-29 15:45     ` Andy Kosela
2021-03-29 15:51       ` Clem Cole
2021-03-29 17:22       ` arnold
     [not found]         ` <CALMnNGgWrFRjXk5N4PgTj0_Yw3W5nCR2=CYSASM6dnqTooy8Dw@mail.gmail.com>
2021-03-30  8:53           ` arnold
2021-03-29 15:37   ` Clem Cole
2021-03-29 15:42     ` Anders Damsgaard
2021-03-29 15:49     ` Larry McVoy
2021-03-29 16:01     ` Andy Kosela
2021-03-29 18:12     ` Tom Ivar Helbekkmo via TUHS
2021-03-29 16:20 ` Steve Nickolas
2021-03-29 19:50 ` Rob Pike
2021-03-29 20:50   ` Michael Usher via TUHS
2021-03-29 20:55     ` Larry McVoy
2021-03-29 21:10       ` Erik E. Fair
2021-03-29 21:14         ` Larry McVoy
2021-03-29 21:53         ` Clem Cole
2021-03-29 22:29           ` John P. Linderman
2021-03-30  4:30             ` Rob Pike
2021-03-30  7:37             ` Harald Arnesen
2021-03-30 15:00         ` Kenneth Goodwin
2021-03-29 15:58 Norman Wilson
2021-03-30  0:11 ` John Cowan
2021-03-29 23:21 M Douglas McIlroy
2021-03-30  3:39 ` Rich Morin
     [not found] <CAKH6PiXmR6Jv0bkyOtHuk1ZLV64aeW7bnQkUnzV9-G_JaUVDAA@mail.gmail.com>
2021-03-30 23:38 ` John Cowan
2021-03-31  2:34   ` Bakul Shah
2021-03-31  0:54 Norman Wilson
2021-03-31  1:29 ` John Cowan

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