1
|
1 // procstream.cc -*- C++ -*- |
|
2 /* |
|
3 |
453
|
4 Copyright (C) 1992, 1993, 1994 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 |
|
25 #include "config.h" |
1
|
26 #endif |
|
27 |
453
|
28 #if defined (__GNUG__) |
|
29 #pragma implementation |
|
30 #endif |
|
31 |
1
|
32 #include "procstream.h" |
|
33 |
|
34 procstreambase::procstreambase (void) |
|
35 { |
|
36 init (new procbuf ()); |
|
37 } |
|
38 |
524
|
39 procstreambase::procstreambase (const char *command, int mode) |
1
|
40 { |
|
41 init (new procbuf ()); |
|
42 if (! rdbuf()->open (command, mode)) |
|
43 set (ios::badbit); |
|
44 } |
|
45 |
|
46 void |
524
|
47 procstreambase::open (const char *command, int mode) |
1
|
48 { |
|
49 clear (); |
|
50 if (! rdbuf()->open (command, mode)) |
|
51 set (ios::badbit); |
|
52 } |
|
53 |
483
|
54 int |
1
|
55 procstreambase::close (void) |
|
56 { |
483
|
57 int status = rdbuf()->sys_close (); |
1
|
58 if (! rdbuf()->close ()) |
|
59 set (ios::failbit); |
483
|
60 return status; |
1
|
61 } |
|
62 |
|
63 /* |
|
64 ;;; Local Variables: *** |
|
65 ;;; mode: C++ *** |
|
66 ;;; page-delimiter: "^/\\*" *** |
|
67 ;;; End: *** |
|
68 */ |