From 0c0a26586f34b6621f17cbd2c3d7b0cdfe6bcffb Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 16 Feb 2008 20:25:48 +0100 Subject: [PATCH] com_touch(): Print a message if no audio files matched. --- aft.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/aft.c b/aft.c index 001026db..0e3f83e8 100644 --- 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; -- 2.39.5