apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Bannert <aa...@ebuilt.com>
Subject [PATCH] apr_file_open_stdin() support?
Date Tue, 15 May 2001 21:36:10 GMT
I noticed that there's no support for stdin in the apr_file_open_*()
functions. Is there any reason for this? I've attached an implementation
for UNIX.

-aaron


Index: include/apr_file_io.h
===================================================================
RCS file: /home/cvspublic/apr/include/apr_file_io.h,v
retrieving revision 1.100
diff -u -r1.100 apr_file_io.h
--- include/apr_file_io.h	2001/05/07 18:04:06	1.100
+++ include/apr_file_io.h	2001/05/15 21:15:30
@@ -186,6 +186,15 @@
 APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr);
 
 /**
+ * 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);
+
+/**
  * open standard error as an apr file pointer.
  * @param thefile The apr file to use as stderr.
  * @param cont The pool to allocate the file out of.


Index: file_io/unix/open.c
===================================================================
RCS file: /home/cvspublic/apr/file_io/unix/open.c,v
retrieving revision 1.74
diff -u -r1.74 open.c
--- file_io/unix/open.c	2001/03/31 22:58:45	1.74
+++ file_io/unix/open.c	2001/05/15 21:15:41
@@ -238,6 +238,13 @@
     return APR_SUCCESS;
 }   
 
+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_status_t apr_file_open_stderr(apr_file_t **thefile, apr_pool_t *cont)
 {
     int fd = STDERR_FILENO;



Mime
View raw message