[gq-commit] gq/src configfile.c,1.32,1.33
Status: Beta
Brought to you by:
sur5r
From: <bi...@us...> - 2003-10-04 23:36:31
|
Update of /cvsroot/gqclient/gq/src In directory sc8-pr-cvs1:/tmp/cvs-serv26454 Modified Files: configfile.c Log Message: properly escape < and > when writing ~/.gq also handle this as unicode, not ASCII (peter can you check this please) Index: configfile.c =================================================================== RCS file: /cvsroot/gqclient/gq/src/configfile.c,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** configfile.c 4 Oct 2003 10:15:46 -0000 1.32 --- configfile.c 4 Oct 2003 23:36:27 -0000 1.33 *************** *** 827,840 **** static void config_write_string(struct writeconfig *wc, const char *value, const char *entity) { ! int i; ! GString *outstr = g_string_sized_new(1024); g_string_sprintf(outstr, "<%s>", entity); ! /* quick-and-dirty escape < and > */ ! for(i = 0; value[i]; i++) { ! if(value[i] == '<' || value[i] == '>') { ! g_string_append(outstr, "\\"); } - g_string_append_c(outstr, value[i]); } --- 827,847 ---- static void config_write_string(struct writeconfig *wc, const char *value, const char *entity) { ! GString *outstr; ! gunichar c; ! ! outstr = g_string_sized_new(1024); g_string_sprintf(outstr, "<%s>", entity); ! for(c = g_utf8_get_char(value); c; value = g_utf8_next_char(value), c = *value) { ! switch(c) { ! case '<': ! g_string_append(outstr, "<"); ! break; ! case '>': ! g_string_append(outstr, ">"); ! break; ! default: ! g_string_append_c(outstr, c); } } *************** *** 843,846 **** --- 850,854 ---- g_string_append(outstr, ">\n"); config_write(wc, outstr->str); + } |