diff lib/config_file.c @ 143:5c952c5cb438

2003-4-23 Brian Masney <masneyb@gftp.org> * Makefile.am - removed config.rpath from EXTRA_DIST * configure.in - added 'sr' to ALL_LINGUAS. Incremented version to 2.0.15 (will be a little while before this is released. Still have lots to do) * docs/sample.gftp/gftprc - removed old unused SSH options. These were used by the SSH protocol I ripped out * lib/config_file.c - fix for gftp_set_request_option(). Implemented gftp_lookup_request_options(). Overriding of configuration options now works across the board :) * lib/protocols.c - extra checks for freeing memory * src/text/gftp-text.c - renamed ssh_use_sftp_subsys to the proper name of sshv2_use_sftp_subsys * src/gtk/transfer.c - renamed append_file_transfers option to the proper name of append_transfers. Also, added quick fix for start_file_transfers option that is still missing * debian/gftp-text.postinst - this will add add an alternative for the ftp command and point it to gftp-text
author masneyb
date Thu, 24 Apr 2003 02:21:58 +0000
parents 84b3e69807a2
children 2f15b3000dbc
line wrap: on
line diff
--- a/lib/config_file.c	Wed Apr 23 23:38:23 2003 +0000
+++ b/lib/config_file.c	Thu Apr 24 02:21:58 2003 +0000
@@ -1063,7 +1063,14 @@
 void
 gftp_lookup_request_option (gftp_request * request, char * key, void *value)
 {
-  gftp_lookup_global_option (key, value);
+  gftp_config_vars * tmpconfigvar;
+
+  if (request != NULL && request->local_options_hash != NULL &&
+      (tmpconfigvar = g_hash_table_lookup (request->local_options_hash,
+                                           key)) != NULL)
+    memcpy (value, &tmpconfigvar->value, sizeof (value));
+  else
+    gftp_lookup_global_option (key, value);
 }
 
 
@@ -1095,10 +1102,10 @@
 
   if ((tmpconfigvar = g_hash_table_lookup (request->local_options_hash,
                                            key)) != NULL)
-    memcpy (&tmpconfigvar->value, value, sizeof (tmpconfigvar->value));
+    memcpy (&tmpconfigvar->value, &value, sizeof (tmpconfigvar->value));
   else
     {
-      if (gftp_global_options_htable == NULL &&
+      if (gftp_global_options_htable == NULL ||
           (tmpconfigvar = g_hash_table_lookup (gftp_global_options_htable,
                                                key)) == NULL)
         {
@@ -1110,10 +1117,13 @@
       request->local_options_vars = g_realloc (request->local_options_vars, 
                                                sizeof (gftp_config_vars) * (request->num_local_options_vars + 1));
 
-      memcpy (&request->local_options_vars[request->num_local_options_vars],
+      memcpy (&request->local_options_vars[request->num_local_options_vars - 1],
               tmpconfigvar, sizeof (*tmpconfigvar));
-      memcpy (&request->local_options_vars[request->num_local_options_vars].value, value, sizeof (value));
-      
+      memcpy (&request->local_options_vars[request->num_local_options_vars - 1].value, &value, sizeof (value));
+
+      memset (&request->local_options_vars[request->num_local_options_vars].value, 0, sizeof (value));
+
+      g_hash_table_insert (request->local_options_hash, request->local_options_vars[request->num_local_options_vars - 1].key, &request->local_options_vars[request->num_local_options_vars - 1]);
     }
 }