News for hackers. Stuff that matters.
Re:Getting the ^D by heywhatupboys on Sunday April 09, 2023 @11:01PM (#35508761)
does the program not simply receive ^D as a normal character? I thought i was up to the program to interpret it
Re:Getting the ^D by AdieuToLogic on Sunday April 09, 2023 @11:39PM (#35508955)
When a program reads from a pseudo-terminal device in "cooked mode"[0], ^D is the default control character to indicate "no more input will be made available."

A program reading from a file handle other than a pseudo-terminal or a pseudo-terminal set to be in "raw mode" will behave as you describe.

0 - https://en.wikipedia.org/wiki/Terminal_mode

Re:Getting the ^D by bawolff on Sunday April 09, 2023 @11:34PM (#35508926)
It does not. Its still up to the program with how it wants to deal with end of file though.
Re:Getting the ^D by tannhaeuser on Monday April 10, 2023 @02:27AM (#35509706)
Yes but the expectation still is to interpret it as "end of input", even for interactive programs. One that doesn't (unfortunately) is zsh where ^D makes autosuggest prompt "do you wish to see all n possibilities?"