Lars Gullik Bjønnes wrote:
> It seems that fdesign returns 0 even if something went wrong.
> 
> (writing the files f.ex.)

Wrong list...

In general, you're wrong. fdesign will exit early and return 1 in lots
of places:

    if (!(fd_display = fl_initialize(&ac, av, 0, fd_cmdopt, Ncopt)))
        exit(1);

Also, it calls 'usage' in lots of places. the '1' leads to exit(1).

    if (help)
        usage(av[0], 1);

But in this specific conversion case you're right, fdesign always
returns 0:

    if (fdopt.conv_only)
    {
        if (ac == 1)
            fprintf(stderr, "%s: -convert requires arguments\n", av[0]);

        for (s = 1; s < ac; s++)
        {
            load_forms(FALSE, av[s], 0);
            save_forms(av[s]);
        }
        exit(0);
    }

Both load_forms and save_forms return whether they were successful or
not, so this could easily be changed to:

        for (s = 1; s < ac; s++)
        {
            if (!load_forms(FALSE, av[s], 0))
                exit(1);
            if (!save_forms(av[s]))
                exit(1);
        }

Thanks for the heads up.

-- 
Angus

Reply via email to