UserInterface/Check_Option_Spelling [ Functions ]

FUNCTION

Check for misspelled options specified by the user.

SYNOPSIS

int Check_Option_Spelling(
    void )

RESULT

SOURCE

{
    char                ok;
    char               *arg;
    char              **opts;
    unsigned int        parameter_nr;

    RB_Say( "Checking the option syntax.\n", SAY_INFO );
    for ( parameter_nr = 0;
          parameter_nr < configuration.options.number; parameter_nr++ )
    {
        arg = configuration.options.names[parameter_nr];
        if ( ( arg[0] == '-' ) && ( arg[1] == '-' ) )
        {
            /* this arg is an option */
            ok = 0;
            opts = ok_options;
            while ( *opts )
            {
                if ( strcmp( arg, *opts ) == 0 )
                {
                    ok = 1;
                    break;
                }
                opts++;
            }
            if ( !ok )
            {
                fprintf( stderr, "Invalid argument: %s\n", arg );
                fprintf( stderr,
                         "This might also be in your robodoc.rc file\n" );
                return EXIT_FAILURE;
            }
        }
    }
    return EXIT_SUCCESS;
}