On 11/16/10 02:16, Michael Roth wrote:
> +/* utility function to parse iforward/oforward options for qemu-vp
> + * or virtproxy chardev and put them into QemuOpts
> + */
> +int vp_parse(QemuOpts *opts, const char *str, bool is_channel)
> +{
> +    /* TODO: use VP_SERVICE_ID_LEN, bring it into virtproxy.h */
> +    char service_id[32];
> +    char channel_method[32];
> +    char index[10];
> +    char *addr;
> +    char port[33];
> +    int pos, ret;
> +
> +    if (is_channel == false) {
> +        /* parse service id */
> +        ret = sscanf(str,"%32[^:]:%n",service_id,&pos);
> +        if (ret != 1) {
> +            LOG("error parsing service id");
> +            return -1;

-EINVAL seems more useful than -1

Cheers,
Jes

Reply via email to