HF RL Explorer

Task: Make a C Shell Exit Immediately on Ctrl+D (EOF) Even When Buffer Contains Text

Task: Make a C Shell Exit Immediately on Ctrl+D (EOF) Even When Buffer Contains Text: a task in Terminal-Lego-15k (Harbor dataset). When writing a simple shell in C on Linux, the standard fgets function has a particular behavior with Ctrl+D (EOF): if the user has already typed some text (e.g., ls…

The task

When writing a simple shell in C on Linux, the standard `fgets` function has a particular behavior with `Ctrl+D` (EOF): if the user has already typed some text (e.g., `ls`) and then presses `Ctrl+D`, `fgets` returns the text typed so far as a successful read. The `feof(stdin)` flag is set, but the shell may proceed…

Part of PrimeIntellect/Terminal-Lego-15k.