changeset 30955:cd741166d6fb

maint: merge stable to default.
author Rik <rik@octave.org>
date Thu, 21 Apr 2022 12:04:09 -0700
parents 230724ab2977 (current diff) 0acf9363da34 (diff)
children abca9eac1ec9
files scripts/miscellaneous/dir.m scripts/miscellaneous/ls.m
diffstat 2 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/miscellaneous/dir.m	Thu Apr 21 18:32:33 2022 +0200
+++ b/scripts/miscellaneous/dir.m	Thu Apr 21 12:04:09 2022 -0700
@@ -63,16 +63,16 @@
 ## @var{directory} is subject to shell expansion if it contains any wildcard
 ## characters @samp{*}, @samp{?}, @samp{[]}.  If these wildcard characters are
 ## escaped with a backslash @samp{\} (e.g., @samp{\*}) on a POSIX platform,
-## they aren't treated as wildcards but as the corresponding literal character.
-## On Windows, it is not possible to escape wildcard characters because
-## backslash @samp{\} is treated as a file separator.  On Windows, use
-## @code{ls} instead for file or folder names that contain characters that
-## would be treated as wildcards by @code{dir}.
+## then they are not treated as wildcards, but as the corresponding literal
+## character.  On Windows, it is not possible to escape wildcard characters
+## because backslash @samp{\} is treated as a file separator.  On Windows, use
+## @code{ls} for file or folder names that contain characters that would be
+## treated as wildcards by @code{dir}.
 ##
 ## Note that for symbolic links, @code{dir} returns information about the
-## file that the symbolic link points to rather than the link itself.
-## However, if the link points to a nonexistent file, @code{dir} returns
-## information about the link.
+## file that the symbolic link points to rather than the link itself.  However,
+## if the link points to a nonexistent file, @code{dir} returns information
+## about the link.
 ## @seealso{ls, readdir, glob, what, stat, lstat}
 ## @end deftypefn
 
--- a/scripts/miscellaneous/ls.m	Thu Apr 21 18:32:33 2022 +0200
+++ b/scripts/miscellaneous/ls.m	Thu Apr 21 12:04:09 2022 -0700
@@ -38,8 +38,8 @@
 ##
 ## Filenames are subject to shell expansion if they contain any wildcard
 ## characters @samp{*}, @samp{?}, @samp{[]}.  If these wildcard characters are
-## escaped with a backslash @samp{\} (e.g., @samp{\*}), they aren't treated as
-## wildcards but as the corresponding literal character.
+## escaped with a backslash @samp{\} (e.g., @samp{\*}) then they are not
+## treated as wildcards, but instead as the corresponding literal character.
 ##
 ## If the optional output @var{list} is requested then @code{ls} returns a
 ## character array with one row for each file/directory name.
@@ -73,12 +73,12 @@
       if (strncmp (ls_cmd, "ls", 2))
         ## Replace backslashes with forward slashes (unless they escape a glob
         ## pattern)
-        args = regexprep (args, '\\(?![\*\?\[\]])', '/');
+        args = regexprep (args, '\\(?![*?\[\]])', '/');
         ## Enclose paths, potentially having spaces, in double quotes:
         args = strcat ('"', args, '"');
         ## Exclude glob patterns and escaped characters from quoted part of
         ## FILENAMES string
-        args = regexprep (args, '(?<!\\)([\*\?])', '"$1"');
+        args = regexprep (args, '(?<!\\)([*?])', '"$1"');
         args = regexprep (args, '(?<!\\)\[', '"[');
         args = regexprep (args, '(?<!\\)\[', ']"');
         args = regexprep (args, '(\\.)', '"$1"');