xref: /plan9/sys/src/cmd/gs/src/pipe_.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1997, 1998, 1999 Aladdin Enterprises.  All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: pipe_.h,v 1.6 2002/09/05 08:34:00 ghostgum Exp $ */
18 /* Declaration of popen and pclose */
19 
20 #ifndef pipe__INCLUDED
21 #  define pipe__INCLUDED
22 
23 #include "stdio_.h"
24 
25 #ifdef __WIN32__
26 /*
27  * MS Windows has popen and pclose in stdio.h, but under different names.
28  * Unfortunately MSVC5 and 6 have a broken implementation of _popen,
29  * so we use own.  Our implementation only supports mode "wb".
30  */
31 extern FILE *mswin_popen(const char *cmd, const char *mode);
32 #  define popen(cmd, mode) mswin_popen(cmd, mode)
33 /* #  define popen(cmd, mode) _popen(cmd, mode) */
34 #  define pclose(file) _pclose(file)
35 #else  /* !__WIN32__ */
36 /*
37  * popen isn't POSIX-standard, so we declare it here.
38  * Because of inconsistent (and sometimes incorrect) header files,
39  * we must omit the argument list.  Unfortunately, this sometimes causes
40  * more trouble than it cures.
41  */
42 extern FILE *popen( /* const char *, const char * */ );
43 extern int pclose(FILE *);
44 #endif /* !__WIN32__ */
45 
46 #endif /* pipe__INCLUDED */
47