[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ipcop-svn
Subject:    [Ipcop-svn] SF.net SVN: ipcop:[6931] ipcop/trunk/html/cgi-bin/openvpn.cgi
From:       dotzball () users ! sourceforge ! net
Date:       2013-02-16 15:51:35
Message-ID: E1U6k35-0005D6-Ug () sfp-svn-4 ! v30 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Revision: 6931
          http://ipcop.svn.sourceforge.net/ipcop/?rev=6931&view=rev
Author:   dotzball
Date:     2013-02-16 15:51:35 +0000 (Sat, 16 Feb 2013)
Log Message:
-----------
Sort roadwarrior ip list.

Modified Paths:
--------------
    ipcop/trunk/html/cgi-bin/openvpn.cgi

Modified: ipcop/trunk/html/cgi-bin/openvpn.cgi
===================================================================
--- ipcop/trunk/html/cgi-bin/openvpn.cgi	2013-02-16 15:12:12 UTC (rev 6930)
+++ ipcop/trunk/html/cgi-bin/openvpn.cgi	2013-02-16 15:51:35 UTC (rev 6931)
@@ -1641,10 +1641,21 @@
     <td colspan='3'><select name='ROADWARRIORIP'>
 END
         ;
-        # TODO: sort on IP addresses
-        foreach my $rwip (sort keys %roadwarriorips) {
-            print "<option value='$rwip' $roadwarriorips{$rwip} >$rwip</option>";
-            }
+
+        my @rwipsunsorted =  keys %roadwarriorips;
+        my @rwips = sort {
+            my @a = $a =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/;
+            my @b = $b =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/;
+            $a[0] <=> $b[0]
+            || $a[1] <=> $b[1]
+            || $a[2] <=> $b[2]
+            || $a[3] <=> $b[3]
+
+        } @rwipsunsorted;
+
+        foreach my $rwip (@rwips) {
+            print "<option value='$rwip' $roadwarriorips{$rwip} >$rwip</option>\n";
+        }
         print <<END
         </select></td>
 </tr><tr>

This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.


------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet, 
is your hub for all things parallel software development, from weekly thought 
leadership blogs to news, videos, case studies, tutorials, tech docs, 
whitepapers, evaluation guides, and opinion stories. Check out the most 
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ipcop-svn mailing list
Ipcop-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-svn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic