home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / amiga / programm / 18338 < prev    next >
Encoding:
Text File  |  1993-01-08  |  1.9 KB  |  64 lines

  1. Newsgroups: comp.sys.amiga.programmer
  2. Path: sparky!uunet!inmos!fulcrum!sie
  3. From: sie@fulcrum.co.uk (Simon Raybould)
  4. Subject: GCC signal handling bug
  5. Message-ID: <SIE.93Jan8094837@introitus.fulcrum.co.uk>
  6. Sender: news@fulcrum.co.uk
  7. Organization: Fulcrum Communications Ltd., Birmingham, England
  8. Date: Fri, 8 Jan 1993 09:48:37 GMT
  9. Lines: 53
  10.  
  11.  
  12. I appear to have found a BUG in GCC2.2.2 and 2.3.3 for the amiga. The
  13. program below works fine on the SUN on my desk.
  14.  
  15. On the amiga, I have to press return after the ^C for it to see it
  16. which I don't have to do on the SUN. Also the ^C is only seen if it is
  17. on the first line typed, i.e. before the first newline.
  18.  
  19. The ^C is only seen it I comment out the puts() line, with this line,
  20. the signals are ignored.
  21.  
  22. Any advice much appreciated, this is stopping me finishing a rather
  23. important project.
  24.  
  25. Sie
  26.  
  27. --8<-- CUT HERE --8<-- CUT HERE --8<-- CUT HERE --8<-- CUT HERE --8<--
  28. /*
  29.  * File : getc.c
  30.  *
  31.  * If I type ^C on the first line, it catches it.
  32.  * If I press RETURN and then ^C on any of the following lines,
  33.  * the signal handler does not get called ?
  34.  *
  35.  * If you include the "puts" line then signals are always ignored ?
  36.  */
  37. #include <stdio.h>
  38. #include <signal.h>
  39.  
  40. void sighndlr(s)
  41. {
  42.   fprintf(stderr, "Caught signal, exiting\n");
  43.   exit(1);
  44. }
  45.  
  46. main()
  47. {
  48.   char c;
  49.   
  50.   signal(SIGINT, sighndlr);
  51. /*  puts("Type some chars");      /* With this line in, signals are always ignored */
  52.   while((c = getc(stdin)) != -1) /* until EOF encountered */
  53.     printf("c=%d\n", c);
  54.   printf("Exiting normally\n");
  55.   exit(0);
  56. }
  57. --8<-- CUT HERE --8<-- CUT HERE --8<-- CUT HERE --8<-- CUT HERE --8<--
  58.  
  59. --
  60. Simon J Raybould    (sie@fulcrum.co.uk)               //              {o.o}
  61. "What's on the end of the stick, Vic?"              \X/AMIGA           \-/
  62. ===========================================================================
  63. Fulcrum communications L.T.D., Fordrough Lane, Birmingham, B9 5LD, ENGLAND.
  64.