You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@hyperreal.org on 1999/12/11 21:24:15 UTC

cvs commit: apache-2.0/src/lib/apr/include apr_file_io.h

rbb         99/12/11 12:24:15

  Modified:    src/lib/apr/file_io/unix open.c
               src/lib/apr/include apr_file_io.h
  Log:
  Add a new function to APR.  Basically, this opens an instance of the
  platform's stderr and puts it into a ap_file_t structure.  I noticed
  that we are ap_put_os_file(STDERR_FILENO...  a couple of places in the
  Apache code.  This should make that much cleaner.  I am not convinced
  it is portable, so it may disappear if it doesn't work, but I am
  hopeful.
  
  Revision  Changes    Path
  1.26      +22 -0     apache-2.0/src/lib/apr/file_io/unix/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/open.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- open.c	1999/12/03 15:18:23	1.25
  +++ open.c	1999/12/11 20:24:13	1.26
  @@ -298,3 +298,25 @@
   
       return APR_SUCCESS;
   }   
  +
  +/* ***APRDOC********************************************************
  + * ap_status_t ap_open_stderr(ap_file_t **, ap_context_t *) 
  + *    open standard error as an apr file pointer.
  + * arg 1) The apr file to use as stderr.
  + * arg 2) The context to allocate the file out of.
  + */
  +ap_status_t ap_open_stderr(struct file_t **thefile, ap_context_t *cont)
  +{
  +    (*thefile) = ap_palloc(cont, sizeof(ap_os_file_t *));
  +    if ((*thefile) == NULL) {
  +        return APR_ENOMEM;
  +    }
  +    (*thefile)->filedes = STDERR_FILENO;
  +    (*thefile)->cntxt = cont;
  +    (*thefile)->filehand = NULL;
  +    (*thefile)->stated = 0;
  +    (*thefile)->buffered = 0;
  +    (*thefile)->eof_hit = 0;
  +
  +    return APR_SUCCESS;
  +}
  
  
  
  1.22      +1 -0      apache-2.0/src/lib/apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_file_io.h,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- apr_file_io.h	1999/12/02 18:36:25	1.21
  +++ apr_file_io.h	1999/12/11 20:24:14	1.22
  @@ -114,6 +114,7 @@
   ap_status_t ap_remove_file(char *, ap_context_t *);
   ap_status_t ap_eof(ap_file_t *);
   ap_status_t ap_ferror(ap_file_t *);
  +ap_status_t ap_open_stderr(ap_file_t **thefile, ap_context_t *cont);
   
   ap_status_t ap_read(ap_file_t *, void *, ap_ssize_t *);
   ap_status_t ap_write(ap_file_t *, void *, ap_ssize_t *);