You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by rb...@apache.org on 2004/03/15 04:28:31 UTC

cvs commit: apr/test occhild.c

rbb         2004/03/14 19:28:31

  Modified:    test     occhild.c
  Log:
  Use APR in occhild so that it is portable.
  
  Revision  Changes    Path
  1.6       +12 -7     apr/test/occhild.c
  
  Index: occhild.c
  ===================================================================
  RCS file: /home/cvs/apr/test/occhild.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- occhild.c	5 Dec 2000 00:14:11 -0000	1.5
  +++ occhild.c	15 Mar 2004 03:28:31 -0000	1.6
  @@ -1,16 +1,21 @@
   #include "apr.h"
  -#include <stdio.h>
  -#if APR_HAVE_UNISTD_H
  -#include <unistd.h>
  -#endif
  -#include <stdlib.h>
  +#include "apr_file_io.h"
   
   int main(void)
   {
       char buf[256];
  +    apr_file_t *err;
  +    apr_pool_t *p;
  +
  +    apr_initialize();
  +    atexit(apr_terminate);
  +
  +    apr_pool_create(&p, NULL);
  +    apr_file_open_stdin(&err, p);
   
       while (1) {
  -        read(STDERR_FILENO, buf, 256);
  +        apr_size_t length = 256;
  +        apr_file_read(err, buf, &length);
       }
  -    return 0; /* just to keep the compiler happy */
  +    exit(0); /* just to keep the compiler happy */
   }