This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CGI sample run into dead loop in NDK

Other Parts Discussed in Thread: SYSBIOS

Hello TI,

I was trying to run the CGI program sample with SYSBIOS(6.40.3.39) and NDK(2.24.0.11). I follow the sample discribed in NDK user manual chapter append E. It can jumpped into cgisample program but get into deadloop in function 

parseIndex = 0;
buffer[ContentLength] = '\0';
// Process request variables until there are none left to do
{
key = cgiParseVars( buffer, &parseIndex );
value = cgiParseVars( buffer, &parseIndex );
if( !strcmp("name", key) )
name = value;
else if( !strcmp("pizza", key) )
pizza = value;
else if( !strcmp("spam", key) )
spam = value;
else if( !strcmp("color", key) )
color = value;
} while ( parseIndex != -1 );

I also tried to debug into this function but looks like it is just dead loop on "while" sentence but the program in while is not carryout any more I dont know why.

Could anyone help?Thank you!!

  • Hi Bin,

    Are you missing a "do" statement in the do-while loop above? Or, is it just a typo in the post? If it is not a typo, please add the "do" statement. For example:

    // Process request variables until there are none left
    do
    {
    key = cgiParseVars( buffer, &parseIndex );
    value = cgiParseVars( buffer, &parseIndex );

    if( !strcmp("name", key) )
    name = value;
    else if( !strcmp("pizza", key) )
    pizza = value;
    else if( !strcmp("spam", key) )
    spam = value;
    else if( !strcmp("color", key) )
    color = value;
    } while ( parseIndex != -1 );

    Vikram