changeset 4611:895297e46ee3

Cure some 'repetitive code syndromes' from audtool.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 05 Jun 2008 01:25:22 +0300
parents c9b0da38d07d
children 8a7752f1c662
files src/audtool/audtool.h src/audtool/audtool_handlers_equalizer.c src/audtool/audtool_handlers_general.c src/audtool/audtool_handlers_playback.c src/audtool/audtool_handlers_playlist.c src/audtool/audtool_handlers_playqueue.c src/audtool/audtool_handlers_vitals.c src/audtool/audtool_report.c
diffstat 8 files changed, 100 insertions(+), 268 deletions(-) [+]
line wrap: on
line diff
--- a/src/audtool/audtool.h	Thu Jun 05 01:05:36 2008 +0300
+++ b/src/audtool/audtool.h	Thu Jun 05 01:25:22 2008 +0300
@@ -49,6 +49,7 @@
 
 extern void audtool_report(const gchar *str, ...);
 extern void audtool_whine(const gchar *str, ...);
+extern void audtool_whine_args(const gchar *name, const gchar *str, ...);
 
 extern void get_handlers_list(gint, gchar **);
 extern void get_current_song(gint, gchar **);
@@ -136,4 +137,6 @@
 extern void equalizer_active(gint argc, gchar **argv);
 extern void equalizer_show(gint, gchar **);
 
+extern gint check_args_playlist_pos(gint argc, gchar **argv);
+
 #endif
--- a/src/audtool/audtool_handlers_equalizer.c	Thu Jun 05 01:05:36 2008 +0300
+++ b/src/audtool/audtool_handlers_equalizer.c	Thu Jun 05 01:25:22 2008 +0300
@@ -64,16 +64,19 @@
 
     if (argc < 2)
     {
-        audtool_whine("invalid parameters for %s.", argv[0]);
-        audtool_whine("syntax: %s <band>", argv[0]);
+        audtool_whine_args(argv[0], "<band>");
         exit(1);
     }
 
     band = atoi(argv[1]);
 
+    /* FIXME, XXX, TODO: we should have a function for requesting
+     * the actual number of bands, if we support dynamic amount some day ...
+     * -- ccr
+     */
     if (band < 0 || band > 9)
     {
-        audtool_whine("band number out of range");
+        audtool_whine("band number out of range\n");
         exit(1);
     }
     
@@ -89,8 +92,7 @@
 
     if (argc < 12)
     {
-        audtool_whine("invalid parameters for %s.", argv[0]);
-        audtool_whine("syntax: %s <preamp> <band0> <band1> <band2> <band3> <band4> <band5> <band6> <band7> <band8> <band9>", argv[0]);
+        audtool_whine_args(argv[0], "<preamp> <band0> <band1> <band2> <band3> <band4> <band5> <band6> <band7> <band8> <band9>");
         exit(1);
     }
 
@@ -110,8 +112,7 @@
 
     if (argc < 2)
     {
-        audtool_whine("invalid parameters for %s.", argv[0]);
-        audtool_whine("syntax: %s <preamp>", argv[0]);
+        audtool_whine_args(argv[0], "<preamp>");
         exit(1);
     }
 
@@ -127,8 +128,7 @@
 
     if (argc < 3)
     {
-        audtool_whine("invalid parameters for %s.", argv[0]);
-        audtool_whine("syntax: %s <band> <value>", argv[0]);
+        audtool_whine_args(argv[0], "<band> <value>");
         exit(1);
     }
 
@@ -142,17 +142,14 @@
 {
     if (argc < 2)
     {
-        audtool_whine("invalid parameters for %s.", argv[0]);
-        audtool_whine("syntax: %s <on/off>", argv[0]);
+        audtool_whine_args(argv[0], "<on/off>");
         exit(1);
     }
 
     if (!g_ascii_strcasecmp(argv[1], "on")) {
         audacious_remote_eq_activate(dbus_proxy, TRUE);
-        return;
     }
     else if (!g_ascii_strcasecmp(argv[1], "off")) {
         audacious_remote_eq_activate(dbus_proxy, FALSE);
-        return;
     }
 }
--- a/src/audtool/audtool_handlers_general.c	Thu Jun 05 01:05:36 2008 +0300
+++ b/src/audtool/audtool_handlers_general.c	Thu Jun 05 01:25:22 2008 +0300
@@ -52,8 +52,7 @@
 
 	if (argc < 2)
 	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <level>", argv[0]);
+		audtool_whine_args(argv[0], "<level>", argv[0]);
 		exit(1);
 	}
 
@@ -75,8 +74,7 @@
 void mainwin_show(gint argc, gchar **argv)
 {
 	if (argc < 2) {
-        audtool_whine("invalid parameter for %s.", argv[0]);
-        audtool_whine("syntax: %s <on/off>", argv[0]);
+        audtool_whine_args(argv[0], "<on/off>");
         exit(1);
     }
 
@@ -93,8 +91,7 @@
 void playlist_show(gint argc, gchar **argv)
 {
 	if (argc < 2) {
-        audtool_whine("invalid parameter for %s.", argv[0]);
-        audtool_whine("syntax: %s <on/off>", argv[0]);
+        audtool_whine_args(argv[0], "<on/off>");
         exit(1);
     }
 
@@ -111,8 +108,7 @@
 void equalizer_show(gint argc, gchar **argv)
 {
 	if (argc < 2) {
-        audtool_whine("invalid parameter for %s.", argv[0]);
-        audtool_whine("syntax: %s <on/off>", argv[0]);
+        audtool_whine_args(argv[0], "<on/off>");
         exit(1);
     }
 
@@ -132,8 +128,7 @@
 
 	if (argc < 2) {
 #if 0
-        audtool_whine("invalid parameter for %s.", argv[0]);
-        audtool_whine("syntax: %s <on/off>", argv[0]);
+        audtool_whine_args(argv[0], "<on/off>");
         exit(1);
 #else
         audacious_remote_toggle_prefs_box(dbus_proxy, show);
@@ -146,8 +141,7 @@
     else if (!g_ascii_strcasecmp(argv[1], "off"))
         show = FALSE;
     else {
-        audtool_whine("invalid parameter for %s.", argv[0]);
-        audtool_whine("syntax: %s <on/off>", argv[0]);
+        audtool_whine_args(argv[0], "<on/off>");
         exit (1);
     }
 
@@ -160,8 +154,7 @@
 
 	if (argc < 2) {
 #if 0
-        audtool_whine("invalid parameter for %s.", argv[0]);
-        audtool_whine("syntax: %s <on/off>", argv[0]);
+        audtool_whine_args(argv[0], "<on/off>");
         exit(1);
 #else
         audacious_remote_toggle_about_box(dbus_proxy, show);
@@ -174,8 +167,7 @@
     else if (!g_ascii_strcasecmp(argv[1], "off"))
         show = FALSE;
     else {
-        audtool_whine("invalid parameter for %s.", argv[0]);
-        audtool_whine("syntax: %s <on/off>", argv[0]);
+        audtool_whine_args(argv[0], "<on/off>");
         exit (1);
     }
 
@@ -188,8 +180,7 @@
 
 	if (argc < 2) {
 #if 0
-        audtool_whine("invalid parameter for %s.", argv[0]);
-        audtool_whine("syntax: %s <on/off>", argv[0]);
+        audtool_whine_args(argv[0], "<on/off>");
         exit(1);
 #else
         audacious_remote_toggle_jtf_box(dbus_proxy, show);
@@ -201,8 +192,7 @@
     else if (!g_ascii_strcasecmp(argv[1], "off"))
         show = FALSE;
     else {
-        audtool_whine("invalid parameter for %s.", argv[0]);
-        audtool_whine("syntax: %s <on/off>", argv[0]);
+        audtool_whine_args(argv[0], "<on/off>");
         exit (1);
     }
 
@@ -215,8 +205,7 @@
 
 	if (argc < 2) {
 #if 0
-        audtool_whine("invalid parameter for %s.", argv[0]);
-        audtool_whine("syntax: %s <on/off>", argv[0]);
+        audtool_whine_args(argv[0], "<on/off>");
         exit(1);
 #else
         audacious_remote_toggle_filebrowser(dbus_proxy, show);
@@ -229,8 +218,7 @@
     else if (!g_ascii_strcasecmp(argv[1], "off"))
         show = FALSE;
     else {
-        audtool_whine("invalid parameter for %s.", argv[0]);
-        audtool_whine("syntax: %s <on/off>", argv[0]);
+        audtool_whine_args(argv[0], "<on/off>");
         exit (1);
     }
 
@@ -268,8 +256,7 @@
 {
     if (argc < 2)
     {
-        audtool_whine("invalid parameters for %s.", argv[0]);
-        audtool_whine("syntax: %s <on/off>", argv[0]);
+        audtool_whine_args(argv[0], "<on/off>");
         exit(1);
     }
 
@@ -295,8 +282,7 @@
 {
     if (argc < 2)
     {
-        audtool_whine("invalid parameters for %s.", argv[0]);
-        audtool_whine("syntax: %s <skin>", argv[0]);
+        audtool_whine_args(argv[0], "<skin>");
         exit(1);
     }
 
--- a/src/audtool/audtool_handlers_playback.c	Thu Jun 05 01:05:36 2008 +0300
+++ b/src/audtool/audtool_handlers_playback.c	Thu Jun 05 01:25:22 2008 +0300
@@ -116,8 +116,7 @@
 {
 	if (argc < 2)
 	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <position>", argv[0]);
+		audtool_whine_args(argv[0], "<position>");
 		exit(1);
 	}
 
@@ -130,8 +129,7 @@
 
 	if (argc < 2)
 	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <position>", argv[0]);
+		audtool_whine_args(argv[0], "<position>");
 		exit(1);
 	}
 
--- a/src/audtool/audtool_handlers_playlist.c	Thu Jun 05 01:05:36 2008 +0300
+++ b/src/audtool/audtool_handlers_playlist.c	Thu Jun 05 01:25:22 2008 +0300
@@ -47,8 +47,30 @@
 	audacious_remote_playlist_next(dbus_proxy);
 }
 
-static gchar *
-construct_uri(gchar *string)
+
+gint check_args_playlist_pos(gint argc, gchar **argv)
+{
+	gint playpos;
+
+	if (argc < 2)
+	{
+		audtool_whine_args(argv[0], "<position>");
+		exit(1);
+	}
+
+	playpos = atoi(argv[1]);
+
+	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy))
+	{
+		audtool_whine("invalid playlist position %d ('%s')\n", playpos, argv[1]);
+		exit(2);
+	}
+	
+	return playpos;
+}
+
+
+static gchar * construct_uri(gchar *string)
 {
     gchar *filename = g_strdup(string);
     gchar *tmp, *path;
@@ -81,8 +103,7 @@
 
 	if (argc < 2)
 	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <url>", argv[0]);
+		audtool_whine_args(argv[0], "<url>");
 		exit(1);
 	}
 
@@ -95,23 +116,7 @@
 
 void playlist_delete(gint argc, gchar **argv)
 {
-	gint playpos;
-
-	if (argc < 2)
-	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <position>", argv[0]);
-		exit(1);
-	}
-
-	playpos = atoi(argv[1]);
-
-	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy))
-	{
-		audtool_whine("invalid playlist position %d", playpos);
-		return;
-	}
-
+    gint playpos = check_args_playlist_pos(argc, argv);
 	audacious_remote_playlist_delete(dbus_proxy, playpos - 1);
 }
 
@@ -126,48 +131,18 @@
 
 void playlist_song(gint argc, gchar **argv)
 {
-	gint playpos;
+    gint playpos = check_args_playlist_pos(argc, argv);
 	gchar *song;
 
-	if (argc < 2)
-	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <position>", argv[0]);
-		exit(1);
-	}
-
-	playpos = atoi(argv[1]);
-
-	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy))
-	{
-		audtool_whine("invalid playlist position %d", playpos);
-		exit(1);
-	}
-
 	song = audacious_remote_get_playlist_title(dbus_proxy, playpos - 1);
-
 	audtool_report("%s", song);
 }
 
 
 void playlist_song_length(gint argc, gchar **argv)
 {
-	gint playpos, frames, length;
-
-	if (argc < 2)
-	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <position>", argv[0]);
-		exit(1);
-	}
-
-	playpos = atoi(argv[1]);
-
-	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy))
-	{
-		audtool_whine("invalid playlist position %d", playpos);
-		exit(1);
-	}
+    gint playpos = check_args_playlist_pos(argc, argv);
+	gint frames, length;
 
 	frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1);
 	length = frames / 1000;
@@ -177,22 +152,8 @@
 
 void playlist_song_length_seconds(gint argc, gchar **argv)
 {
-	gint playpos, frames, length;
-
-	if (argc < 2)
-	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <position>", argv[0]);
-		exit(1);
-	}
-
-	playpos = atoi(argv[1]);
-
-	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy))
-	{
-		audtool_whine("invalid playlist position %d", playpos);
-		exit(1);
-	}
+    gint playpos = check_args_playlist_pos(argc, argv);
+	gint frames, length;
 
 	frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1);
 	length = frames / 1000;
@@ -202,22 +163,8 @@
 
 void playlist_song_length_frames(gint argc, gchar **argv)
 {
-	gint playpos, frames;
-
-	if (argc < 2)
-	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <position>", argv[0]);
-		exit(1);
-	}
-
-	playpos = atoi(argv[1]);
-
-	if (playpos < 1 || playpos > audacious_remote_get_playlist_length(dbus_proxy))
-	{
-		audtool_whine("invalid playlist position %d", playpos);
-		exit(1);
-	}
+    gint playpos = check_args_playlist_pos(argc, argv);
+	gint frames;
 
 	frames = audacious_remote_get_playlist_time(dbus_proxy, playpos - 1);
 
@@ -283,46 +230,16 @@
 
 void playlist_song_filename(gint argc, gchar **argv)
 {
-	gint i;
-
-	if (argc < 2)
-	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <position>", argv[0]);
-		exit(1);
-	}
+    gint playpos = check_args_playlist_pos(argc, argv);
 
-	i = atoi(argv[1]);
-
-	if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
-	{
-		audtool_whine("invalid playlist position %d", i);
-		exit(1);
-	}
-
-	audtool_report("%s", audacious_remote_get_playlist_file(dbus_proxy, i - 1));
+	audtool_report("%s", audacious_remote_get_playlist_file(dbus_proxy, playpos - 1));
 }
 
 void playlist_jump(gint argc, gchar **argv)
 {
-	gint i;
-
-	if (argc < 2)
-	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <position>", argv[0]);
-		exit(1);
-	}
+    gint playpos = check_args_playlist_pos(argc, argv);
 
-	i = atoi(argv[1]);
-
-	if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
-	{
-		audtool_whine("invalid playlist position %d", i);
-		exit(1);
-	}
-
-	audacious_remote_set_playlist_pos(dbus_proxy, i - 1);
+	audacious_remote_set_playlist_pos(dbus_proxy, playpos - 1);
 }
 
 void playlist_clear(gint argc, gchar **argv)
@@ -336,12 +253,10 @@
 	if (audacious_remote_is_repeat(dbus_proxy))
 	{
 		audtool_report("on");
-		return;
 	}
 	else
 	{
 		audtool_report("off");
-		return;
 	}
 }
 
@@ -355,12 +270,10 @@
 	if (audacious_remote_is_shuffle(dbus_proxy))
 	{
 		audtool_report("on");
-		return;
 	}
 	else
 	{
 		audtool_report("off");
-		return;
 	}
 }
 
@@ -371,17 +284,16 @@
 
 void playlist_tuple_field_data(gint argc, gchar **argv)
 {
-	gint i;
+    gint i;
 	gchar *data;
 
 	if (argc < 3)
 	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <fieldname> <position>", argv[0]);
-		audtool_whine("  - fieldname example choices include but are not limited to:");
-		audtool_whine("      artist, album, title, track-number, year, date,");
-		audtool_whine("      genre, comment, file-name, file-ext, file-path,");
-		audtool_whine("      length, formatter, custom, mtime");
+		audtool_whine_args(argv[0], "<fieldname> <position>");
+		audtool_whine("  - fieldname example choices include but are not limited to:\n");
+		audtool_whine("      artist, album, title, track-number, year, date,\n");
+		audtool_whine("      genre, comment, file-name, file-ext, file-path,\n");
+		audtool_whine("      length, formatter, custom, mtime\n");
 		exit(1);
 	}
 
@@ -389,7 +301,7 @@
 
 	if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
 	{
-		audtool_whine("invalid playlist position %d", i);
+		audtool_whine("invalid playlist position %d\n", i);
 		exit(1);
 	}
 
@@ -410,8 +322,7 @@
 
     if (argc < 3)
     {
-        audtool_whine("invalid parameters for %s.", argv[0]);
-        audtool_whine("syntax: %s <url> <position>", argv[0]);
+        audtool_whine_args(argv[0], "<url> <position>");
         exit(1);
     }
 
@@ -431,8 +342,7 @@
 
     if (argc < 2)
     {
-        audtool_whine("invalid parameters for %s.", argv[0]);
-        audtool_whine("syntax: %s <url>", argv[0]);
+        audtool_whine_args(argv[0], "<url>");
         exit(1);
     }
 
--- a/src/audtool/audtool_handlers_playqueue.c	Thu Jun 05 01:05:36 2008 +0300
+++ b/src/audtool/audtool_handlers_playqueue.c	Thu Jun 05 01:25:22 2008 +0300
@@ -39,22 +39,7 @@
 
 void playqueue_add(gint argc, gchar **argv)
 {
-	gint i;
-
-	if (argc < 2)
-	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <position>", argv[0]);
-		exit(1);
-	}
-
-	i = atoi(argv[1]);
-
-	if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
-	{
-		audtool_whine("invalid playlist position %d", i);
-		exit(1);
-	}
+	gint i = check_args_playlist_pos(argc, argv);
 
 	if (!(audacious_remote_playqueue_is_queued(dbus_proxy, i - 1)))
 		audacious_remote_playqueue_add(dbus_proxy, i - 1);
@@ -62,22 +47,7 @@
 
 void playqueue_remove(gint argc, gchar **argv)
 {
-	gint i;
-
-	if (argc < 2)
-	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <position>", argv[0]);
-		exit(1);
-	}
-
-	i = atoi(argv[1]);
-
-	if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
-	{
-		audtool_whine("invalid playlist position %d", i);
-		exit(1);
-	}
+	gint i = check_args_playlist_pos(argc, argv);
 
 	if (audacious_remote_playqueue_is_queued(dbus_proxy, i - 1))
 		audacious_remote_playqueue_remove(dbus_proxy, i - 1);
@@ -85,23 +55,9 @@
 
 void playqueue_is_queued(gint argc, gchar **argv)
 {
-	gint i;
-
-	if (argc < 2)
-	{
-		audtool_whine("invalid parameters for playqueue-is-queued.", argv[0]);
-		audtool_whine("syntax: %s playqueue-is-queued <position>", argv[0]);
-		exit(1);
-	}
+	gint i = check_args_playlist_pos(argc, argv);
 
-	i = atoi(argv[1]);
-
-	if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
-	{
-		audtool_whine("invalid playlist position %d", i);
-		exit(1);
-	}
-    if(audacious_remote_playqueue_is_queued(dbus_proxy, i - 1)) {
+    if (audacious_remote_playqueue_is_queued(dbus_proxy, i - 1)) {
         audtool_report("OK");
         exit(0);
     }
@@ -111,22 +67,7 @@
 
 void playqueue_get_queue_position(gint argc, gchar **argv)
 {
-	gint i, pos;
-
-	if (argc < 2)
-	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <position>", argv[0]);
-		exit(1);
-	}
-
-	i = atoi(argv[1]);
-
-	if (i < 1 || i > audacious_remote_get_playlist_length(dbus_proxy))
-	{
-		audtool_whine("invalid playlist position %d", i);
-		exit(1);
-	}
+	gint pos, i = check_args_playlist_pos(argc, argv);
 
 	pos = audacious_remote_get_playqueue_queue_position(dbus_proxy, i - 1) + 1;
 
@@ -138,22 +79,7 @@
 
 void playqueue_get_list_position(gint argc, gchar **argv)
 {
-	gint i, pos;
-
-	if (argc < 2)
-	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <position>", argv[0]);
-		exit(1);
-	}
-
-	i = atoi(argv[1]);
-
-	if (i < 1 || i > audacious_remote_get_playqueue_length(dbus_proxy))
-	{
-		audtool_whine("invalid playlist position %d", i);
-		exit(1);
-	}
+	gint pos, i = check_args_playlist_pos(argc, argv);
 
 	pos = audacious_remote_get_playqueue_list_position(dbus_proxy, i - 1) + 1;
 
--- a/src/audtool/audtool_handlers_vitals.c	Thu Jun 05 01:05:36 2008 +0300
+++ b/src/audtool/audtool_handlers_vitals.c	Thu Jun 05 01:25:22 2008 +0300
@@ -165,12 +165,11 @@
 
 	if (argc < 2)
 	{
-		audtool_whine("invalid parameters for %s.", argv[0]);
-		audtool_whine("syntax: %s <fieldname>", argv[0]);
-		audtool_whine("  - fieldname example choices include but are not limited to:");
-		audtool_whine("      artist, album, title, track-number, year, date,");
-		audtool_whine("      genre, comment, file-name, file-ext, file-path,");
-		audtool_whine("      length, formatter, custom, mtime");
+		audtool_whine_args(argv[0], "<fieldname>");
+		audtool_whine("  - fieldname example choices include but are not limited to:\n");
+		audtool_whine("      artist, album, title, track-number, year, date,\n");
+		audtool_whine("      genre, comment, file-name, file-ext, file-path,\n");
+		audtool_whine("      length, formatter, custom, mtime\n");
 		exit(1);
 	}
 
--- a/src/audtool/audtool_report.c	Thu Jun 05 01:05:36 2008 +0300
+++ b/src/audtool/audtool_report.c	Thu Jun 05 01:25:22 2008 +0300
@@ -59,7 +59,20 @@
 	buf = g_strdup_vprintf(str, va);
 	va_end(va);
 
-	g_printerr("audtool: %s\n", buf);
+	g_printerr("audtool: %s", buf);
 	g_free(buf);
 }
 
+void audtool_whine_args(const gchar *name, const gchar *fmt, ...)
+{
+	gchar *buf;
+	va_list va;
+
+	va_start(va, fmt);
+	buf = g_strdup_vprintf(fmt, va);
+	va_end(va);
+
+	g_printerr("audtool: Invalid parameters for %s\n", name);
+	g_printerr(" syntax: %s %s\n", name, buf);
+	g_free(buf);
+}