[TUHS] "9 skills our grandkids won't have" - Is this a TUHS topic?
Leah Neukirchen
leah at vuxu.org
Sun Jul 3 05:36:27 AEST 2022
Clem Cole <clemc at ccc.com> writes:
> On Fri, Jul 1, 2022 at 10:03 AM Steve Nickolas <usotsuki at buric.co> wrote:
>
>> On Fri, 1 Jul 2022, Nelson H. F. Beebe wrote:
>>
>> > Ctrl-D signifies end of transmission. Some other O/Ses have used
>> > Ctrl-Z for that purpose, presumably because Z is the final letter
>> > of numerous alphabets.
>>
>> I thought only CP/M and its descendants did that. :o (Of course that
>> includes DOS and Windows)
>>
> Steve - The social disease spread of DOS-11, RT-11, CP/M, and MS/PS-DOS
> used ^Z as an EOF character in their text file format. The key is that
> they stored a block count, not a byte count in the META. Thus the last
> byte needs a marker to tell the OS to stop reading. [Early DEC OS's may
> have done that also, but I never looked at their FS formats].
>
> Unix, of course, never made any distinction to the core OS WRT to 'type'
> [other than Regular/Directory/Special] and Ken stored a character count.
> So there was no need to signal EOF with a markered stored on disk..
>
> A pipe or the shell on the other hand does have a need to signal the end of
> a transaction, and 'End of Transmission,' as Nelson points out, is the
> ASCII character reserved for the same.
But that's a common misconception and not how Ctrl-D works on Unix.
Ctrl-D is part of the terminal discipline and causes an immediate stop
of the current read(2) syscall. If nothing is in the input buffer,
this causes a zero-length read which is detected as end of file.
You can verify this e.g. by typing "foo<Ctrl-D>" into cat(1). It will
print "foo", but not exit. Another Ctrl-D will then quit cat(1) due
to the empty read.
In no case, a ASCII Ctrl-D 0x4 is sent over a pipe or to a shell.
(Over the pty, yes.)
cheers,
--
Leah Neukirchen <leah at vuxu.org> https://leahneukirchen.org/
More information about the TUHS
mailing list