Revision c64f27d4 qemu-option.c

b/qemu-option.c
176 176
        } else if (!strcmp(value, "off")) {
177 177
            *ret = 0;
178 178
        } else {
179
            fprintf(stderr, "Option '%s': Use 'on' or 'off'\n", name);
179
            qerror_report(QERR_INVALID_PARAMETER_VALUE, name, "'on' or 'off'");
180 180
            return -1;
181 181
        }
182 182
    } else {
......
193 193
    if (value != NULL) {
194 194
        number = strtoull(value, &postfix, 0);
195 195
        if (*postfix != '\0') {
196
            fprintf(stderr, "Option '%s' needs a number as parameter\n", name);
196
            qerror_report(QERR_INVALID_PARAMETER_VALUE, name, "a number");
197 197
            return -1;
198 198
        }
199 199
        *ret = number;
200 200
    } else {
201
        fprintf(stderr, "Option '%s' needs a parameter\n", name);
201
        qerror_report(QERR_INVALID_PARAMETER_VALUE, name, "a number");
202 202
        return -1;
203 203
    }
204 204
    return 0;
......
226 226
            *ret = (uint64_t) sizef;
227 227
            break;
228 228
        default:
229
            fprintf(stderr, "Option '%s' needs size as parameter\n", name);
230
            fprintf(stderr, "You may use k, M, G or T suffixes for "
229
            qerror_report(QERR_INVALID_PARAMETER_VALUE, name, "a size");
230
            error_printf_unless_qmp("You may use k, M, G or T suffixes for "
231 231
                    "kilobytes, megabytes, gigabytes and terabytes.\n");
232 232
            return -1;
233 233
        }
234 234
    } else {
235
        fprintf(stderr, "Option '%s' needs a parameter\n", name);
235
        qerror_report(QERR_INVALID_PARAMETER_VALUE, name, "a size");
236 236
        return -1;
237 237
    }
238 238
    return 0;
......
581 581
        if (i == 0) {
582 582
            /* empty list -> allow any */;
583 583
        } else {
584
            fprintf(stderr, "option \"%s\" is not valid for %s\n",
585
                    name, opts->list->name);
584
            qerror_report(QERR_INVALID_PARAMETER, name);
586 585
            return -1;
587 586
        }
588 587
    }
......
598 597
        opt->str = qemu_strdup(value);
599 598
    }
600 599
    if (qemu_opt_parse(opt) < 0) {
601
        fprintf(stderr, "Failed to parse \"%s\" for \"%s.%s\"\n", opt->str,
602
                opts->list->name, opt->name);
603 600
        qemu_opt_del(opt);
604 601
        return -1;
605 602
    }

Also available in: Unified diff