// ModeSet.cpp : Defines the entry point for the DLL application.
//

#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "ModeSet.h"

short    ModeIndex = 0;


BOOL getMode( LPCTSTR ModeName, LPTSTR Buffer, long Buffer_size )
{
    char   *p;
    int     total;

    SendPacket( pkt, (LPTSTR) ModeName );
    RecvPacket( pkt );
    
    p = pkt->body.moderesponse.moderesponse;

    total = strcspn( p, " =\t" ); 

    p   += total;
    p   += strspn( p, "= \t" );
    total = strcspn( p, "\n\r\t" );
    
    strncpy( Buffer, p, total );
    Buffer[ total ] = 0;
    ClearTrailingWhiteSpace( Buffer );

    return TRUE;
}


BOOL getNVRamMode( LPCTSTR ModeName, LPTSTR Buffer, long Buffer_size )
{
    int i;

    i = GetNameIndex( ModeName );
    strcpy( Buffer, mode[ i ].NVRamContent );

    return TRUE;
}


BOOL getModeType( LPCTSTR ModeName, LPTSTR Buffer, long Buffer_size )
{	      
    int i;

    i = GetNameIndex( ModeName );
    strcpy( Buffer, mode[ i ].Type );

    return TRUE;
}

BOOL getModeHelp( LPCTSTR ModeName, LPTSTR Buffer, long Buffer_size )
{	      
    int i;

    i = GetNameIndex( ModeName );
    strcpy( Buffer, mode[ i ].Help );

    return TRUE;
}



BOOL getFirstModeName( LPTSTR Buffer, long Buffer_size )
{  
    ModeIndex = 0;
    strcpy( Buffer, mode[ ModeIndex ].Name );

    return TRUE;
}

BOOL getNextModeName( LPTSTR Buffer, long Buffer_size )
{	      
    ModeIndex++;
    strcpy( Buffer, mode[ ModeIndex ].Name );
    return TRUE;
}

