]> git.tue.mpg.de Git - paraslash.git/commitdiff
com_touch(): Print a message if no audio files matched.
authorAndre Noll <maan@systemlinux.org>
Sat, 16 Feb 2008 19:25:48 +0000 (20:25 +0100)
committerAndre Noll <maan@systemlinux.org>
Sat, 16 Feb 2008 19:25:48 +0000 (20:25 +0100)
aft.c

diff --git a/aft.c b/aft.c
index 001026db4e956caa8b46256797d29cddced6ddf5..0e3f83e85524b3fea16d64bb612f10a3e9189abd 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -1869,6 +1869,8 @@ struct touch_action_data {
        struct com_touch_options *cto;
        /** Message buffer. */
        struct para_buffer pb;
+       /** How many audio files matched the given pattern. */
+       unsigned num_matches;
 };
 
 static int touch_audio_file(__a_unused struct osl_table *table,
@@ -1911,6 +1913,7 @@ static int touch_audio_file(__a_unused struct osl_table *table,
                if (tad->cto->last_played >= 0)
                        new_afsi.last_played = tad->cto->last_played;
        }
+       tad->num_matches++;
        save_afsi(&new_afsi, &obj); /* in-place update */
        aced.aft_row = row;
        aced.old_afsi = &old_afsi;
@@ -1937,6 +1940,9 @@ static int com_touch_callback(const struct osl_object *query,
        ret = for_each_matching_row(&pmd);
        if (ret < 0)
                para_printf(&tad.pb, "%s\n", para_strerror(-ret));
+       else
+               if (!tad.num_matches)
+                       para_printf(&tad.pb, "no matches\n");
        if (tad.pb.buf) {
                result->data = tad.pb.buf;
                result->size = tad.pb.size;