Skip to content

Commit

Permalink
Added SCPI_IsCmd
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Pavlina authored and j123b567 committed Dec 12, 2014
1 parent aa03cdc commit e3c4cef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions libscpi/inc/scpi/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ extern "C" {
int SCPI_Input(scpi_t * context, const char * data, size_t len);
int SCPI_Parse(scpi_t * context, char * data, size_t len);

scpi_bool_t SCPI_IsCmd(scpi_t * context, const char * cmd);

size_t SCPI_ResultString(scpi_t * context, const char * data);
size_t SCPI_ResultInt(scpi_t * context, int32_t val);
Expand Down
8 changes: 8 additions & 0 deletions libscpi/src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,3 +675,11 @@ scpi_bool_t SCPI_ParamChoice(scpi_t * context, const char * options[], int32_t *
return FALSE;
}

scpi_bool_t SCPI_IsCmd(scpi_t * context, const char * cmd) {
if (! context->paramlist.cmd) {
return FALSE;
}

const char * pattern = context->paramlist.cmd->pattern;
return matchCommand (pattern, cmd, strlen (cmd));
}

0 comments on commit e3c4cef

Please sign in to comment.