diff src/audtool/audtool_handlers_general.c @ 3873:f3341c2d6b9e

audacious remote functions: - playlist_ins_url_string() and playlist_enqueue_to_temp() have been implemented. - now get_version() returns audacious version instead of protocol version. audtool: - now argc check works properly. - some cleanups.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Tue, 30 Oct 2007 22:12:47 +0900
parents e48f2f4c116d
children b5ee3a4a8e3b
line wrap: on
line diff
--- a/src/audtool/audtool_handlers_general.c	Tue Oct 30 18:17:55 2007 +0900
+++ b/src/audtool/audtool_handlers_general.c	Tue Oct 30 22:12:47 2007 +0900
@@ -54,7 +54,7 @@
 	{
 		audtool_whine("invalid parameters for %s.", argv[0]);
 		audtool_whine("syntax: %s <level>", argv[0]);
-		return;
+		exit(1);
 	}
 
 	current_volume = audacious_remote_get_main_volume(dbus_proxy);
@@ -74,53 +74,56 @@
 
 void mainwin_show(gint argc, gchar **argv)
 {
-	if (argc > 1)
-	{
-		if (!g_ascii_strcasecmp(argv[1], "on")) {
-			audacious_remote_main_win_toggle(dbus_proxy, TRUE);
-			return;
-		}
-		else if (!g_ascii_strcasecmp(argv[1], "off")) {
-			audacious_remote_main_win_toggle(dbus_proxy, FALSE);
-			return;
-		}
-	}
-	audtool_whine("invalid parameter for %s.", argv[0]);
-	audtool_whine("syntax: %s <on/off>", argv[0]);
+	if (argc < 2) {
+        audtool_whine("invalid parameter for %s.", argv[0]);
+        audtool_whine("syntax: %s <on/off>", argv[0]);
+        exit(1);
+    }
+
+    if (!g_ascii_strcasecmp(argv[1], "on")) {
+        audacious_remote_main_win_toggle(dbus_proxy, TRUE);
+        return;
+    }
+    else if (!g_ascii_strcasecmp(argv[1], "off")) {
+        audacious_remote_main_win_toggle(dbus_proxy, FALSE);
+        return;
+    }
 }
 
 void playlist_show(gint argc, gchar **argv)
 {
-	if (argc > 1)
-	{
-		if (!g_ascii_strcasecmp(argv[1], "on")) {
-			audacious_remote_pl_win_toggle(dbus_proxy, TRUE);
-			return;
-		}
-		else if (!g_ascii_strcasecmp(argv[1], "off")) {
-			audacious_remote_pl_win_toggle(dbus_proxy, FALSE);
-			return;
-		}
-	}
-	audtool_whine("invalid parameter for %s.", argv[0]);
-	audtool_whine("syntax: %s <on/off>", argv[0]);
+	if (argc < 2) {
+        audtool_whine("invalid parameter for %s.", argv[0]);
+        audtool_whine("syntax: %s <on/off>", argv[0]);
+        exit(1);
+    }
+
+    if (!g_ascii_strcasecmp(argv[1], "on")) {
+        audacious_remote_pl_win_toggle(dbus_proxy, TRUE);
+        return;
+    }
+    else if (!g_ascii_strcasecmp(argv[1], "off")) {
+        audacious_remote_pl_win_toggle(dbus_proxy, FALSE);
+        return;
+    }
 }
 
 void equalizer_show(gint argc, gchar **argv)
 {
-	if (argc > 1)
-	{
-		if (!g_ascii_strcasecmp(argv[1] ,"on")) {
-			audacious_remote_eq_win_toggle(dbus_proxy, TRUE);
-			return;
-		}
-		else if (!g_ascii_strcasecmp(argv[1] ,"off")) {
-			audacious_remote_eq_win_toggle(dbus_proxy, FALSE);
-			return;
-		}
-	}
-	audtool_whine("invalid parameter for %s.", argv[0]);
-	audtool_whine("syntax: %s <on/off>", argv[0]);
+	if (argc < 2) {
+        audtool_whine("invalid parameter for %s.", argv[0]);
+        audtool_whine("syntax: %s <on/off>", argv[0]);
+        exit(1);
+    }
+
+    if (!g_ascii_strcasecmp(argv[1] ,"on")) {
+        audacious_remote_eq_win_toggle(dbus_proxy, TRUE);
+        return;
+    }
+    else if (!g_ascii_strcasecmp(argv[1] ,"off")) {
+        audacious_remote_eq_win_toggle(dbus_proxy, FALSE);
+        return;
+    }
 }
 
 void show_preferences_window(gint argc, gchar **argv)
@@ -155,6 +158,7 @@
 			audtool_report("   %-34s - %s", handlers[i].name, handlers[i].desc);
 	}
 
+    audtool_report("");
 	audtool_report("Handlers may be prefixed with `--' (GNU-style long-options) or not, your choice.");
 	audtool_report("Report bugs to http://bugs-meta.atheme.org/");
 }