This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

SIGINT default behavior


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]