[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: stdout?

From: Greg Stein <gstein_at_lyra.org>
Date: 2001-01-26 08:03:07 CET

On Thu, Jan 25, 2001 at 11:48:20PM -0600, Ben Collins-Sussman wrote:
>
> Hey Greg S. --
>
> I notice that in log.c, the function run_cmd_in_directory() takes some
> apr_file_t's to "hook up" to the child process -- one for input,
> output, and error.
>
> If I want to call this function and make the child process print to
> plain old stdout, what's the proper procedure? If I pass all NULLs
> for the apr_file_t arguments, nothing is printed to stdout. If I try
> to do an apr_open (&outhandle, stdout, APR_WRITE, APR_OS_DEFAULT,
> pool), and then pass *that* handle to run_cmd_in_directory(), I get a
> generic apr error "no such file".
>
> What am I missing here?

#include <unistd.h>
#include <apr_portable.h>

{
    apr_file_t *file = NULL; /* ### grumble. NULL needed... */
    
    status = apr_put_os_file(&file, STDOUT_FILENO, pool);
    return file;
}

There ya go! :-)

The put_os thing is os-specific, so it isn't portable.

[ and no, don't ask me why apr_portable is the non-portable crap. ]

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
Received on Sat Oct 21 14:36:20 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.