source: trunk/test/test_ext.c.in@ 483

Last change on this file since 483 was 1, checked in by katerina, 19 years ago

Initial import

File size: 560 bytes
Line 
1#include <stdio.h>
2#include <stdlib.h>
3#include <errno.h>
4#include <string.h>
5#include <unistd.h>
6#include <fcntl.h>
7
8int main ()
9{
10 char line[256];
11 int flags;
12 FILE * foo = fopen ("MYPWDIR", "a");
13
14 flags = fcntl(STDIN_FILENO, F_GETFL);
15 fcntl(STDIN_FILENO, F_SETFL, flags|O_NONBLOCK);
16
17 xagain:
18 errno = 0;
19 while (NULL != fgets(line, 255, stdin))
20 {
21 fprintf (foo, "RECV: %s", line);
22 fflush (foo);
23 }
24 if (ferror(stdin) && errno == EAGAIN)
25 {
26 clearerr(stdin);
27 goto xagain;
28 }
29 fclose(foo);
30 return 0;
31}
32
33
Note: See TracBrowser for help on using the repository browser.