rbb 01/01/27 09:57:03
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_open_stdout. This mirrors apr_open_stderr, except it works
on stdout.
Submitted by: [EMAIL PROTECTED]
Revision Changes Path
1.46 +3 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -b -w -u -r1.45 -r1.46
--- CHANGES 2001/01/23 16:48:54 1.45
+++ CHANGES 2001/01/27 17:57:02 1.46
@@ -1,5 +1,8 @@
Changes with APR b1
+ *) Add apr_open_stdout. This mirrors apr_open_stderr, except it works
+ on stdout. [EMAIL PROTECTED]
+
*) Fix bug in file_io/unix/dir.c. There is no such thing as a dirent,
it must be a struct dirent.
[Kevin Pilch-Bisson <[EMAIL PROTECTED]>]
1.37 +10 -0 apr/file_io/os2/open.c
Index: open.c
===================================================================
RCS file: /home/cvs/apr/file_io/os2/open.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -b -w -u -r1.36 -r1.37
--- open.c 2001/01/26 09:05:44 1.36
+++ open.c 2001/01/27 17:57:02 1.37
@@ -251,4 +251,14 @@
return apr_put_os_file(thefile, &fd, cont);
}
+
+
+apr_status_t apr_open_stdout(apr_file_t **thefile, apr_pool_t *cont)
+{
+ int fd = 1; /* Is this correct? */
+
+ return apr_put_os_file(thefile, &fd, cont);
+}
+
+
APR_POOL_IMPLEMENT_ACCESSOR_X(file, cntxt);
1.70 +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.69
retrieving revision 1.70
diff -u -d -b -w -u -r1.69 -r1.70
--- open.c 2001/01/26 09:05:48 1.69
+++ open.c 2001/01/27 17:57:02 1.70
@@ -254,4 +254,11 @@
return apr_put_os_file(thefile, &fd, cont);
}
+apr_status_t apr_open_stdout(apr_file_t **thefile, apr_pool_t *cont)
+{
+ int fd = STDOUT_FILENO;
+
+ return apr_put_os_file(thefile, &fd, cont);
+}
+
APR_POOL_IMPLEMENT_ACCESSOR_X(file, cntxt);
1.68 +15 -14 apr/file_io/win32/open.c
Index: open.c
===================================================================
RCS file: /home/cvs/apr/file_io/win32/open.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -d -b -w -u -r1.67 -r1.68
--- open.c 2001/01/26 09:05:55 1.67
+++ open.c 2001/01/27 17:57:02 1.68
@@ -417,23 +417,24 @@
APR_DECLARE(apr_status_t) apr_open_stderr(apr_file_t **thefile, apr_pool_t
*cont)
{
- /* ### should this be rebuilt in terms of apr_put_os_file()?? their
- ### initializations are slightly different (maybe one or both are
- ### not init'ing properly?)
- */
+ apr_os_file_t file_handle;
- (*thefile) = apr_pcalloc(cont, sizeof(apr_file_t));
- if ((*thefile) == NULL) {
- return APR_ENOMEM;
+ file_handle = GetStdHandle(STD_ERROR_HANDLE);
+ if (file_handle == INVALID_HANDLE_VALUE)
+ return apr_get_os_error();
+
+ return apr_put_os_file(thefile, &file_handle, cont);
}
- (*thefile)->filehand = GetStdHandle(STD_ERROR_HANDLE);
- if ((*thefile)->filehand == INVALID_HANDLE_VALUE)
+
+APR_DECLARE(apr_status_t) apr_open_stdout(apr_file_t **thefile, apr_pool_t
*cont)
+{
+ apr_os_file_t file_handle;
+
+ file_handle = GetStdHandle(STD_OUTPUT_HANDLE);
+ if (file_handle == INVALID_HANDLE_VALUE)
return apr_get_os_error();
- (*thefile)->cntxt = cont;
- (*thefile)->fname = "\0"; // What was this??? : "STD_ERROR_HANDLE"; */
- (*thefile)->eof_hit = 0;
- return APR_SUCCESS;
+ return apr_put_os_file(thefile, &file_handle, cont);
}
APR_POOL_IMPLEMENT_ACCESSOR_X(file, cntxt);
1.93 +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.92
retrieving revision 1.93
diff -u -d -b -w -u -r1.92 -r1.93
--- apr_file_io.h 2001/01/24 08:26:19 1.92
+++ apr_file_io.h 2001/01/27 17:57:03 1.93
@@ -200,6 +200,15 @@
apr_pool_t *cont);
/**
+ * open standard output as an apr file pointer.
+ * @param thefile The apr file to use as stdout.
+ * @param cont The pool to allocate the file out of.
+ * @deffunc apr_status_t apr_open_stdout(apr_file_t **thefile, apr_pool_t
*cont)
+ */
+APR_DECLARE(apr_status_t) apr_open_stdout(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.