comparison 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
comparison
equal deleted inserted replaced
386:16497a84c34b 387:2f5ce7fb5aad
604 { 604 {
605 gftpui_callback_data * cdata; 605 gftpui_callback_data * cdata;
606 intptr_t retries; 606 intptr_t retries;
607 607
608 if (GFTP_IS_CONNECTED (request)) 608 if (GFTP_IS_CONNECTED (request))
609 { 609 gftpui_disconnect (uidata);
610 gftp_disconnect (request); /* FIXME */
611 }
612 610
613 if (command != NULL) 611 if (command != NULL)
614 { 612 {
615 if (*command == '\0') 613 if (*command == '\0')
616 { 614 {
653 static int 651 static int
654 gftpui_common_cmd_set (void *uidata, gftp_request * request, 652 gftpui_common_cmd_set (void *uidata, gftp_request * request,
655 void *other_uidata, gftp_request * other_request, 653 void *other_uidata, gftp_request * other_request,
656 const char *command) 654 const char *command)
657 { 655 {
656 char *pos, *backpos, buf[256];
658 gftp_config_vars * cv, newcv; 657 gftp_config_vars * cv, newcv;
659 char *pos, *backpos;
660 GList * templist; 658 GList * templist;
661 int i; 659 int i;
662 660
663 if (command == NULL || *command == '\0') 661 if (command == NULL || *command == '\0')
664 { 662 {
675 673
676 if (*cv[i].key == '\0' || 674 if (*cv[i].key == '\0' ||
677 gftp_option_types[cv[i].otype].write_function == NULL) 675 gftp_option_types[cv[i].otype].write_function == NULL)
678 continue; 676 continue;
679 677
680 printf ("%s = ", cv[i].key); 678 gftp_option_types[cv[i].otype].write_function (&cv[i], buf,
681 gftp_option_types[cv[i].otype].write_function (&cv[i], stdout, 0); 679 sizeof (buf), 0);
682 printf ("\n"); 680
681 gftpui_common_logfunc (gftp_logging_misc_nolog, request,
682 "%s = %s\n", cv[i].key, buf);
683 } 683 }
684 } 684 }
685 } 685 }
686 else 686 else
687 { 687 {
720 720
721 gftp_option_types[cv->otype].read_function (pos, &newcv, 1); 721 gftp_option_types[cv->otype].read_function (pos, &newcv, 1);
722 722
723 gftp_set_global_option (command, newcv.value); 723 gftp_set_global_option (command, newcv.value);
724 724
725 gftp_option_types[newcv.otype].write_function (&newcv, buf,
726 sizeof (buf), 0);
727
728 gftpui_common_logfunc (gftp_logging_misc_nolog, request,
729 "%s = %s\n", newcv.key, buf);
730
725 if (newcv.flags & GFTP_CVARS_FLAGS_DYNMEM) 731 if (newcv.flags & GFTP_CVARS_FLAGS_DYNMEM)
726 g_free (newcv.value); 732 g_free (newcv.value);
727 } 733 }
728 } 734 }
729 735
736 void *other_uidata, gftp_request * other_request, 742 void *other_uidata, gftp_request * other_request,
737 const char *command) 743 const char *command)
738 { 744 {
739 int i, j, ele, numrows, numcols = 6, handled, number_commands, cmdlen, 745 int i, j, ele, numrows, numcols = 6, handled, number_commands, cmdlen,
740 found; 746 found;
747 char commands[128], cmdstr[30];
741 const char *pos; 748 const char *pos;
742 749
743 for (number_commands=0; 750 for (number_commands=0;
744 gftpui_common_commands[number_commands].command != NULL; 751 gftpui_common_commands[number_commands].command != NULL;
745 number_commands++); 752 number_commands++);
764 handled = gftpui_common_commands[i].subhelp_func (pos + 1); 771 handled = gftpui_common_commands[i].subhelp_func (pos + 1);
765 else 772 else
766 handled = 0; 773 handled = 0;
767 774
768 if (!handled) 775 if (!handled)
769 printf ("%s\n", _(gftpui_common_commands[i].cmd_description)); 776 gftpui_common_logfunc (gftp_logging_misc_nolog, request, "%s\n",
777 _(gftpui_common_commands[i].cmd_description));
770 } 778 }
771 else 779 else
772 found = 0; 780 found = 0;
773 } 781 }
774 else 782 else
778 { 786 {
779 numrows = number_commands / numcols; 787 numrows = number_commands / numcols;
780 if (number_commands % numcols != 0) 788 if (number_commands % numcols != 0)
781 numrows++; 789 numrows++;
782 790
783 printf (_("Supported commands:\n\n")); 791 gftpui_common_logfunc (gftp_logging_misc_nolog, request,
792 _("Supported commands:\n\n"));
793
784 for (i=0; i<numrows; i++) 794 for (i=0; i<numrows; i++)
785 { 795 {
786 printf (" "); 796 strncpy (commands, "\t", sizeof (commands));
797
787 for (j=0; j<numcols; j++) 798 for (j=0; j<numcols; j++)
788 { 799 {
789 ele = i + j * numrows; 800 ele = i + j * numrows;
790 if (ele >= number_commands) 801 if (ele >= number_commands)
791 break; 802 break;
792 printf ("%-10s", gftpui_common_commands[ele].command); 803
804 g_snprintf (cmdstr, sizeof (cmdstr), "%-10s",
805 gftpui_common_commands[ele].command);
806 strncat (commands, cmdstr, sizeof (commands));
793 } 807 }
794 printf ("\n"); 808 gftpui_common_logfunc (gftp_logging_misc_nolog, request, "%s\n",
795 } 809 commands);
796 810 }
797 printf ("\n");
798 } 811 }
799 return (1); 812 return (1);
800 } 813 }
801 814
802 815
1050 if (gftpui_common_commands[i].command != NULL) 1063 if (gftpui_common_commands[i].command != NULL)
1051 { 1064 {
1052 ret = gftpui_common_commands[i].func (uidata, request, 1065 ret = gftpui_common_commands[i].func (uidata, request,
1053 other_uidata, other_request, pos); 1066 other_uidata, other_request, pos);
1054 1067
1055 if (!GFTP_IS_CONNECTED (request)) 1068 if (request != NULL && !GFTP_IS_CONNECTED (request))
1056 gftpui_disconnect (uidata); 1069 gftpui_disconnect (uidata);
1057 } 1070 }
1058 else 1071 else
1059 { 1072 {
1060 gftpui_common_logfunc (gftp_logging_error, request, 1073 gftpui_common_logfunc (gftp_logging_error, request,
1441 tdata->fromreq->cancel = 0; 1454 tdata->fromreq->cancel = 0;
1442 tdata->toreq->cancel = 0; 1455 tdata->toreq->cancel = 0;
1443 } 1456 }
1444 tdata->done = 1; 1457 tdata->done = 1;
1445 1458
1446 return (1); /* FIXME */ 1459 return (1);
1447 } 1460 }
1448 1461