/* This function is comparable to get_opt_name with the difference that the delimiter is fixed to be comma which starts a new option. To specify an option value that contains commas, double each comma.  */
const char* get_opt_value(char *buf, int buf_size, const char *p)
/* This function is comparable to get_opt_name with the difference that the delimiter is fixed to be comma which starts a new option. To specify an option value that contains commas, double each comma.  */
const char* get_opt_value(char *buf, int buf_size, const char *p)
{
    char *q;
    q = buf;
    while (*p != '\0') {
        if (*p == ',') {
            if (*(p + 1) != ',')
                break;
            p++;
        }
        if (q && (q - buf) < buf_size - 1)
            *q++ = *p;
        p++;
    }
    if (q)
        *q = '\0';
    return p;
}