1
|
1 // procstream.cc -*- C++ -*- |
|
2 /* |
|
3 |
1009
|
4 Copyright (C) 1992, 1993, 1994, 1995 John W. Eaton |
1
|
5 |
|
6 This file is part of Octave. |
|
7 |
|
8 Octave is free software; you can redistribute it and/or modify it |
|
9 under the terms of the GNU General Public License as published by the |
|
10 Free Software Foundation; either version 2, or (at your option) any |
|
11 later version. |
|
12 |
|
13 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
16 for more details. |
|
17 |
|
18 You should have received a copy of the GNU General Public License |
|
19 along with Octave; see the file COPYING. If not, write to the Free |
|
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
21 |
|
22 */ |
|
23 |
240
|
24 #ifdef HAVE_CONFIG_H |
1192
|
25 #include <config.h> |
1
|
26 #endif |
|
27 |
|
28 #include "procstream.h" |
|
29 |
|
30 procstreambase::procstreambase (void) |
|
31 { |
|
32 init (new procbuf ()); |
|
33 } |
|
34 |
524
|
35 procstreambase::procstreambase (const char *command, int mode) |
1
|
36 { |
|
37 init (new procbuf ()); |
|
38 if (! rdbuf()->open (command, mode)) |
|
39 set (ios::badbit); |
|
40 } |
|
41 |
|
42 void |
524
|
43 procstreambase::open (const char *command, int mode) |
1
|
44 { |
|
45 clear (); |
|
46 if (! rdbuf()->open (command, mode)) |
|
47 set (ios::badbit); |
|
48 } |
|
49 |
483
|
50 int |
1
|
51 procstreambase::close (void) |
|
52 { |
483
|
53 int status = rdbuf()->sys_close (); |
1
|
54 if (! rdbuf()->close ()) |
|
55 set (ios::failbit); |
483
|
56 return status; |
1
|
57 } |
|
58 |
|
59 /* |
|
60 ;;; Local Variables: *** |
|
61 ;;; mode: C++ *** |
|
62 ;;; page-delimiter: "^/\\*" *** |
|
63 ;;; End: *** |
|
64 */ |