| www.delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| X-SWARE-Spam-Status: | No, hits=-0.1 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS |
| X-Spam-Check-By: | sourceware.org |
| MIME-Version: | 1.0 |
| Date: | Thu, 8 Oct 2009 00:10:11 -0300 |
| Message-ID: | <94b5b62d0910072010u50e1ab55m55de9d795614d303@mail.gmail.com> |
| Subject: | SIGINT default behavior |
| From: | Pedro Izecksohn <pedro DOT izecksohn AT gmail DOT com> |
| To: | cygwin AT cygwin DOT com |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
root AT 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 AT turion ~/programming/c/sigint
$ gcc -Wall test.c -o test_cygwin.exe
root AT turion ~/programming/c/sigint
$ ./test_cygwin.exe
Press Control c
ferror (stdin)
root AT 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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |