I’ve run into a strange stdin/EOF behaviour on AmigaOS 4.1 and wanted to check whether this is expected or a known issue.
I’m using the following minimal test program:
Code: Select all
/* compile with gcc test.c -o test
run and press CTRL-D (linux) or CTRL-\ (AmigaOS)
program should end without printing anything */
#include <stdio.h>
int main()
{
int input;
while ((input = getchar()) != EOF) {
printf("got char %d\n", input);
}
return 0;
}
On AmigaOS 4.1, however, the program always prints:
Code: Select all
got char 10
This happens regardless of which C library I compile against: newlib, clib2, clib4, or vc. So it doesn’t seem to be tied to a specific runtime.
It looks like the console is delivering a newline character before reporting EOF. I’m not sure whether this is intended behaviour of the AmigaOS 4.1 shell, something in the console device, or a library quirk.
Environment:
- AmigaOS 4.1 Final Edition
- GCC toolchain, VBCC
- Tested with newlib, clib2, clib4, vc
- Standard shell, CTRL-\ for EOF
Has anyone seen this before or knows whether AmigaOS 4.1 handles EOF differently?
Any hints about the underlying stdin behaviour or console mode would be appreciated.