diff src/uicommon/gftpui.c @ 387:2f5ce7fb5aad

2003-2-2 Brian Masney <masneyb@gftp.org> * lib/config_file.c lib/gftp.h src/uicommon/gftpui.c src/gtk/gftp-gtk.c - updated the format of the config file write_functions so that the value isn't written to a file descriptor. Instead, it is written to a buffer. * src/text/gftp-text.c (gftp_text_log) - search for newlines in the string and split on those characters first * src/text/textui.c (gftpui_disconnect) - disconnect from the host * src/uicommon/gftpui.c - removed calls to printf() functions. Instead print the values out using the logging function * src/uicommon/gftpuicallbacks.c (gftpui_common_run_ls) - if we are connected to a local site, lookup the options local_sortasds and local_sortcol. Otherwise, lookup remove_sortasds and remote_sortcol. * autogen.sh - disable maintainer mode * TODO - updated
author masneyb
date Tue, 03 Feb 2004 02:27:57 +0000
parents 05ee37a5558b
children 14ef37b62c20
line wrap: on
line diff
--- a/src/uicommon/gftpui.c	Mon Feb 02 18:54:43 2004 +0000
+++ b/src/uicommon/gftpui.c	Tue Feb 03 02:27:57 2004 +0000
@@ -606,9 +606,7 @@
   intptr_t retries;
 
   if (GFTP_IS_CONNECTED (request))
-    {
-      gftp_disconnect (request); /* FIXME */
-    }
+    gftpui_disconnect (uidata);
   
   if (command != NULL)
     {
@@ -655,8 +653,8 @@
                        void *other_uidata, gftp_request * other_request,
                        const char *command)
 {
+  char *pos, *backpos, buf[256];
   gftp_config_vars * cv, newcv;
-  char *pos, *backpos;
   GList * templist;
   int i;
   
@@ -677,9 +675,11 @@
                   gftp_option_types[cv[i].otype].write_function == NULL)
                 continue;
 
-              printf ("%s = ", cv[i].key);
-              gftp_option_types[cv[i].otype].write_function (&cv[i], stdout, 0);
-              printf ("\n");
+              gftp_option_types[cv[i].otype].write_function (&cv[i], buf,
+                                                             sizeof (buf), 0);
+
+              gftpui_common_logfunc (gftp_logging_misc_nolog, request,
+                                     "%s = %s\n", cv[i].key, buf);
             }
         }
     }
@@ -722,6 +722,12 @@
 
           gftp_set_global_option (command, newcv.value);
 
+          gftp_option_types[newcv.otype].write_function (&newcv, buf,
+                                                         sizeof (buf), 0);
+
+          gftpui_common_logfunc (gftp_logging_misc_nolog, request,
+                                 "%s = %s\n", newcv.key, buf);
+
           if (newcv.flags & GFTP_CVARS_FLAGS_DYNMEM)
             g_free (newcv.value);
         }
@@ -738,6 +744,7 @@
 {
   int i, j, ele, numrows, numcols = 6, handled, number_commands, cmdlen,
       found;
+  char commands[128], cmdstr[30];
   const char *pos;
 
   for (number_commands=0;
@@ -766,7 +773,8 @@
             handled = 0;
 
           if (!handled)
-            printf ("%s\n", _(gftpui_common_commands[i].cmd_description));
+            gftpui_common_logfunc (gftp_logging_misc_nolog, request, "%s\n",
+                                 _(gftpui_common_commands[i].cmd_description));
         }
       else
         found = 0;
@@ -780,21 +788,26 @@
       if (number_commands % numcols != 0)
         numrows++;
 
-      printf (_("Supported commands:\n\n"));
+      gftpui_common_logfunc (gftp_logging_misc_nolog, request,
+                             _("Supported commands:\n\n"));
+      
       for (i=0; i<numrows; i++)
         {
-          printf ("     ");
+          strncpy (commands, "\t", sizeof (commands));
+
           for (j=0; j<numcols; j++)
             {
               ele = i + j * numrows;
               if (ele >= number_commands)
                 break;
-              printf ("%-10s", gftpui_common_commands[ele].command);
+
+              g_snprintf (cmdstr, sizeof (cmdstr), "%-10s",
+                          gftpui_common_commands[ele].command);
+              strncat (commands, cmdstr, sizeof (commands));
             }
-         printf ("\n");
+          gftpui_common_logfunc (gftp_logging_misc_nolog, request, "%s\n",
+                                 commands);
         }
-
-      printf ("\n");
     }
   return (1);
 }
@@ -1052,7 +1065,7 @@
       ret = gftpui_common_commands[i].func (uidata, request,
                                             other_uidata, other_request, pos);
 
-      if (!GFTP_IS_CONNECTED (request))
+      if (request != NULL && !GFTP_IS_CONNECTED (request))
         gftpui_disconnect (uidata);
     }
   else
@@ -1443,6 +1456,6 @@
     }
   tdata->done = 1;
 
-  return (1); /* FIXME */
+  return (1);
 }