ChangeLog:
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / interrupt.c
1 #include <errno.h>
2 #include <stdio.h>
3 #include <unistd.h>
4 #include <stdlib.h>
5
6 #ifdef SIGNALS
7 #include <signal.h>
8
9 static void
10 sigint_handler (int signo)
11 {
12 }
13 #endif
14
15 int
16 main ()
17 {
18 char x;
19 int nbytes;
20 #ifdef usestubs
21 set_debug_traps();
22 breakpoint();
23 #endif
24 #ifdef SIGNALS
25 signal (SIGINT, sigint_handler);
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
36 {
37 perror ("");
38 return 1;
39 }
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 }
49 return 0;
50 }
51
52 int
53 func1 ()
54 {
55 return 4;
56 }
This page took 0.031689 seconds and 4 git commands to generate.