diff src/help.cc @ 4051:b79da8779a0e

[project @ 2002-08-17 19:38:32 by jwe]
author jwe
date Sat, 17 Aug 2002 19:38:33 +0000
parents 27e461aed956
children 63a5613cca00
line wrap: on
line diff
--- a/src/help.cc	Sat Aug 17 02:18:18 2002 +0000
+++ b/src/help.cc	Sat Aug 17 19:38:33 2002 +0000
@@ -29,7 +29,6 @@
 
 #include <iostream>
 #include <fstream>
-#include <strstream>
 #include <string>
 
 #ifdef HAVE_UNISTD_H
@@ -41,6 +40,7 @@
 
 #include "cmd-edit.h"
 #include "file-ops.h"
+#include "lo-sstream.h"
 #include "oct-env.h"
 #include "str-vec.h"
 
@@ -507,12 +507,7 @@
 {
   int status = 0;
 
-  static char *cmd_str = 0;
-
-  delete [] cmd_str;
-  cmd_str = 0;
-
-  std::ostrstream cmd_buf;
+  OSSTREAM cmd_buf;
 
   cmd_buf << Vinfo_prog << " --file " << Vinfo_file;
 
@@ -528,14 +523,14 @@
   if (nm.length () > 0)
     cmd_buf << " --index-search " << nm;
 
-  cmd_buf << std::ends;
-
-  cmd_str = cmd_buf.str ();
+  cmd_buf << OSSTREAM_ENDS;
 
   volatile octave_interrupt_handler old_interrupt_handler
     = octave_ignore_interrupts ();
 
-  status = system (cmd_str);
+  status = system (OSSTREAM_C_STR (cmd_buf));
+
+  OSSTREAM_FREEZE (cmd_buf);
 
   octave_set_interrupt_handler (old_interrupt_handler);
 
@@ -616,7 +611,8 @@
       if (cols > 80)
 	cols = 72;
 
-      std::ostrstream buf;
+      OSSTREAM buf;
+
       buf << "sed -e 's/^[#%]+ *//' -e 's/^ *@/@/' | "
 	  << Vmakeinfo_prog
 	  << " -D \"VERSION " << OCTAVE_VERSION << "\""
@@ -629,13 +625,11 @@
 	  << " --force"
 	  << " --output " << tmp_file_name
 	  << " > /dev/null 2>&1"
-	  << std::ends;
-
-      char *cmd = buf.str ();
+	  << OSSTREAM_ENDS;
 
-      oprocstream filter (cmd);
+      oprocstream filter (OSSTREAM_STR (buf));
 
-      delete [] cmd;
+      OSSTREAM_FREEZE (buf);
 
       if (filter && filter.is_open ())
 	{
@@ -898,7 +892,7 @@
 
 	  if (idx < argc)
 	    {
-	      std::ostrstream output_buf;
+	      OSSTREAM output_buf;
 
 	      for (int i = idx; i < argc; i++)
 		{
@@ -915,13 +909,11 @@
 
 	      if (nargout != 0)
 		{
-		  output_buf << std::ends;
-
-		  char *s = output_buf.str ();
+		  output_buf << OSSTREAM_ENDS;
 
-		  retval = s;
+		  retval = OSSTREAM_STR (output_buf);
 
-		  delete [] s;
+		  OSSTREAM_FREEZE (output_buf);
 		}
 	    }
 	  else