changeset 6943:f6d78960f674

[project @ 2007-10-02 15:22:30 by dbateman]
author dbateman
date Tue, 02 Oct 2007 15:22:30 +0000
parents fbf2e8b95a18
children 96714c92a278
files scripts/ChangeLog scripts/miscellaneous/ls.m
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Mon Oct 01 19:26:41 2007 +0000
+++ b/scripts/ChangeLog	Tue Oct 02 15:22:30 2007 +0000
@@ -1,3 +1,8 @@
+2007-10-02  David Bateman  <dbateman@free.fr>
+
+	* miscellaneous/ls.m: If nargout return string array of files
+	returned by ls.
+
 2007-10-01  John W. Eaton  <jwe@octave.org>
 
 	* plot/__go_draw_axes__.m: Use %.15e instead of %.15g when setting
--- a/scripts/miscellaneous/ls.m	Mon Oct 01 19:26:41 2007 +0000
+++ b/scripts/miscellaneous/ls.m	Tue Oct 02 15:22:30 2007 +0000
@@ -53,12 +53,16 @@
 
     cmd = sprintf ("%s ", __ls_command__, args{:});
 
-    if (page_screen_output ())
+    if (page_screen_output () || nargout > 0)
 
       [status, output] = system (cmd);
 
       if (status == 0)
-	puts (output);
+	if (nargout == 0)
+	  puts (output);
+	else
+	  retval = strvcat (regexp (output, '[^\s]+', 'match'){:});
+	endif
       else
 	error ("ls: command exited abnormally with status %d", status);
       endif