diff src/procstream.cc @ 1965:01e3ed56c415

[project @ 1996-02-17 02:02:50 by jwe]
author jwe
date Sat, 17 Feb 1996 02:03:11 +0000
parents e62277bf5fe0
children 003570e69c7b
line wrap: on
line diff
--- a/src/procstream.cc	Sat Feb 17 00:11:53 1996 +0000
+++ b/src/procstream.cc	Sat Feb 17 02:03:11 1996 +0000
@@ -29,127 +29,41 @@
 #include <config.h>
 #endif
 
-#include <fstream.h>
-#include <procbuf.h>
-
 #include "procstream.h"
 
-iprocstream::iprocstream (const char *command, int mode)
+procstreambase::procstreambase (const char *command, int mode)
 {
-  pbuf = new procbuf ();
+  pb_init ();
 
-  init (pbuf);
-
-  if (! pbuf->open (command, mode))
+  if (! pb.open (command, mode))
     set (ios::badbit);
 }
 
-iprocstream::~iprocstream (void)
-{
-  delete pbuf;
-}
-
 void
-iprocstream::open (const char *command, int mode)
+procstreambase::open (const char *command, int mode)
 {
   clear ();
 
-  if (pbuf)
-    delete pbuf;
-
-  pbuf = new procbuf ();
-
-  init (pbuf);
-
-  if (! pbuf->open (command, mode))
+  if (! pb.open (command, mode))
     set (ios::badbit);
 }
 
 int
-iprocstream::is_open (void)
-{
-  return pbuf && pbuf->is_open ();
-}
-
-int
-iprocstream::close (void)
+procstreambase::close (void)
 {
   int status = 0;
 
   if (is_open ())
     {
-      status = pbuf->sys_close ();
+      status = pb.sys_close ();
 
-      if (! pbuf->close ())
+      if (! pb.close ())
 	set (ios::failbit);
     }
 
   return status;
 }
 
-void
-cleanup_iprocstream (void *buf)
-{
-  delete (iprocstream *) buf;
-}
-
-oprocstream::oprocstream (const char *command, int mode)
-{
-  pbuf = new procbuf ();
-
-  init (pbuf);
-
-  if (! pbuf->open (command, mode))
-    set (ios::badbit);
-}
-
-oprocstream::~oprocstream (void)
-{
-  delete pbuf;
-}
-
-void
-oprocstream::open (const char *command, int mode)
-{
-  clear ();
-
-  if (pbuf)
-    delete pbuf;
-    
-  pbuf = new procbuf ();
-
-  init (pbuf);
-
-  if (! pbuf->open (command, mode))
-    set (ios::badbit);
-}
-
-int
-oprocstream::is_open (void)
-{
-  return pbuf && pbuf->is_open ();
-}
-
-int
-oprocstream::close (void)
-{
-  int status = 0;
-
-  if (is_open ())
-    {
-      if (! pbuf->close ())
-	set (ios::failbit);
-    }
-
-  return status;
-}
-
-void
-cleanup_oprocstream (void *buf)
-{
-  delete (oprocstream *) buf;
-}
-
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***