This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: Problem with popen/pclose
- To: libc-hacker@cygnus.com
- Subject: Re: Problem with popen/pclose
- From: Ulrich Drepper <drepper@cygnus.com>
- Date: 27 Oct 1998 10:59:26 -0800
- References: <m0zYEGO-0000V6C@sea.lucon.org>
- Reply-To: drepper@cygnus.com (Ulrich Drepper)
hjl@lucon.org (H.J. Lu) writes:
> But it doesn't want to see popen/pclose. Can we do
>
> #if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE == 2 || \
> defined _XOPEN_SOURCE
> # define __USE_POSIX2 1
> #endif
No, this does not make sense. Then any program which wants a modern
POSIX environment and sets _POSIX_C_SOURCE to 199506L looses all
POSIX.2 funcationality.
It must simply be accepted that the standards kind of contradict each
other here. The >= 2 is necessary and I'm a revision of POSIX.2 will
establish this.
> #if defined __USE_UNIX98 || defined __USE_SVID || \
> defined __USE_BSD || defined __USE_MISC
> /* Create a new stream connected to a pipe running the given command. */
> extern FILE *popen __P ((__const char *__command, __const char *__modes));
>
> /* Close a stream opened by popen and return the status of its child. */
> extern int pclose __P ((FILE *__stream));
> #endif
This is also wrong since popen is a POSIX.2 function.
There is no way out.
--
---------------. drepper at gnu.org ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com `------------------------