gdb/testsuite/
[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;
a12cc160
DJ
20#ifdef SIGNALS
21 signal (SIGINT, sigint_handler);
c906108c
SS
22#endif
23 printf ("talk to me baby\n");
24 while (1)
25 {
26 nbytes = read (0, &x, 1);
27 if (nbytes < 0)
28 {
29#ifdef EINTR
30 if (errno != EINTR)
31#endif
a12cc160
DJ
32 {
33 perror ("");
34 return 1;
35 }
c906108c
SS
36 }
37 else if (nbytes == 0)
38 {
39 printf ("end of file\n");
40 exit (0);
41 }
42 else
43 write (1, &x, 1);
44 }
085dd6e6 45 return 0;
c906108c
SS
46}
47
48int
49func1 ()
50{
51 return 4;
52}
This page took 1.492887 seconds and 4 git commands to generate.