From e3c4ceff84aa0615280c9d64858483b930091586 Mon Sep 17 00:00:00 2001
From: Chris Pavlina <cpavlin1@binghamton.edu>
Date: 周五, 12 12月 2014 17:57:28 +0800
Subject: [PATCH] Added SCPI_IsCmd

---
 libscpi/src/parser.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/libscpi/src/parser.c b/libscpi/src/parser.c
index b4f79ac..122b557 100644
--- a/libscpi/src/parser.c
+++ b/libscpi/src/parser.c
@@ -546,8 +546,8 @@
 /**
  * Parse string parameter
  * @param context
- * @param value
- * @param len
+ * @param value Pointer to string buffer where pointer to non-null terminated string will be returned
+ * @param len Length of returned non-null terminated string
  * @param mandatory
  * @return 
  */
@@ -577,8 +577,8 @@
 /**
  * Parse text parameter (can be inside "")
  * @param context
- * @param value
- * @param len
+ * @param value Pointer to string buffer where pointer to non-null terminated string will be returned
+ * @param len Length of returned non-null terminated string
  * @param mandatory
  * @return 
  */
@@ -675,3 +675,11 @@
     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));
+}

--
Gitblit v1.9.1