src/util/show_help.c
/*
 * In the file that has already been opened, find the topic that we're
 * supposed to output
 */
In the file that has already been opened, find the topic that we're
supposed to output
In the file that has already been opened find the topic that we ' re supposed to output
static int find_topic(const char *base, const char *topic)
{
    int token, ret;
    char *tmp;
    while (1) {
        token = prte_show_help_yylex();
        switch (token) {
        case PRTE_SHOW_HELP_PARSE_TOPIC:
            tmp = strdup(prte_show_help_yytext);
            if (NULL == tmp) {
                return PRTE_ERR_OUT_OF_RESOURCE;
            }
            tmp[strlen(tmp) - 1] = '\0';
            ret = strcmp(tmp + 1, topic);
            free(tmp);
            if (0 == ret) {
                return PRTE_SUCCESS;
            }
            break;
        case PRTE_SHOW_HELP_PARSE_MESSAGE:
            break;
        case PRTE_SHOW_HELP_PARSE_DONE:
            prte_output(output_stream,
                        "%sSorry!  You were supposed to get help about:\n    %s\nfrom the file:\n  "
                        "  %s\nBut I couldn't find that topic in the file.  Sorry!\n%s",
                        dash_line, topic, base, dash_line);
            return PRTE_ERR_NOT_FOUND;
        default:
            break;
        }
    }
}
static int find_topic ( const char * base , const char * topic ) { int token , ret ; char * tmp ; while ( 1 ) { token = prte_show_help_yylex ( ) ; switch ( token ) { case PRTE_SHOW_HELP_PARSE_TOPIC : tmp = strdup ( prte_show_help_yytext ) ; if ( NULL == tmp ) { return PRTE_ERR_OUT_OF_RESOURCE ; } tmp [ strlen ( tmp ) - 1 ] = ' \0 ' ; ret = strcmp ( tmp + 1 , topic ) ; free ( tmp ) ; if ( 0 == ret ) { return PRTE_SUCCESS ; } break ; case PRTE_SHOW_HELP_PARSE_MESSAGE : break ; case PRTE_SHOW_HELP_PARSE_DONE : prte_output ( output_stream , " \n \n \n " " \n \n " , dash_line , topic , base , dash_line ) ; return PRTE_ERR_NOT_FOUND ; default : break ; } } }
In the file that has already been opened, find the topic that we're
 supposed to output
In the file that has already been opened find the topic that we ' re supposed to output
/* Examine every topic */ /* Never get here */