diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2007-02-12 05:10:52 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2007-02-12 05:10:52 +0000 |
commit | 64f5bec543bea8bcd2e4586f55daf83dae81f366 (patch) | |
tree | 94bcbc460b149e272787d69230b33e2646f3bd3c /gtk | |
parent | ca590fafbe8d8769d3cd1c4b6ecd881bb0a1f399 (diff) |
delimit each CSV output with "
(this should be combined into a generic function as this CSV encapsulation functionality is implemented several times)
svn path=/trunk/; revision=20791
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/packet_list.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gtk/packet_list.c b/gtk/packet_list.c index ddeeaa2f6d..4449a2d9f5 100644 --- a/gtk/packet_list.c +++ b/gtk/packet_list.c @@ -904,23 +904,34 @@ void packet_list_copy_summary_cb(GtkWidget * w _U_, gpointer data _U_, copy_summ { gint row; gint col; - gchar separator; gchar* celltext = NULL; + GString* text; + + if(CS_CSV == copy_type) { + text = g_string_new("\""); + } else { + text = g_string_new(""); + } - GString* text = g_string_new(""); - separator = (CS_CSV == copy_type) ? ',' : '\t'; if (cfile.current_frame) { /* XXX hum, should better have a "cfile->current_row" here ... */ row = eth_clist_find_row_from_data(ETH_CLIST(packet_list), cfile.current_frame); for(col = 0; col < cfile.cinfo.num_cols; ++col) { if(col != 0) { - g_string_append_c(text,separator); + if(CS_CSV == copy_type) { + g_string_append_printf(text,"\",\""); + } else { + g_string_append_c(text, '\t'); + } } if(0 != eth_clist_get_text(ETH_CLIST(packet_list),row,col,&celltext)) { g_string_append(text,celltext); } } + if(CS_CSV == copy_type) { + g_string_append_c(text,'"'); + } copy_to_clipboard(text); } g_string_free(text,TRUE); |