SIGINT default behavior
Pedro Izecksohn
pedro.izecksohn@gmail.com
Thu Oct 8 03:10:00 GMT 2009
root@turion ~/programming/c/sigint
$ cat test.c
#include <stdio.h>
#include <stdlib.h>
int main ()
{
printf ("Press Control c\n");
char buffer [3];
char *fgets_returned = fgets (buffer, sizeof buffer, stdin);
if (!fgets_returned)
{
if (ferror (stdin))
{
perror ("ferror (stdin)");
return EXIT_FAILURE;
}
if (feof (stdin)) printf ("EOF\n");
return EXIT_SUCCESS;
}
printf ("You did not press Control c .\n");
return EXIT_SUCCESS;
}
root@turion ~/programming/c/sigint
$ gcc -Wall test.c -o test_cygwin.exe
root@turion ~/programming/c/sigint
$ ./test_cygwin.exe
Press Control c
ferror (stdin)
root@turion ~/programming/c/sigint
$ cat /proc/version
CYGWIN_NT-6.0 1.5.25(0.156/4/2) 2008-06-12 19:34
The default behavior is not always the same. I also got:
ferror (stdin):
and
ferror (stdin): Interrupted system call
and the expected behavior of just the exit code 130.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list