ChangeLog:
[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
DJ
5
6#ifdef SIGNALS
7#include <signal.h>
8
9static void
10sigint_handler (int signo)
11{
12}
13#endif
14
c906108c
SS
15int
16main ()
17{
18 char x;
19 int nbytes;
20#ifdef usestubs
21 set_debug_traps();
22 breakpoint();
a12cc160
DJ
23#endif
24#ifdef SIGNALS
25 signal (SIGINT, sigint_handler);
c906108c
SS
26#endif
27 printf ("talk to me baby\n");
28 while (1)
29 {
30 nbytes = read (0, &x, 1);
31 if (nbytes < 0)
32 {
33#ifdef EINTR
34 if (errno != EINTR)
35#endif
a12cc160
DJ
36 {
37 perror ("");
38 return 1;
39 }
c906108c
SS
40 }
41 else if (nbytes == 0)
42 {
43 printf ("end of file\n");
44 exit (0);
45 }
46 else
47 write (1, &x, 1);
48 }
085dd6e6 49 return 0;
c906108c
SS
50}
51
52int
53func1 ()
54{
55 return 4;
56}
This page took 1.08648 seconds and 4 git commands to generate.