summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-show-dmesg4
-rwxr-xr-xscripts/vyatta-show-dmesg-all9
-rw-r--r--scripts/vyatta-show-interfaces.pl35
-rwxr-xr-xscripts/vyatta-show-log4
-rwxr-xr-xscripts/vyatta-show-log-all9
-rwxr-xr-xscripts/vyatta-show-log-file13
6 files changed, 35 insertions, 39 deletions
diff --git a/scripts/vyatta-show-dmesg b/scripts/vyatta-show-dmesg
deleted file mode 100755
index 8a53a94..0000000
--- a/scripts/vyatta-show-dmesg
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-cat /var/log/dmes? /dev/null
-
diff --git a/scripts/vyatta-show-dmesg-all b/scripts/vyatta-show-dmesg-all
deleted file mode 100755
index d511ea0..0000000
--- a/scripts/vyatta-show-dmesg-all
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-shopt -s extglob nullglob
-
-declare -a zipped_files=($( printf "%s\n" /var/log/dmesg*.gz | sort -r ))
-declare -a plain_files=($( printf "%s\n" /var/log/dmesg!(*.gz) | sort -r ))
-
-[ ${#zipped_files[@]} -gt 0 ] && gunzip --stdout ${zipped_files[@]}
-[ ${#plain_files[@]} -gt 0 ] && cat ${plain_files[@]}
diff --git a/scripts/vyatta-show-interfaces.pl b/scripts/vyatta-show-interfaces.pl
index 092f147..0ec5d3e 100644
--- a/scripts/vyatta-show-interfaces.pl
+++ b/scripts/vyatta-show-interfaces.pl
@@ -335,6 +335,39 @@ sub run_reset_intf {
}
}
+sub alphanum_split {
+ my ($str) = @_;
+ my @list = split m/(?=(?<=\D)\d|(?<=\d)\D)/, $str;
+ return @list;
+}
+
+sub natural_order {
+ my ($a, $b) = @_;
+ my @a = alphanum_split($a);
+ my @b = alphanum_split($b);
+
+ while (@a && @b) {
+ my $a_seg = shift @a;
+ my $b_seg = shift @b;
+ my $val;
+ if (($a_seg =~ /\d/) && ($b_seg =~ /\d/)) {
+ $val = $a_seg <=> $b_seg;
+ } else {
+ $val = $a_seg cmp $b_seg;
+ }
+ if ($val != 0) {
+ return $val;
+ }
+ }
+ return @a <=> @b;
+}
+
+sub intf_sort {
+ my @a = @_;
+ my @new_a = sort { natural_order($a,$b) } @a;
+ return @new_a;
+}
+
#
# main
@@ -369,6 +402,8 @@ if (! defined $action) {
$action = 'show';
}
+@intf_list = intf_sort(@intf_list);
+
my $func;
if (defined $action_hash{$action}) {
$func = $action_hash{$action};
diff --git a/scripts/vyatta-show-log b/scripts/vyatta-show-log
deleted file mode 100755
index 10e46e5..0000000
--- a/scripts/vyatta-show-log
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-cat /var/log/messages
-
diff --git a/scripts/vyatta-show-log-all b/scripts/vyatta-show-log-all
deleted file mode 100755
index 126b7fc..0000000
--- a/scripts/vyatta-show-log-all
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-shopt -s extglob nullglob
-
-declare -a zipped_files=($( printf "%s\n" /var/log/messages*.gz | sort -r ))
-declare -a plain_files=($( printf "%s\n" /var/log/messages!(*.gz) | sort -r ))
-
-[ ${#zipped_files[@]} -gt 0 ] && gunzip --stdout ${zipped_files[@]}
-[ ${#plain_files[@]} -gt 0 ] && cat ${plain_files[@]}
diff --git a/scripts/vyatta-show-log-file b/scripts/vyatta-show-log-file
deleted file mode 100755
index caf8ac9..0000000
--- a/scripts/vyatta-show-log-file
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-
-if [[ "$1" == */* ]]; then
- echo "Invalid log file name"
- exit 1
-fi
-
-if [ -f "/var/log/user/$1" ]; then
- cat /var/log/user/$1
-else
- echo "No such log file"
-fi
-