svn commit: r53014 - head/en_US.ISO8859-1/htdocs/cgi

Wolfram Schneider <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
Author: wosch
Date: Tue May 14 16:41:31 2019
New Revision: 53014
URL: https://svnweb.freebsd.org/changeset/doc/53014

Log:
  simplify matching of release version numbers

Modified:
  head/en_US.ISO8859-1/htdocs/cgi/man.cgi

Modified: head/en_US.ISO8859-1/htdocs/cgi/man.cgi
==============================================================================
--- head/en_US.ISO8859-1/htdocs/cgi/man.cgi	Tue May 14 05:29:50 2019	(r53013)
+++ head/en_US.ISO8859-1/htdocs/cgi/man.cgi	Tue May 14 16:41:31 2019	(r53014)
@@ -906,28 +906,21 @@ while ( ( $key, $val ) = each %manPath ) {
 #
 sub sort_versions {
 
+    # a release has at least 2 numbers seperated by a dot:
     # FreeBSD 11.1-RELEASE ports
-    my @a = ( lc($a) =~ m,^(\D+)([\d\.]+)(\D*)$, );
-    my @b = ( lc($b) =~ m,^(\D+)([\d\.]+)(\D*)$, );
+    # X11R7.4
+    my @a = ( lc($a) =~ m,^(.*?)(\d+\.[\d\.]+)(.*)$, );
+    my @b = ( lc($b) =~ m,^(.*?)(\d+\.[\d\.]+)(.*)$, );
 
     if (@a and @b) {
 	return $a[0] cmp $b[0]   || # FreeBDS <=> IRIX
 	  &version($a[1], $b[1]) || # 6.5.30 <=> 6.5.31  
 	  $a[2] cmp $a[2] ||        # RELEASE <=> ports 
 	  $a cmp $b;		    # rest
+    } else {
+    	# for the rest: basic string compare
+    	return $a cmp $b;
     }
-
-    # 2.9.1 BSD
-    @a = ( lc($a) =~ m,^([\d\.]+)(.*)$, );
-    @b = ( lc($b) =~ m,^([\d\.]+)(.*)$, );
-    if (@a and @b) {
-	return &version($a[0], $b[0]) || # 2.9.1BSD
-	  $a[1] <=> $b[1] ||             # BSD 
-	  $a cmp $b;			 # rest
-    }
-
-    # rest
-    return $a cmp $b;
 }
 
 sub version {
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-doc-all
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.