apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: apr/include apr_file_io.h
Date Thu, 31 May 2001 00:11:15 GMT
jerenkrantz    01/05/30 17:11:14

  Modified:    .        CHANGES
               file_io/os2 open.c
               file_io/unix open.c
               file_io/win32 open.c
               include  apr_file_io.h
  Log:
  Add apr_file_open_stdin - which allows the stdin file handle to be
  obtained by an APR-based program in a portable fashion.  This completes
  the stdin/stdout/stderr calls.
  
  This is similar to the apr_file_open_std{out,err} calls.
  
  The Win32 and OS/2 folks will have to verify that I got their respective
  implementations right.  I don't have access to their compilers to ensure
  that it is correct.  I blindly coded these up based on the
  apr_file_open_std{out,err} implementations.
  
  Submitted by: Aaron Bannert <abannert@ebuilt.com>
  Reviewed by: Justin Erenkrantz
  
  Revision  Changes    Path
  1.108     +3 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.107
  retrieving revision 1.108
  diff -u -r1.107 -r1.108
  --- CHANGES	2001/05/23 14:15:27	1.107
  +++ CHANGES	2001/05/31 00:11:02	1.108
  @@ -1,5 +1,8 @@
   Changes with APR b1  
   
  +  *) Add apr_open_stdin.  This mirrors apr_open_stderr, except it works
  +     on stdin.  [Aaron Bannert <abannert@ebuilt.com>]
  +
     *) Add apr_strtok(), a thread-safe flavor of strtok() which has the
        same interface as strtok_r().  [Jeff Trawick]
        
  
  
  
  1.41      +7 -0      apr/file_io/os2/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/os2/open.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- open.c	2001/02/16 04:15:35	1.40
  +++ open.c	2001/05/31 00:11:05	1.41
  @@ -261,4 +261,11 @@
   }
   
   
  +apr_status_t apr_file_open_stdin(apr_file_t **thefile, apr_pool_t *cont)
  +{
  +    apr_os_file_t fd = 0;
  +
  +    return apr_os_file_put(thefile, &fd, cont);
  +}
  +
   APR_POOL_IMPLEMENT_ACCESSOR_X(file, cntxt);
  
  
  
  1.75      +7 -0      apr/file_io/unix/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/open.c,v
  retrieving revision 1.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- open.c	2001/03/31 22:58:45	1.74
  +++ open.c	2001/05/31 00:11:07	1.75
  @@ -252,4 +252,11 @@
       return apr_os_file_put(thefile, &fd, cont);
   }
   
  +apr_status_t apr_file_open_stdin(apr_file_t **thefile, apr_pool_t *cont)
  +{
  +    int fd = STDIN_FILENO;
  +
  +    return apr_os_file_put(thefile, &fd, cont);
  +}
  +
   APR_POOL_IMPLEMENT_ACCESSOR_X(file, cntxt);
  
  
  
  1.74      +11 -0     apr/file_io/win32/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/open.c,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- open.c	2001/03/31 22:32:46	1.73
  +++ open.c	2001/05/31 00:11:10	1.74
  @@ -439,4 +439,15 @@
       return apr_os_file_put(thefile, &file_handle, cont);
   }
   
  +APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile, apr_pool_t *cont)
  +{
  +    apr_os_file_t file_handle;
  +
  +    file_handle = GetStdHandle(STD_INPUT_HANDLE);
  +    if (file_handle == INVALID_HANDLE_VALUE)
  +        return apr_get_os_error();
  +
  +    return apr_os_file_put(thefile, &file_handle, cont);
  +}
  +
   APR_POOL_IMPLEMENT_ACCESSOR_X(file, cntxt);
  
  
  
  1.102     +9 -0      apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_file_io.h,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- apr_file_io.h	2001/05/23 14:49:25	1.101
  +++ apr_file_io.h	2001/05/31 00:11:12	1.102
  @@ -204,6 +204,15 @@
                                             apr_pool_t *cont);
   
   /**
  + * open standard input as an apr file pointer.
  + * @param thefile The apr file to use as stdin.
  + * @param cont The pool to allocate the file out of.
  + * @deffunc apr_status_t apr_file_open_stdin(apr_file_t **thefile, apr_pool_t *cont)
  + */
  +APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile,
  +                                              apr_pool_t *cont);
  +
  +/**
    * Read data from the specified file.
    * @param thefile The file descriptor to read from.
    * @param buf The buffer to store the data to.
  
  
  

Mime
View raw message