Display a message when invalid remote options are used.
authorLaurent Monin <geeqie@norz.org>
Tue, 13 May 2008 14:49:38 +0000 (14:49 +0000)
committerLaurent Monin <geeqie@norz.org>
Tue, 13 May 2008 14:49:38 +0000 (14:49 +0000)
src/main.c
src/remote.c
src/remote.h

index 5d3091b..f549f10 100644 (file)
@@ -232,6 +232,7 @@ static void parse_command_line(int argc, char *argv[], gchar **path, gchar **fil
 {
        GList *list = NULL;
        GList *remote_list = NULL;
+       GList *remote_errors = NULL;
        gint remote_do = FALSE;
        gchar *first_dir = NULL;
 
@@ -307,7 +308,7 @@ static void parse_command_line(int argc, char *argv[], gchar **path, gchar **fil
                                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 @@ static void parse_command_line(int argc, char *argv[], gchar **path, gchar **fil
 
        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);
index b04112e..dcb0954 100644 (file)
@@ -663,7 +663,7 @@ void remote_help(void)
                }
 }
 
-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 @@ GList *remote_build_list(GList *list, int argc, char *argv[])
                        {
                        list = g_list_append(list, argv[i]);
                        }
+               else if (errors)
+                       {
+                       *errors = g_list_append(*errors, argv[i]);
+                       }
                i++;
                }
 
index 05e651e..84d8a04 100644 (file)
@@ -33,7 +33,7 @@ struct _RemoteConnection {
 
 
 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);