com_ls: Print an error message if no file matched.
authorAndre Noll <maan@systemlinux.org>
Tue, 1 Nov 2011 19:05:07 +0000 (20:05 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 6 Nov 2011 11:29:13 +0000 (12:29 +0100)
In case at least one pattern was given and no matches were found,
the ls command returned with no output at all. This makes it print a
"no matches" error message instead.

aft.c

diff --git a/aft.c b/aft.c
index 6ac6a3a..f6d0c4b 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -1364,8 +1364,11 @@ static void com_ls_callback(int fd, const struct osl_object *query)
                        prepare_ls_row));
        if (ret < 0)
                goto out;
-       if (!opts->num_matching_paths)
+       if (opts->num_matching_paths == 0) {
+               if (opts->num_patterns > 0)
+                       para_printf(&b, "no matches\n");
                goto out;
+       }
        ret = sort_matching_paths(opts);
        if (ret < 0)
                goto out;