From: Andre Noll Date: Sat, 16 Feb 2008 19:25:48 +0000 (+0100) Subject: com_touch(): Print a message if no audio files matched. X-Git-Tag: v0.3.1~13 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=0c0a26586f34b6621f17cbd2c3d7b0cdfe6bcffb;p=paraslash.git com_touch(): Print a message if no audio files matched. --- 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;