]> git.ipfire.org Git - people/ms/ipfire-2.x.git/commitdiff
general-functions.pl: Remove unused srtarray function
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 23 Mar 2024 14:52:17 +0000 (15:52 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 27 Apr 2024 17:34:04 +0000 (19:34 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/general-functions.pl

index 3504814416c273d51c8c8800b357a096fc9edcda..cd08637e1e1782d4110875e7087e2381536f24ec 100644 (file)
@@ -892,87 +892,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);