From e18771bf8f06cee00ff99bb8b342875a7e0a2031 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 23 Mar 2024 15:52:17 +0100 Subject: [PATCH] general-functions.pl: Remove unused srtarray function Signed-off-by: Michael Tremer --- config/cfgroot/general-functions.pl | 81 ----------------------------- 1 file changed, 81 deletions(-) diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 082db9186..8d0aaea81 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -877,87 +877,6 @@ sub findhasharraykey { } } -sub srtarray -# Darren Critchley - darrenc@telus.net - (c) 2003 -# &srtarray(SortOrder, AlphaNumeric, SortDirection, ArrayToBeSorted) -# This subroutine will take the following parameters: -# ColumnNumber = the column which you want to sort on, starts at 1 -# AlphaNumberic = a or n (lowercase) defines whether the sort should be alpha or numberic -# SortDirection = asc or dsc (lowercase) Ascending or Descending sort -# ArrayToBeSorted = the array that wants sorting -# -# Returns an array that is sorted to your specs -# -# If SortOrder is greater than the elements in array, then it defaults to the first element -# -{ - my ($colno, $alpnum, $srtdir, @tobesorted) = @_; - my @tmparray; - my @srtedarray; - my $line; - my $newline; - my $ctr; - my $ttlitems = scalar @tobesorted; # want to know the number of rows in the passed array - if ($ttlitems < 1){ # if no items, don't waste our time lets leave - return (@tobesorted); - } - my @tmp = split(/\,/,$tobesorted[0]); - $ttlitems = scalar @tmp; # this should be the number of elements in each row of the passed in array - - # Darren Critchley - validate parameters - if ($colno > $ttlitems){$colno = '1';} - $colno--; # remove one from colno to deal with arrays starting at 0 - if($colno < 0){$colno = '0';} - if ($alpnum ne '') { $alpnum = lc($alpnum); } else { $alpnum = 'a'; } - if ($srtdir ne '') { $srtdir = lc($srtdir); } else { $srtdir = 'src'; } - - foreach $line (@tobesorted) - { - chomp($line); - if ($line ne '') { - my @temp = split(/\,/,$line); - # Darren Critchley - juggle the fields so that the one we want to sort on is first - my $tmpholder = $temp[0]; - $temp[0] = $temp[$colno]; - $temp[$colno] = $tmpholder; - $newline = ""; - for ($ctr=0; $ctr < $ttlitems ; $ctr++) { - $newline=$newline . $temp[$ctr] . ","; - } - chop($newline); - push(@tmparray,$newline); - } - } - if ($alpnum eq 'n') { - @tmparray = sort {$a <=> $b} @tmparray; - } else { - @tmparray = (sort @tmparray); - } - foreach $line (@tmparray) - { - chomp($line); - if ($line ne '') { - my @temp = split(/\,/,$line); - my $tmpholder = $temp[0]; - $temp[0] = $temp[$colno]; - $temp[$colno] = $tmpholder; - $newline = ""; - for ($ctr=0; $ctr < $ttlitems ; $ctr++){ - $newline=$newline . $temp[$ctr] . ","; - } - chop($newline); - push(@srtedarray,$newline); - } - } - - if ($srtdir eq 'dsc') { - @tmparray = reverse(@srtedarray); - return (@tmparray); - } else { - return (@srtedarray); - } -} - sub FetchPublicIp { my %proxysettings; &General::readhash("${General::swroot}/proxy/settings", \%proxysettings); -- 2.39.5