changeset 6054:769b203ede37

[project @ 2006-10-16 17:53:53 by jwe]
author jwe
date Mon, 16 Oct 2006 17:53:53 +0000
parents a158aa24f8a0
children 060985c633d1
files src/ChangeLog src/oct-stream.cc
diffstat 2 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Oct 16 17:36:33 2006 +0000
+++ b/src/ChangeLog	Mon Oct 16 17:53:53 2006 +0000
@@ -1,3 +1,8 @@
+2006-10-16  John W. Eaton  <jwe@octave.org>
+
+	* oct-stream.cc (octave_stream_list::do_remove): Handle "all" as a
+	special case.
+
 2006-10-13  Michael Goffioul  <michael.goffioul@swing.be>
 
 	* Makefile.in: Adapt rules to use $(LIBPRE).
--- a/src/oct-stream.cc	Mon Oct 16 17:36:33 2006 +0000
+++ b/src/oct-stream.cc	Mon Oct 16 17:53:53 2006 +0000
@@ -4045,10 +4045,27 @@
 {
   int retval = -1;
 
-  int i = get_file_number (fid);
-
-  if (! error_state)
-    retval = do_remove (i, who);
+  if (fid.is_string () && fid.string_value () == "all")
+    {
+      // Skip stdin, stdout, and stderr.
+
+      for (int i = 3; i < curr_len; i++)
+	{
+	  octave_stream os = list(i);
+
+	  if (os.is_valid ())
+	    do_remove (i, who);
+	}
+
+      retval = 0;
+    }
+  else
+    {
+      int i = get_file_number (fid);
+
+      if (! error_state)
+	retval = do_remove (i, who);
+    }
 
   return retval;
 }