summaryrefslogtreecommitdiff
path: root/scripts/vyatta-find-type.pl
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2007-09-25 15:55:26 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2007-09-25 15:55:26 -0700
commite9a79a249cec69fc178098d2f75db9389068510a (patch)
tree0e366094b7fecd3988c243fbbb574015e0c900c8 /scripts/vyatta-find-type.pl
downloadvyatta-cfg-upstream.tar.gz
vyatta-cfg-upstream.zip
initial import (from eureka /cli) plus new build system.upstream
Diffstat (limited to 'scripts/vyatta-find-type.pl')
-rwxr-xr-xscripts/vyatta-find-type.pl21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/vyatta-find-type.pl b/scripts/vyatta-find-type.pl
new file mode 100755
index 0000000..b6514f0
--- /dev/null
+++ b/scripts/vyatta-find-type.pl
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+use strict;
+use lib "/opt/vyatta/share/perl5/";
+use VyattaTypeChecker;
+
+# find the type of a value (from a list of candidates)
+if ($#ARGV < 1) {
+ print "usage: vyatta-find-type.pl <value> <type> [<type> ...]\n";
+ exit 1;
+}
+
+if (my $type = VyattaTypeChecker::findType(@ARGV)) {
+ # type found
+ print "$type";
+ exit 0;
+}
+
+# value not valid for any of the candidates
+exit 1;
+