changeset 652:9bcfd6d7a902

Display a message when invalid remote options are used.
author zas_
date Tue, 13 May 2008 14:49:38 +0000
parents ac87e9688188
children e06947d07086
files src/main.c src/remote.c src/remote.h
diffstat 3 files changed, 24 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.c	Tue May 13 14:35:51 2008 +0000
+++ b/src/main.c	Tue May 13 14:49:38 2008 +0000
@@ -232,6 +232,7 @@
 {
 	GList *list = NULL;
 	GList *remote_list = NULL;
+	GList *remote_errors = NULL;
 	gint remote_do = FALSE;
 	gchar *first_dir = NULL;
 
@@ -307,7 +308,7 @@
 				if (!remote_do)
 					{
 					remote_do = TRUE;
-					remote_list = remote_build_list(remote_list, argc, argv);
+					remote_list = remote_build_list(remote_list, argc - i, &argv[i], &remote_errors);
 					}
 				}
 			else if (strcmp(cmd_line, "-rh") == 0 ||
@@ -386,6 +387,22 @@
 
 	if (remote_do)
 		{
+		if (remote_errors)
+			{
+			GList *work = remote_errors;
+			
+			printf_term(_("Invalid or ignored remote options: "));
+			while (work)
+				{
+				gchar *opt = work->data;
+						
+				printf_term("%s%s", (work == remote_errors) ? "" : ", ", opt);
+				work = work->next;
+				}
+
+			printf_term(_("\nUse --remote-help for valid remote options.\n"));
+			}
+
 		remote_control(argv[0], remote_list, *path, list, *collection_list);
 		}
 	g_list_free(remote_list);
--- a/src/remote.c	Tue May 13 14:35:51 2008 +0000
+++ b/src/remote.c	Tue May 13 14:49:38 2008 +0000
@@ -663,7 +663,7 @@
 		}
 }
 
-GList *remote_build_list(GList *list, int argc, char *argv[])
+GList *remote_build_list(GList *list, int argc, char *argv[], GList **errors)
 {
 	gint i;
 
@@ -677,6 +677,10 @@
 			{
 			list = g_list_append(list, argv[i]);
 			}
+		else if (errors)
+			{
+			*errors = g_list_append(*errors, argv[i]);
+			}
 		i++;
 		}
 
--- a/src/remote.h	Tue May 13 14:35:51 2008 +0000
+++ b/src/remote.h	Tue May 13 14:49:38 2008 +0000
@@ -33,7 +33,7 @@
 
 
 void remote_close(RemoteConnection *rc);
-GList *remote_build_list(GList *list, int argc, char *argv[]);
+GList *remote_build_list(GList *list, int argc, char *argv[], GList **errors);
 void remote_help(void);
 void remote_control(const gchar *arg_exec, GList *remote_list, const gchar *path,
 		    GList *cmd_list, GList *collection_list);