/* This function takes a string and copies it, removing any occurences of double 'chr' with a single 'chr'.  */
gchar* ws_strdup_unescape_char(const gchar *str, const char chr)
/* This function takes a string and copies it, removing any occurences of double 'chr' with a single 'chr'.  */
gchar* ws_strdup_unescape_char(const gchar *str, const char chr)
{
    const gchar *p;
    gchar *q, *new_str;
    if(!str)
        return NULL;
    p = str;
    q = new_str = (gchar *)g_malloc (strlen(str) + 1);
    while(*p != 0) {
        *q++ = *p;
        if ((*p == chr) && (*(p+1) == chr))
            p += 2;
        else
            p++;
    }
    *q = '\0';
    return new_str;
}