Skip to content

edlib: Fix infinite loop on EOF#5

Open
lhh wants to merge 1 commit into
FDOS:masterfrom
lhh:master
Open

edlib: Fix infinite loop on EOF#5
lhh wants to merge 1 commit into
FDOS:masterfrom
lhh:master

Conversation

@lhh

@lhh lhh commented May 20, 2025

Copy link
Copy Markdown

When running on non-DOS (e.g. Linux), if you hit ^D, it generates EOF. Right now, edlin goes into an infinite loop.

This patch causes an EOF receipt to cause edlin to exit gracefully, which also makes it scriptable:

lhh@fedora:~/tmp/edlin$ cat tmp.txt 
a
hello, world!
.
w
lhh@fedora:~/tmp/edlin$ cat tmp.txt | ./edlin hi.txt
edlin 2.10c, copyright (c) 2003 Gregory Pietsch
This program comes with ABSOLUTELY NO WARRANTY.
It is free software, and you are welcome to redistribute it
under the terms of the GNU General Public License -- either
version 2 of the license, or, at your option, any later
version.

hi.txt: 0 lines read
* :  : *hi.txt: 1 line written
*lhh@fedora:~/tmp/edlin$ cat hi.txt
hello, world!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant