xref: /openbsd-src/gnu/usr.bin/binutils/gdb/testsuite/gdb.base/interrupt.c (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1 #include <errno.h>
2 #include <stdio.h>
3 int
4 main ()
5 {
6   char x;
7   int nbytes;
8 #ifdef usestubs
9   set_debug_traps();
10   breakpoint();
11 #endif
12   printf ("talk to me baby\n");
13   while (1)
14     {
15       nbytes = read (0, &x, 1);
16       if (nbytes < 0)
17 	{
18 #ifdef EINTR
19 	  if (errno != EINTR)
20 #endif
21 	    perror ("");
22 	}
23       else if (nbytes == 0)
24 	{
25 	  printf ("end of file\n");
26 	  exit (0);
27 	}
28       else
29 	write (1, &x, 1);
30     }
31 }
32 
33 int
34 func1 ()
35 {
36   return 4;
37 }
38