diff lib/config_file.c @ 218:de6a2e8e51cb

2003-7-9 Brian Masney <masneyb@gftp.org> * lib/config_file.c (gftp_write_config_file) - fix for writing out list items to the config file. * lib/config_file.c lib/gftp.h - added gftp_free_proxy_hosts() and gftp_copy_proxy_hosts() * lib/protocols.c (gftp_connect_server) - look up dont_use_proxy instead of ext * lib/protocols.c lib/sshv2.c src/gtk/dnd.c src/gtk/menu-items.c - when calling g_build_path(), set the directory separator to / instead of G_DIR_SEPARATOR_S * src/gtk/gftp-gtk.c (toolbar_hostedit) - fixed crash * src/gtk/gftp-gtk.h - removed gotbytes from gftp_window_data structure * src/gtk/options_dialog.c - show proxy hosts in options dialog * docs/sample.gftp/gftprc - new default config file
author masneyb
date Wed, 09 Jul 2003 23:25:56 +0000
parents cf4098008615
children a85a097bbb02
line wrap: on
line diff
--- a/lib/config_file.c	Tue Jul 08 19:44:12 2003 +0000
+++ b/lib/config_file.c	Wed Jul 09 23:25:56 2003 +0000
@@ -784,13 +784,17 @@
         }
     }
     
-  for (i=0; gftp_config_list[i].list != NULL; i++)
+  for (i=0; gftp_config_list[i].key != NULL; i++)
     {
+      if (gftp_config_list[i].header == NULL &&
+          gftp_config_list[i].list == NULL)
+        continue;
+
       fprintf (conffile, "\n");
       if (gftp_config_list[i].header != NULL)
         write_comment (conffile, _(gftp_config_list[i].header));
 
-      for (templist = gftp_options_list;
+      for (templist = gftp_config_list[i].list;
            templist != NULL;
            templist = templist->next)
         {
@@ -1326,3 +1330,54 @@
   g_free (bookmarks);
 }
 
+
+void
+gftp_free_proxy_hosts (GList * proxy_hosts)
+{
+  gftp_proxy_hosts * hosts;
+  GList * templist;
+
+  for (templist = proxy_hosts;
+       templist != NULL; 
+       templist = templist->next)
+    {
+      hosts = templist->data;
+
+      if (hosts->domain)
+        g_free (hosts->domain);
+      g_free (hosts);
+    }
+
+  g_list_free (proxy_hosts);
+}
+
+
+GList *
+gftp_copy_proxy_hosts (GList * proxy_hosts)
+{
+  gftp_proxy_hosts * oldhosts, * newhosts;
+  GList * templist, * new_proxy_hosts;
+
+  new_proxy_hosts = NULL;
+
+  if (proxy_hosts != NULL)
+    {
+      for (templist = proxy_hosts;
+           templist != NULL; 
+           templist = templist->next)
+        {
+          oldhosts = templist->data;
+
+          newhosts = g_malloc0 (sizeof (*newhosts));
+          memcpy (newhosts, oldhosts, sizeof (*newhosts));
+
+          if (oldhosts->domain)
+            newhosts->domain = g_strdup (oldhosts->domain);
+
+          new_proxy_hosts = g_list_append (new_proxy_hosts, newhosts);
+        }
+    }
+
+  return (new_proxy_hosts);
+}
+