From 95c385ceffe94eb7216dbb09eb7bb107ae1cf67b Mon Sep 17 00:00:00 2001
From: An-Cheng Huang <ancheng@vyatta.com>
Date: Thu, 12 Aug 2010 17:47:05 -0700
Subject: add more functions to shell API

---
 src/cli_shell_api.cpp | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/cli_shell_api.cpp b/src/cli_shell_api.cpp
index f0ac34f..1a4f469 100644
--- a/src/cli_shell_api.cpp
+++ b/src/cli_shell_api.cpp
@@ -368,6 +368,26 @@ returnEffectiveValues(const vector<string>& args)
   print_vec(vvec, " ", "'");
 }
 
+/* checks if specified path is a valid "template path" *without* checking
+ * the validity of any "tag values" along the path.
+ */
+static void
+validateTmplPath(const vector<string>& args)
+{
+  UnionfsCstore cstore(true);
+  exit(cstore.validateTmplPath(args, false) ? 0 : 1);
+}
+
+/* checks if specified path is a valid "template path", *including* the
+ * validity of any "tag values" along the path.
+ */
+static void
+validateTmplValPath(const vector<string>& args)
+{
+  UnionfsCstore cstore(true);
+  exit(cstore.validateTmplPath(args, true) ? 0 : 1);
+}
+
 #define OP(name, exact, exact_err, min, min_err) \
   { #name, exact, exact_err, min, min_err, &name }
 
@@ -407,6 +427,9 @@ static OpT ops[] = {
   OP(returnActiveValues, -1, NULL, 1, "Must specify config path"),
   OP(returnEffectiveValues, -1, NULL, 1, "Must specify config path"),
 
+  OP(validateTmplPath, -1, NULL, 1, "Must specify config path"),
+  OP(validateTmplValPath, -1, NULL, 1, "Must specify config path"),
+
   {NULL, -1, NULL, -1, NULL, NULL}
 };
 #define OP_exact_args  ops[op_idx].op_exact_args
-- 
cgit v1.2.3