diff options
| author | Daniil Baturin <daniil@vyos.io> | 2021-01-04 20:20:23 +0200 |
|---|---|---|
| committer | Daniil Baturin <daniil@vyos.io> | 2021-01-04 20:20:23 +0200 |
| commit | 0781812f4cd2fd3af12ce7beaa2fd11266cd4829 (patch) | |
| tree | e53ce702f79a7c0a9dcfa0a26729414f9856019b /scripts/vyatta-cli-expand-var.pl | |
| parent | 54097678f5754780983b01ce632f2750f230a422 (diff) | |
| download | vyatta-cfg-0781812f4cd2fd3af12ce7beaa2fd11266cd4829.tar.gz vyatta-cfg-0781812f4cd2fd3af12ce7beaa2fd11266cd4829.zip | |
Remove unused scripts.
Diffstat (limited to 'scripts/vyatta-cli-expand-var.pl')
| -rwxr-xr-x | scripts/vyatta-cli-expand-var.pl | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/scripts/vyatta-cli-expand-var.pl b/scripts/vyatta-cli-expand-var.pl deleted file mode 100755 index f3bda2d..0000000 --- a/scripts/vyatta-cli-expand-var.pl +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/perl - -# Author: An-Cheng Huang <ancheng@vyatta.com> -# Date: 2007 -# Description: bash expand script - -# **** License **** -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# This code was originally developed by Vyatta, Inc. -# Portions created by Vyatta are Copyright (C) 2006, 2007, 2008 Vyatta, Inc. -# All Rights Reserved. -# **** End License **** - -use strict; -use lib "/opt/vyatta/share/perl5/"; -use Vyatta::Config; - -# expand a variable reference -if ($#ARGV != 0) { - print STDERR "usage: vyatta-cli-expand-var.pl '<var-ref>'\n"; - exit 1; -} - -$_ = $ARGV[0]; - -# basic format check: -# '(' ')' not allowed in reference. -# only allow absolute path for now. -if (!/^\$VAR\(\/([^()]+)\)$/) { - print STDERR "invalid variable reference (invalid format)\n"; - exit 1; -} -$_ = $1; - -my $multi_val = 1; -if (s/^(.*)\/\@\@$/$1/) { - # return list of multi-node values - $multi_val = 1; -} elsif (s/^(.*)\/\@$/$1/) { - # return single value - $multi_val = 0; -} else { - # only allow the above 2 forms for now. - print STDERR "invalid variable reference (invalid value specification)\n"; - exit 1; -} - -if (/\@/) { - # '@' not allowed anywhere else in the reference for now. - print STDERR "invalid variable reference (extra value specification)\n"; - exit 1; -} - -my $config = new Vyatta::Config; -my $path_str = join ' ', (split /\//); -my $val_str = ""; -if ($multi_val) { - my @tmp = $config->returnOrigValues($path_str); - if (scalar(@tmp) > 0) { - # we got multiple values back - $val_str = join ' ', @tmp; - } else { - # this node may be a 'tag' node. try listing children. - $config->setLevel($path_str); - @tmp = $config->listOrigNodes(); - $val_str = join ' ', @tmp; - } -} else { - $val_str = $config->returnOrigValue($path_str); -} - -# expanded string is printed on stdout (multiple values separated by ' '). -print "$val_str"; -exit 0; - |
