diff options
author | colm <colm@13f79535-47bb-0310-9956-ffa450edef68> | 2005-10-15 08:22:41 +0000 |
---|---|---|
committer | colm <colm@13f79535-47bb-0310-9956-ffa450edef68> | 2005-10-15 08:22:41 +0000 |
commit | 29a9c91a6b358fb87dfc26194705313d29aef81a (patch) | |
tree | c745d2f42b6e3986351dcdffdd485208803a0012 /file_io/os2 | |
parent | 7996a0c00e316848468a7eddf2400cda7e44d834 (diff) | |
download | libapr-29a9c91a6b358fb87dfc26194705313d29aef81a.tar.gz |
Add apr_file_open_flags_std[err|out|in]() functions, to allow the opening of
the standard file descriptors with specific flags set. As a consequence we now
also set APR_WRITE and APR_READ as appropriate when using the plain old
apr_file_open_std[err|out|in]() functions.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@321314 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/os2')
-rw-r--r-- | file_io/os2/open.c | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/file_io/os2/open.c b/file_io/os2/open.c index 3b9760425..ef3bc06ec 100644 --- a/file_io/os2/open.c +++ b/file_io/os2/open.c @@ -213,28 +213,51 @@ APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr) } -APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile, apr_pool_t *pool) +APR_DECLARE(apr_status_t) apr_file_open_flags_stderr(apr_file_t **thefile, + apr_int32_t flags, + apr_pool_t *pool) { apr_os_file_t fd = 2; - return apr_os_file_put(thefile, &fd, 0, pool); + return apr_os_file_put(thefile, &fd, flags | APR_WRITE, pool); } - -APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile, apr_pool_t *pool) +APR_DECLARE(apr_status_t) apr_file_open_flags_stdout(apr_file_t **thefile, + apr_int32_t flags, + apr_pool_t *pool) { apr_os_file_t fd = 1; - return apr_os_file_put(thefile, &fd, 0, pool); + return apr_os_file_put(thefile, &fd, flags | APR_WRITE, pool); } -APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile, apr_pool_t *pool) +APR_DECLARE(apr_status_t) apr_file_open_flags_stdin(apr_file_t **thefile, + apr_int32_t flags, + apr_pool_t *pool) { apr_os_file_t fd = 0; - return apr_os_file_put(thefile, &fd, 0, pool); + return apr_os_file_put(thefile, &fd, flags | APR_READ, pool); +} + + +APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile, apr_pool_t *pool) +{ + return apr_file_open_flags_stderr(thefile, 0, pool); +} + + +APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile, apr_pool_t *pool) +{ + return apr_file_open_flags_stdout(thefile, 0, pool); +} + + +APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile, apr_pool_t *pool) +{ + return apr_file_open_flags_stdin(thefile, 0, pool); } APR_POOL_IMPLEMENT_ACCESSOR(file); |