comparison lib/config_file.c @ 607:f946521bb2f2

2004-11-1 Brian Masney <masneyb@gftp.org> * lib/config_file.c (gftp_write_bookmarks_file) - if a folder has no children, make sure the entry has a / appended to the end of the description. Don't write out any of the other unneeded fields
author masneyb
date Tue, 02 Nov 2004 02:15:14 +0000
parents b60dad25b641
children d97e985f5dbe
comparison
equal deleted inserted replaced
606:b6887fbe3e11 607:f946521bb2f2
762 762
763 tempstr = tempentry->path; 763 tempstr = tempentry->path;
764 while (*tempstr == '/') 764 while (*tempstr == '/')
765 tempstr++; 765 tempstr++;
766 766
767 if (tempentry->save_password && tempentry->pass != NULL) 767 if (tempentry->isfolder)
768 password = gftp_scramble_password (tempentry->pass); 768 {
769 fprintf (bmfile, "[%s/]\n", tempstr);
770 }
769 else 771 else
770 password = NULL; 772 {
771 773 if (tempentry->save_password && tempentry->pass != NULL)
772 fprintf (bmfile, 774 password = gftp_scramble_password (tempentry->pass);
773 "[%s]\nhostname=%s\nport=%d\nprotocol=%s\nremote directory=%s\nlocal directory=%s\nusername=%s\npassword=%s\naccount=%s\n", 775 else
774 tempstr, tempentry->hostname == NULL ? "" : tempentry->hostname, 776 password = NULL;
775 tempentry->port, tempentry->protocol == NULL 777
776 || *tempentry->protocol == 778 fprintf (bmfile,
777 '\0' ? gftp_protocols[0].name : tempentry->protocol, 779 "[%s]\nhostname=%s\nport=%d\nprotocol=%s\nremote directory=%s\nlocal directory=%s\nusername=%s\npassword=%s\naccount=%s\n",
778 tempentry->remote_dir == NULL ? "" : tempentry->remote_dir, 780 tempstr, tempentry->hostname == NULL ? "" : tempentry->hostname,
779 tempentry->local_dir == NULL ? "" : tempentry->local_dir, 781 tempentry->port, tempentry->protocol == NULL
780 tempentry->user == NULL ? "" : tempentry->user, 782 || *tempentry->protocol ==
781 password == NULL ? "" : password, 783 '\0' ? gftp_protocols[0].name : tempentry->protocol,
782 tempentry->acct == NULL ? "" : tempentry->acct); 784 tempentry->remote_dir == NULL ? "" : tempentry->remote_dir,
783 785 tempentry->local_dir == NULL ? "" : tempentry->local_dir,
784 if (password != NULL) 786 tempentry->user == NULL ? "" : tempentry->user,
785 g_free(password); 787 password == NULL ? "" : password,
786 788 tempentry->acct == NULL ? "" : tempentry->acct);
787 if (tempentry->local_options_vars != NULL) 789 if (password != NULL)
788 { 790 g_free(password);
789 for (i=0; i<tempentry->num_local_options_vars; i++) 791
792 if (tempentry->local_options_vars != NULL)
790 { 793 {
791 gftp_option_types[tempentry->local_options_vars[i].otype].write_function (&tempentry->local_options_vars[i], buf, sizeof (buf), 1); 794 for (i=0; i<tempentry->num_local_options_vars; i++)
792 795 {
793 fprintf (bmfile, "%s=%s\n", tempentry->local_options_vars[i].key, 796 gftp_option_types[tempentry->local_options_vars[i].otype].write_function (&tempentry->local_options_vars[i], buf, sizeof (buf), 1);
794 buf); 797
798 fprintf (bmfile, "%s=%s\n", tempentry->local_options_vars[i].key,
799 buf);
800 }
795 } 801 }
796 } 802 }
797 803
798 fprintf (bmfile, "\n"); 804 fprintf (bmfile, "\n");
799 805