2094
|
1 /* |
|
2 |
|
3 Copyright (C) 1996 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 // This class is based on the procbuf class from libg++, written by |
|
24 // Per Bothner, Copyright (C) 1993 Free Software Foundation. |
|
25 |
|
26 #if !defined (octave_octave_procbuf_h) |
|
27 #define octave_octave_procbuf_h 1 |
|
28 |
|
29 #include <streambuf.h> |
|
30 |
|
31 #ifdef HAVE_SYS_TYPES_H |
|
32 #include <sys/types.h> |
|
33 #endif |
|
34 |
|
35 class |
|
36 octave_procbuf : public filebuf |
|
37 { |
|
38 public: |
|
39 |
|
40 octave_procbuf (void) |
|
41 : filebuf (), proc_pid (-1), next (0) { } |
|
42 |
|
43 octave_procbuf (const char *command, int mode) |
|
44 : filebuf (), proc_pid (-1), next (0) { open (command, mode); } |
|
45 |
|
46 ~octave_procbuf (void) { close (); } |
|
47 |
|
48 octave_procbuf *open (const char *command, int mode); |
|
49 |
|
50 octave_procbuf *close (void) |
|
51 { return (octave_procbuf *) filebuf::close (); } |
|
52 |
|
53 virtual int sys_close (void); |
|
54 |
|
55 pid_t pid (void) { return proc_pid; } |
|
56 |
|
57 protected: |
|
58 |
|
59 pid_t proc_pid; |
|
60 |
|
61 octave_procbuf *next; |
|
62 }; |
|
63 |
|
64 #endif |
|
65 |
|
66 /* |
|
67 ;;; Local Variables: *** |
|
68 ;;; mode: C++ *** |
|
69 ;;; End: *** |
|
70 */ |