Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to index page
Thread view  Board view
bencollver

Homepage

19.04.2024, 20:16
 

oed 7.4 for DOS (Announce)

Portable OpenBSD ed(1) for DOS, source code included.

Requires an 8086 CPU or better.

Built with the tiny-regex-c library.

Lightly tested on DOSBox-X and FreeDOS.

https://archive.org/details/oed74-for-dos

gopher://tilde.pink/1/~bencollver/files/dos/editor/oed/

Rugxulo

Homepage

Usono,
20.04.2024, 12:47

@ bencollver
 

oed 7.4 for DOS

> Portable OpenBSD ed(1) for DOS, source code included.

N.B. "OED" normally means "Oxford English Dictionary", which is pretty authoritative.

Cool, I'm actually interested (mostly due to my love of Sed, but I've also used GNU and Minix Ed a small bit).

> Requires an 8086 CPU or better.

bcc/dev86?? Is that tested? Small model doesn't offer much room to breathe.

I get wanting to use Free tools, but OpenWatcom is so much better. Heck, even IA-16 ELF/GCC would hopefully be better.

> Built with the tiny-regex-c library.

You also included bsded.exe for the normal regex build. Doesn't POSIX include regex anyways? DJGPP has some of it (BRE?), but it's probably slower than GNU's. I think in old days the BSD people based theirs on Henry Spencer's code. Even Borland used some of his code in later years.

Grep and Sed both evolved from Ed. Diff used to only target Ed. Ed evolved into Ex (Vi) and Sam.

* https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ed.html

bencollver

Homepage

20.04.2024, 16:36

@ Rugxulo
 

oed 7.4 for DOS

> > Portable OpenBSD ed(1) for DOS, source code included.
> > Requires an 8086 CPU or better.
>
> bcc/dev86?? Is that tested? Small model doesn't offer much room to
> breathe.

Yes, i built oed.com with bcc/dev86 and tested it. You are right, it doesn't offer much room to breathe. It's only good for editing small files like config files, recipes, etc.

BTW, here's a DOS build of "minix ed". It's about half the size of OpenBSD ed. On the flip side, minix ed has arbitrary buffer sizes and lacks undo.

https://archive.org/details/beattie-ed-1-for-dos

> I get wanting to use Free tools, but OpenWatcom is so much better. Heck,
> even IA-16 ELF/GCC would hopefully be better.

Thanks for the recommendation. I ought to give OpenWatcom a try.

Just out of curiosity, how would IA-16 be better?

> > Built with the tiny-regex-c library.
>
> You also included bsded.exe for the normal regex build. Doesn't POSIX
> include regex anyways? DJGPP has some of it (BRE?), but it's probably
> slower than GNU's. I think in old days the BSD people based theirs on Henry
> Spencer's code. Even Borland used some of his code in later years.

BCC and DJGPP both come with a regex implementation. BCC's is the original Spencer regex code posted to comp.sources. I believe the BSD code is based on Spencer's code, but has changed quite a bit since then.

I used tiny-regex-c because it is tiny. It shaves about 20kb off the executable, which makes a difference for the small memory model used by oed.com. Even more importantly, at 500 LOC, it's easier for me to wrap my head around and debug.

roytam

25.04.2024, 10:03

@ bencollver
 

oed 7.4 for DOS

> Portable OpenBSD ed(1) for DOS, source code included.
>
> Requires an 8086 CPU or better.
>
> Built with the tiny-regex-c library.
>

which fork of tiny-regex-c is used?

the original one has not been updated for ages: https://github.com/kokke/tiny-regex-c

while one of its fork is newer and has more features: https://github.com/gyrovorbis/tiny-regex-c

bencollver

Homepage

25.04.2024, 16:22

@ roytam
 

oed 7.4 for DOS

> > Built with the tiny-regex-c library.
>
> which fork of tiny-regex-c is used?

I used the original one. Thanks for the heads up. I will check out the fork, and also look into building with Watcom.

bencollver

Homepage

27.04.2024, 01:37
(edited by bencollver, 27.04.2024, 17:42)

@ roytam
 

oed 7.4 for DOS

I posted oed74d.zip, which has been rebuilt using the newer tiny-regex-c fork and Open Watcom for the 16-bit oed.exe.

p.s. I fixed a bug of mine. It wrote bogus end-of-line characters from the DJGPP and Watcom builds. The fixed version is in oed74d.zip

bencollver

Homepage

29.04.2024, 06:09

@ bencollver
 

oed 7.4 for DOS

I did more testing, found compatibility problems, and fixed them.

DJGPP printf doesn't consistently handle printing \t TAB characters.
It displays a "ring" character when running FreeDOS under DOSBox-X.
Normally, it moves the cursor right to the next tab stop.
This affects the output of the 'n' command.
Use "%-8d" format instead of "%d\t" in DJGPP.

DJGPP getche() handles echoing \b on Backspace keypress differently than the others.
It allows backspacing back up to the previous row.
BCC and Watcom always leave the cursor on the same row.
Use getch() instead of getche()

Watcom getche() doesn't consistently handle echoing \r on Enter keypress.
It uses INT 21h AH=01h.
In DOSBox, this echoes \r\n, advancing the cursor to the next row.
In FreeDOS, this echoes \r, leaving the cursor on the same row.
Use getch() instead of getche()


I posted the fixes in oed74e.zip

bencollver

Homepage

29.04.2024, 19:35

@ bencollver
 

oed 7.4 for DOS

The Watcom build of oed.exe began to fail. Instead of opening the file, it quit with the message "No error."

OpenBSD ed uses a temporary file for its scratch buffer. My changes silently failed to delete the temporary file on quit. Watcom's mkstemp() uses a letter plus the PID to generate temporary file name. Since the PID is always the same, it would run out after 26 runs (a-z).

I fixed this problem so that it will delete the temporary files on quit, as it is supposed to.

I posted the fix in oed74f.zip

Rugxulo

Homepage

Usono,
27.05.2024, 19:02

@ bencollver
 

oed 7.4 for DOS

> I posted the fix in oed74f.zip

You neglected to include bsded.exe, only including oed.exe and oed32.exe. (Some scripts I have used with Minix ed and GNU ed won't work with tinyre.) Compiling it with DJGPP 2.05 seems to work, though.

Also, it seems to dislike # comments in scripts.

bencollver

Homepage

28.05.2024, 15:46

@ Rugxulo
 

oed 7.4 for DOS

> You neglected to include bsded.exe, only including oed.exe and oed32.exe.
> (Some scripts I have used with Minix ed and GNU ed won't work with tinyre.)
> Compiling it with DJGPP 2.05 seems to work, though.

Sorry about that. I just posted oed74g.zip to make sure bsded.exe is included.

I am afraid it is only at the gopher link for now. I think archive.org is currently dealing with DDoS attacks.

> Also, it seems to dislike # comments in scripts.

I don't think BSD ed supports # comments in scripts.

bencollver

Homepage

22.08.2024, 22:05

@ bencollver
 

oed 7.4 for DOS

I posted oed74h.zip

This fixes an issue in the tiny-re version that would freeze on a command such as 11s/foo/bar/g

Now it works as expected.

One of the main reasons i used tiny-re was to make it just small enough to compile with dev86 BCC. It barely fits in the tiny memory model and isn't good for much. I'm planning to remove tiny-re on my next update.

Back to index page
Thread view  Board view
22049 Postings in 2034 Threads, 396 registered users, 137 users online (0 registered, 137 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum