diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-07-22 21:56:25 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-07-22 21:56:25 +0000 |
commit | 95077f6a6fe6e2052c168d99ea6f70af0de1a47b (patch) | |
tree | f40a6c548eb75ed87978bf5d9dca070cf4bc7cfe /column.c | |
parent | d43965a2ab39173e6e86c9962ca09f2906abbc74 (diff) |
"col_format_to_pref_str()" is used only in "prefs.c", and knows about
the format of string lists in a preferences file; rename it to
"put_string_list()", make it take the list as an argument rather than
working only on "prefs.col_list", and put it in "prefs.c".
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@3776 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'column.c')
-rw-r--r-- | column.c | 54 |
1 files changed, 1 insertions, 53 deletions
@@ -1,7 +1,7 @@ /* column.c * Routines for handling column preferences * - * $Id: column.c,v 1.33 2001/07/22 21:50:46 guy Exp $ + * $Id: column.c,v 1.34 2001/07/22 21:56:25 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -388,55 +388,3 @@ get_column_title(gint col) { return(cfmt->title); } - -/* XXX - needs to handle quote marks inside the quoted string, by - backslash-escaping them. - - XXX - does this really belong in "prefs.c", instead, as it has to know - about the syntax of the preferences file? */ -#define MAX_FMT_PREF_LEN 1024 -#define MAX_FMT_PREF_LINE_LEN 60 -gchar * -col_format_to_pref_str(void) { - static gchar pref_str[MAX_FMT_PREF_LEN] = ""; - GList *clp = g_list_first(prefs.col_list); - fmt_data *cfmt; - int cur_pos = 0, cur_len = 0, fmt_len; - - while (clp) { - cfmt = (fmt_data *) clp->data; - - fmt_len = strlen(cfmt->title) + 4; - if ((fmt_len + cur_len) < (MAX_FMT_PREF_LEN - 1)) { - if ((fmt_len + cur_pos) > MAX_FMT_PREF_LINE_LEN) { - cur_len--; - cur_pos = 0; - pref_str[cur_len] = '\n'; cur_len++; - pref_str[cur_len] = '\t'; cur_len++; - } - sprintf(&pref_str[cur_len], "\"%s\", ", cfmt->title); - cur_len += fmt_len; - cur_pos += fmt_len; - } - - fmt_len = strlen(cfmt->fmt) + 4; - if ((fmt_len + cur_len) < (MAX_FMT_PREF_LEN - 1)) { - if ((fmt_len + cur_pos) > MAX_FMT_PREF_LINE_LEN) { - cur_len--; - cur_pos = 0; - pref_str[cur_len] = '\n'; cur_len++; - pref_str[cur_len] = '\t'; cur_len++; - } - sprintf(&pref_str[cur_len], "\"%s\", ", cfmt->fmt); - cur_len += fmt_len; - cur_pos += fmt_len; - } - - clp = clp->next; - } - - if (cur_len > 2) - pref_str[cur_len - 2] = '\0'; - - return(pref_str); -} |