1 #ifndef	pipefds_h
2 #define	pipefds_h
3 
4 static const char pipefds_h_rcsid[]="$Id: pipefds.h,v 1.2 1999/03/31 07:30:03 mrsam Exp $";
5 
6 /////////////////////////////////////////////////////////////////////////
7 //
8 //  Convenience class - automatically destroy pair of pipe handles.
9 //
10 /////////////////////////////////////////////////////////////////////////
11 
12 #include	"config.h"
13 #include	<stdlib.h>
14 #if	HAVE_UNISTD_H
15 #include	<unistd.h>
16 #endif
17 
18 class PipeFds {
19 public:
20 	int fds[2];
21 
PipeFds()22 	PipeFds() { fds[0]= -1; fds[1]= -1; }
23 	int Pipe();
close0()24 	void close0()
25 		{
26 			if (fds[0] >= 0)	close(fds[0]);
27 			fds[0]= -1;
28 		}
close1()29 	void close1()
30 		{
31 			if (fds[1] >= 0)	close(fds[1]);
32 			fds[1]= -1;
33 		}
34 	~PipeFds();
35 } ;
36 #endif
37