Mercurial > gftp.yaz
diff lib/config_file.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 | d207b8241e96 |
children | 1d45758e5cf5 |
line wrap: on
line diff
--- a/lib/config_file.c Mon Feb 02 18:54:43 2004 +0000 +++ b/lib/config_file.c Tue Feb 03 02:27:57 2004 +0000 @@ -717,8 +717,8 @@ void gftp_write_bookmarks_file (void) { + char *bmhdr, *pwhdr, *tempstr, *password, buf[256]; gftp_bookmarks_var * tempentry; - char *bmhdr, *pwhdr, *tempstr, *password; FILE * bmfile; int i; @@ -781,9 +781,10 @@ { for (i=0; i<tempentry->num_local_options_vars; i++) { - fprintf (bmfile, "%s=", tempentry->local_options_vars[i].key); - gftp_option_types[tempentry->local_options_vars[i].otype].write_function (&tempentry->local_options_vars[i], bmfile, 1); - fprintf (bmfile, "\n"); + gftp_option_types[tempentry->local_options_vars[i].otype].write_function (&tempentry->local_options_vars[i], buf, sizeof (buf), 1); + + fprintf (bmfile, "%s=%s\n", tempentry->local_options_vars[i].key, + buf); } } @@ -807,10 +808,10 @@ void gftp_write_config_file (void) { + char *tempstr, buf[256]; gftp_config_vars * cv; GList *templist; FILE *conffile; - char *tempstr; int i; if ((tempstr = expand_path (CONFIG_FILE)) == NULL) @@ -846,9 +847,9 @@ if (cv[i].comment != NULL) write_comment (conffile, _(cv[i].comment)); - fprintf (conffile, "%s=", cv[i].key); - gftp_option_types[cv[i].otype].write_function (&cv[i], conffile, 1); - fprintf (conffile, "\n"); + gftp_option_types[cv[i].otype].write_function (&cv[i], buf, + sizeof (buf), 1); + fprintf (conffile, "%s=%s\n", cv[i].key, buf); } } @@ -949,15 +950,15 @@ static int -gftp_config_file_write_text (gftp_config_vars * cv, FILE * fd, int to_config_file) +gftp_config_file_write_text (gftp_config_vars * cv, char *buf, size_t buflen, + int to_config_file) { char *outstr; if (cv->value != NULL) { outstr = cv->value; - if (*outstr != '\0') - fprintf (fd, "%s", outstr); + g_snprintf (buf, buflen, "%s", outstr); return (0); } else @@ -966,7 +967,8 @@ static int -gftp_config_file_write_hidetext (gftp_config_vars * cv, FILE * fd, int to_config_file) +gftp_config_file_write_hidetext (gftp_config_vars * cv, char *buf, + size_t buflen, int to_config_file) { char *outstr; @@ -976,9 +978,9 @@ if (*outstr != '\0') { if (to_config_file) - fprintf (fd, "%s", outstr); + g_snprintf (buf, buflen, "%s", outstr); else - fprintf (fd, "*****"); + g_snprintf (buf, buflen, "*****"); } return (0); } @@ -1037,9 +1039,10 @@ static int -gftp_config_file_write_int (gftp_config_vars * cv, FILE * fd, int to_config_file) +gftp_config_file_write_int (gftp_config_vars * cv, char *buf, size_t buflen, + int to_config_file) { - fprintf (fd, "%d", GPOINTER_TO_INT(cv->value)); + g_snprintf (buf, buflen, "%d", GPOINTER_TO_INT (cv->value)); return (0); } @@ -1071,12 +1074,13 @@ static int -gftp_config_file_write_float (gftp_config_vars * cv, FILE * fd, int to_config_file) +gftp_config_file_write_float (gftp_config_vars * cv, char *buf, size_t buflen, + int to_config_file) { float f; memcpy (&f, &cv->value, sizeof (f)); - fprintf (fd, "%.2f", f); + g_snprintf (buf, buflen, "%.2f", f); return (0); } @@ -1119,12 +1123,13 @@ static int -gftp_config_file_write_color (gftp_config_vars * cv, FILE * fd, int to_config_file) +gftp_config_file_write_color (gftp_config_vars * cv, char *buf, size_t buflen, + int to_config_file) { gftp_color * color; color = cv->value; - fprintf (fd, "%x:%x:%x", color->red, color->green, color->blue); + g_snprintf (buf, buflen, "%x:%x:%x", color->red, color->green, color->blue); return (0); } @@ -1179,15 +1184,16 @@ static int -gftp_config_file_write_intcombo (gftp_config_vars * cv, FILE * fd, int to_config_file) +gftp_config_file_write_intcombo (gftp_config_vars * cv, char *buf, + size_t buflen, int to_config_file) { char **clist; clist = cv->listdata; if (clist != NULL) - fprintf (fd, "%s", clist[GPOINTER_TO_INT(cv->value)]); + g_snprintf (buf, buflen, "%s", clist[GPOINTER_TO_INT(cv->value)]); else - fprintf (fd, _("<unknown>")); + g_snprintf (buf, buflen, _("<unknown>")); return (0); }