00001 #include "config.h" 00002 00003 #include "headers.h" 00004 00005 int main(int argc, char *argv[]) 00006 { 00007 int in = 0; 00008 char buffer[1024] = { 0 }; 00009 char *expected = "Hello World\n"; 00010 int c = 0; 00011 00012 in = STDIN_FILENO; 00013 for (c = 0; c < 1024; c++) buffer[c] = 0; 00014 read(in, buffer, strlen(expected)); 00015 if (strcmp(buffer, expected) != 0) { 00016 fprintf(stderr, "*** ERROR: Unexpected string read\n"); 00017 return(1); 00018 } 00019 sleep(5); 00020 for (c = 0; c < 1024; c++) buffer[c] = 0; 00021 read(in, buffer, strlen(expected)); 00022 if (strcmp(buffer, expected) != 0) { 00023 fprintf(stderr, "*** ERROR: Unexpected string read\n"); 00024 return(1); 00025 } 00026 close(in); 00027 return(0); 00028 } 00029