From: minima <minima>
Date: Fri, 7 Sep 2001 19:45:22 +0000 (+0000)
Subject: Make all the Prompts in stat/* like output appear in alphebetical order
X-Git-Tag: R_1_48~47
X-Git-Url: http://dxspider.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=2177bb0e95a5ec8797f5a0d47bd2070666a92653;p=spider.git

Make all the Prompts in stat/* like output appear in alphebetical order
---

diff --git a/Changes b/Changes
index ea3cff07..b1fd8ff0 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
 06Sep01=======================================================================
 1. prevent nodes appearing as users from incoming PC16s
 2. Change ping averaging to be like TCP and become a smoothed RTT.
+3. Make all the Prompts in stat/* like output appear in alphebetical order
 04Sep01=======================================================================
 1. add delete/user command
 03Sep01=======================================================================
diff --git a/perl/DXUtil.pm b/perl/DXUtil.pm
index 10b35387..2c814ea3 100644
--- a/perl/DXUtil.pm
+++ b/perl/DXUtil.pm
@@ -183,6 +183,14 @@ sub parraypairs
 	return $out;
 }
 
+sub _sort_fields
+{
+	my $ref = shift;
+	my @a = split /,/, $ref->field_prompt(shift); 
+	my @b = split /,/, $ref->field_prompt(shift); 
+	return lc $a[1] cmp lc $b[1];
+}
+
 # print all the fields for a record according to privilege
 #
 # The prompt record is of the format '<priv>,<prompt>[,<action>'
@@ -198,7 +206,7 @@ sub print_all_fields
 	my $width = $self->width - 1;
 	$width ||= 80;
 
-	foreach $field (sort {$ref->field_prompt($a) cmp $ref->field_prompt($b)} @fields) {
+	foreach $field (sort {_sort_fields($ref, $a, $b)} @fields) {
 		if (defined $ref->{$field}) {
 			my ($priv, $ans) = promptf($ref->field_prompt($field), $ref->{$field});
 			my @tmp;