💾 Archived View for freeshell.de › gemlog › 2024-03-07_Edlin.gmi captured on 2024-03-21 at 15:04:55. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

Edlin 📝

I forgot that not long ago⁽ᵃ⁾ I tried writing a clone of ed, the original line-oriented Unix editor. So when I had a nostalgic moment about having used edlin many years ago, I tried writing a clone of that.

DOS was an operating system that consisted of three files, including the shell, back when memory came in kilobytes. The only editor you got was edlin, and everybody hated it. It was hard to use, lacked features, and was stuffed with oddities.

So why did I set out to clone it? I thought it was so limited that it would be easy. I forgot about implementing the quirks.

I found that you can run DOS in an emulator in your web browser⁽ᵇ⁾, so I had a play with edlin and found way more quirks than I remembered. For example...

You could prefix commands with a line number, so "4d" would delete line 4, or "+2d" would delete the line two ahead of the current line. And "+" without a number was also accepted, and it meant the current line. What do you think "++" would mean? Bet you wouldn't guess "current line times 2", but now you can figure out what "+++" would get you. On the other hand "-" also meant the current line, so what would you expect "--" to mean? Bet you wouldn't guess "line 1", and nor would you guess that "---" meant "current line minus 1". After that, even and odd length strings of minuses seem to alternate between "line 1" and "current line minus 1". This was enough to stop me wanting to clone edlin.

I suppose that I learned that if I want to write a feature limited editor, copying the quirks of an existing editor is pointless. If wanted to use edlin, I could have installed dos in a VM, or got the existing freedos clone, or found a web emulator. Oh, wait, I did do that last one.

#edlin

(a) Me posting about cloning ed - why did I try basically the same thing twice??

(b) PC DOS 3.3 in your web browser - a bunch of other OS emulators there too

back to gemlog