# HG changeset patch # User Rik # Date 1650567821 25200 # Node ID 0acf9363da34669c1a17f8bc9baf18f1ed9d889d # Parent c09fdabaa5b6f79922d9b1c25dc8370be0ca2b52 doc: tweak docstrings for ls, dir (bug #62282). * dir.m: Tweak docstring. * ls.m: Tweak docstring. Don't use unnecessary backslashes in regexp for wildcards that are within a character class ([...]). diff -r c09fdabaa5b6 -r 0acf9363da34 scripts/miscellaneous/dir.m --- a/scripts/miscellaneous/dir.m Thu Apr 21 18:31:33 2022 +0200 +++ b/scripts/miscellaneous/dir.m Thu Apr 21 12:03:41 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 diff -r c09fdabaa5b6 -r 0acf9363da34 scripts/miscellaneous/ls.m --- a/scripts/miscellaneous/ls.m Thu Apr 21 18:31:33 2022 +0200 +++ b/scripts/miscellaneous/ls.m Thu Apr 21 12:03:41 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, '(?