3 ms·
does the program not simply receive ^D as a normal character? I thought i was up to the program to interpret it
by heywhatupboys 4y ago
does the program not simply receive ^D as a normal character? I thought i was up to the program to interpret it
- bawolff 4y agoIt does not. Its still up to the program with how it wants to deal with end of file though.
- AdieuToLogic 4y agoWhen 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 https://en.wikipedia.org/wiki/Terminal_mode
- tannhaeuser 4y agoYes 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?"