Merge branch 't/cpsi_improvement'
authorAndre Noll <maan@systemlinux.org>
Thu, 10 Jul 2014 17:53:06 +0000 (19:53 +0200)
committerAndre Noll <maan@systemlinux.org>
Thu, 10 Jul 2014 17:54:45 +0000 (19:54 +0200)
Cooking since 2014-05-03.

* t/cpsi_improvement:
  com_cpsi(): Tell the user if nothing was copied.

NEWS
aft.c

diff --git a/NEWS b/NEWS
index 7f41497..f6fca56 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,7 +12,8 @@ NEWS
          serious bugs have been fixed.
        - new audiod command: version.
        - Minor improvements to the bitstream API.
-
+       - The cpsi command now prints a meaningful error message if
+         none of the given patterns matched any audio file.
 
 ----------------------------------------
 0.5.2 (2014-04-11) "orthogonal interior"
diff --git a/aft.c b/aft.c
index 179777b..39f95ad 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -2409,13 +2409,12 @@ static void com_cpsi_callback(int fd, const struct osl_object *query)
 out:
        if (ret < 0)
                para_printf(&cad.pb, "%s\n", para_strerror(-ret));
-       else if (cad.flags & CPSI_FLAG_VERBOSE) {
-               if (pmd.num_matches > 0)
+       else if (pmd.num_matches > 0) {
+               if (cad.flags & CPSI_FLAG_VERBOSE)
                        para_printf(&cad.pb, "copied requested afsi from %s "
                                "to %u files\n", source_path, pmd.num_matches);
-               else
-                       para_printf(&cad.pb, "nothing copied\n");
-       }
+       } else
+               para_printf(&cad.pb, "no matches - nothing copied\n");
        if (cad.pb.offset)
                pass_buffer_as_shm(fd, SBD_OUTPUT, cad.pb.buf, cad.pb.offset);
        free(cad.pb.buf);