X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=test_src%2Fcli.c;h=37bbb25490b294b6889a59428aa8e62d4a37ea36;hb=6718048fd9038c98523eae722545bb0279e0bc21;hp=f01547d03ddf07200e9d0f5c9f7db005530437b6;hpb=3a571bf2d55c87a3d08641f7df7681c923717eb1;p=avr-crypto-lib.git diff --git a/test_src/cli.c b/test_src/cli.c index f01547d..37bbb25 100644 --- a/test_src/cli.c +++ b/test_src/cli.c @@ -75,19 +75,16 @@ void cli_auto_help_P(PGM_P dbzstr){ #endif int16_t execcommand_d0_P(const char* str, PGM_P v, void(*fpt[])(void) ){ - uint8_t i=0; - PGM_P commands=v; - while(pgm_read_byte(v)){ - if(!strcmp_P(str, v)){ - (fpt[i])(); - return i; - } - while(pgm_read_byte(v++)) /* go to the next string */ - ; - ++i; + int16_t i=0; + i=findstring_d0_P(str, v); + if(i!=-1){ + if(fpt[i]) + fpt[i](); + return i; + }else{ + cli_auto_help_P(v); + return -1; } - cli_auto_help_P(commands); - return -1; }