[Rt-devel] PATCH: allow rt command to sort multiple object IDs/Names without warnings

Philip Kime pkime at Shopzilla.com
Tue Jun 27 19:44:51 EDT 2006


 Patch is against 3.6.0 rt command.

*** /root/rt-3.6.0.orig	2006-06-15 11:57:07.000000000 -0700
--- /tmp/rt	2006-06-27 17:02:16.541296520 -0700
***************
*** 1339,1345 ****
      }
  
      @elts{@elts}=();
!     return sort {$a<=>$b} keys %elts;
  }
  
  sub get_type_argument {
--- 1339,1360 ----
      }
  
      @elts{@elts}=();
!     return sort {
!     	           if ($a =~ /^\d+$/) {      # $a is numeric ID ...
!     	             if ($b =~ /^\d+$/) {    # ... and $b is a numeric
ID,
!     	             	 $a<=>$b;                     # return digit
comparison result
!     	             }
!                    else {                         # $a is a numeric
ID, $b is an object name ...
!                    	-1;                           # order $a before
$b
!                    }                     
!                  }                                
!                  elsif ($b =~ /^\d+$/) {   # $a is object name, $b is
numeric ID ...
!                  	 1;                             # order $b
before $a
!                  }
!                  else {                           # $a and $b are
object names ...
!                    $a cmp $b;                     # order by string
value
!                  }
!     	 } keys %elts;
  }
  
  sub get_type_argument {


More information about the Rt-devel mailing list