Revision db08adf5 qemu-img.c

b/qemu-img.c
281 281
            break;
282 282
        }
283 283
    }
284
    if (optind >= argc)
285
        help();
286
    filename = argv[optind++];
287 284

  
288 285
    /* Find driver and parse its options */
289 286
    drv = bdrv_find_format(fmt);
290 287
    if (!drv)
291 288
        error("Unknown file format '%s'", fmt);
292 289

  
290
    if (options && !strcmp(options, "?")) {
291
        print_option_help(drv->create_options);
292
        return 0;
293
    }
294

  
293 295
    if (options) {
294 296
        param = parse_option_parameters(options, drv->create_options, param);
295 297
        if (param == NULL) {
......
299 301
        param = parse_option_parameters("", drv->create_options, param);
300 302
    }
301 303

  
304
    /* Get the filename */
305
    if (optind >= argc)
306
        help();
307
    filename = argv[optind++];
308

  
302 309
    /* Add size to parameters */
303 310
    if (optind < argc) {
304 311
        set_option_parameter(param, BLOCK_OPT_SIZE, argv[optind++]);
......
596 603
    if (!drv)
597 604
        error("Unknown file format '%s'", out_fmt);
598 605

  
606
    if (options && !strcmp(options, "?")) {
607
        print_option_help(drv->create_options);
608
        return 0;
609
    }
610

  
599 611
    if (options) {
600 612
        param = parse_option_parameters(options, drv->create_options, param);
601 613
        if (param == NULL) {

Also available in: Unified diff