home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!inmos!fulcrum!sie
- From: sie@fulcrum.co.uk (Simon Raybould)
- Subject: GCC signal handling bug
- Message-ID: <SIE.93Jan8094837@introitus.fulcrum.co.uk>
- Sender: news@fulcrum.co.uk
- Organization: Fulcrum Communications Ltd., Birmingham, England
- Date: Fri, 8 Jan 1993 09:48:37 GMT
- Lines: 53
-
-
- I appear to have found a BUG in GCC2.2.2 and 2.3.3 for the amiga. The
- program below works fine on the SUN on my desk.
-
- On the amiga, I have to press return after the ^C for it to see it
- which I don't have to do on the SUN. Also the ^C is only seen if it is
- on the first line typed, i.e. before the first newline.
-
- The ^C is only seen it I comment out the puts() line, with this line,
- the signals are ignored.
-
- Any advice much appreciated, this is stopping me finishing a rather
- important project.
-
- Sie
-
- --8<-- CUT HERE --8<-- CUT HERE --8<-- CUT HERE --8<-- CUT HERE --8<--
- /*
- * File : getc.c
- *
- * If I type ^C on the first line, it catches it.
- * If I press RETURN and then ^C on any of the following lines,
- * the signal handler does not get called ?
- *
- * If you include the "puts" line then signals are always ignored ?
- */
- #include <stdio.h>
- #include <signal.h>
-
- void sighndlr(s)
- {
- fprintf(stderr, "Caught signal, exiting\n");
- exit(1);
- }
-
- main()
- {
- char c;
-
- signal(SIGINT, sighndlr);
- /* puts("Type some chars"); /* With this line in, signals are always ignored */
- while((c = getc(stdin)) != -1) /* until EOF encountered */
- printf("c=%d\n", c);
- printf("Exiting normally\n");
- exit(0);
- }
- --8<-- CUT HERE --8<-- CUT HERE --8<-- CUT HERE --8<-- CUT HERE --8<--
-
- --
- Simon J Raybould (sie@fulcrum.co.uk) // {o.o}
- "What's on the end of the stick, Vic?" \X/AMIGA \-/
- ===========================================================================
- Fulcrum communications L.T.D., Fordrough Lane, Birmingham, B9 5LD, ENGLAND.
-