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 sigint_handler(int signo)10sigint_handler (int signo) 11 { 12 } 13 #endif 14 15 int main()16main () 17 { 18 char x; 19 int nbytes; 20 #ifdef SIGNALS 21 signal (SIGINT, sigint_handler); 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 32 { 33 perror (""); 34 return 1; 35 } 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 } 45 return 0; 46 } 47 48 int func1()49func1 () 50 { 51 return 4; 52 } 53