- other license provided by project originators
*******************************************************************/
-#include <inttypes.h>
+#include <stdint.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
}
/**
+ * Process a command line
+ *
+ * @param cmd_io I/O stack
+ * @param des_arr Pointer to the command descriptors.
+ * @param line Command line to process.
*
* @return Zero if no command was given in line, -CMDERR_BADCMD if
* command is not known or has no function assigned to it. If a
var=NULL;
while(*r){
while((*p==*r)&&i){i--;r++;p++;};
- if((i==0)&&!*r) break; /* We've found the command */
- if((*r=='?')&&i){
+ if((i==0)&&!*r) break; /* We've found the command (full match) */
+ if((*r=='?')&&i){ /* '?' stands for an arbitrary character */
if(!var) var=p;
p++; r++; i--;
continue;
}
- if((*r=='#')&&i&&isdigit((uint8_t)*p)){
+ if((*r=='#')&&i&&isdigit((uint8_t)*p)){ /* '#' stands for a digit */
if(!var) var=p;
p++; r++; i--;
continue;
}
- if(*r=='*'){
+ if(*r=='*'){ /* '*' stands for any number of any characters */
if(!var) var=p;
i=0;
break;
}
- i=1;
+ i=1; /* Signal no match */
break;
}
if(i!=0) continue; /* Try next command */
+ /* Setup parameters */
if(des->mode&CDESM_OPCHR){
if(!param[2])continue;
if(!*param[2])continue;