Fix skip.exp test failure observed with gcc-9.2.0
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / interrupt.c
CommitLineData
c906108c
SS
1#include <errno.h>
2#include <stdio.h>
085dd6e6
JM
3#include <unistd.h>
4#include <stdlib.h>
a12cc160 5
6f98576f
PA
6#include "../lib/unbuffer_output.c"
7
a12cc160
DJ
8#ifdef SIGNALS
9#include <signal.h>
10
11static void
12sigint_handler (int signo)
13{
14}
15#endif
16
c906108c
SS
17int
18main ()
19{
20 char x;
21 int nbytes;
6f98576f
PA
22
23 gdb_unbuffer_output ();
24
a12cc160
DJ
25#ifdef SIGNALS
26 signal (SIGINT, sigint_handler);
c906108c
SS
27#endif
28 printf ("talk to me baby\n");
29 while (1)
30 {
31 nbytes = read (0, &x, 1);
32 if (nbytes < 0)
33 {
34#ifdef EINTR
35 if (errno != EINTR)
36#endif
a12cc160
DJ
37 {
38 perror ("");
39 return 1;
40 }
c906108c
SS
41 }
42 else if (nbytes == 0)
43 {
44 printf ("end of file\n");
45 exit (0);
46 }
47 else
48 write (1, &x, 1);
49 }
085dd6e6 50 return 0;
c906108c
SS
51}
52
53int
54func1 ()
55{
56 return 4;
57}
This page took 2.170074 seconds and 4 git commands to generate.