1
|
1 /* |
|
2 |
1884
|
3 Copyright (C) 1996 John W. Eaton |
1
|
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 |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1
|
20 |
|
21 */ |
|
22 |
1297
|
23 #if defined (__GNUG__) |
|
24 #pragma implementation |
|
25 #endif |
|
26 |
240
|
27 #ifdef HAVE_CONFIG_H |
1192
|
28 #include <config.h> |
1
|
29 #endif |
|
30 |
|
31 #include "procstream.h" |
|
32 |
1965
|
33 procstreambase::procstreambase (const char *command, int mode) |
1
|
34 { |
1965
|
35 pb_init (); |
1380
|
36 |
1965
|
37 if (! pb.open (command, mode)) |
1
|
38 set (ios::badbit); |
|
39 } |
|
40 |
|
41 void |
1965
|
42 procstreambase::open (const char *command, int mode) |
1
|
43 { |
|
44 clear (); |
1380
|
45 |
1965
|
46 if (! pb.open (command, mode)) |
1
|
47 set (ios::badbit); |
|
48 } |
|
49 |
483
|
50 int |
1965
|
51 procstreambase::close (void) |
1380
|
52 { |
|
53 int status = 0; |
|
54 |
|
55 if (is_open ()) |
|
56 { |
1965
|
57 status = pb.sys_close (); |
1380
|
58 |
1965
|
59 if (! pb.close ()) |
1380
|
60 set (ios::failbit); |
|
61 } |
|
62 |
|
63 return status; |
|
64 } |
|
65 |
1
|
66 /* |
|
67 ;;; Local Variables: *** |
|
68 ;;; mode: C++ *** |
|
69 ;;; End: *** |
|
70 */ |