From owner-svn-doc-head@freebsd.org Sun May 12 18:57:21 2019 Return-Path: Delivered-To: svn-doc-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 07E28159F1AF; Sun, 12 May 2019 18:57:21 +0000 (UTC) (envelope-from wosch@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9DB5C83E71; Sun, 12 May 2019 18:57:20 +0000 (UTC) (envelope-from wosch@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 583862EA3E; Sun, 12 May 2019 18:57:20 +0000 (UTC) (envelope-from wosch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4CIvKg5087041; Sun, 12 May 2019 18:57:20 GMT (envelope-from wosch@FreeBSD.org) Received: (from wosch@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4CIvKEv087040; Sun, 12 May 2019 18:57:20 GMT (envelope-from wosch@FreeBSD.org) Message-Id: <201905121857.x4CIvKEv087040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wosch set sender to wosch@FreeBSD.org using -f From: Wolfram Schneider Date: Sun, 12 May 2019 18:57:20 +0000 (UTC) To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r53009 - head/en_US.ISO8859-1/htdocs/cgi X-SVN-Group: doc-head X-SVN-Commit-Author: wosch X-SVN-Commit-Paths: head/en_US.ISO8859-1/htdocs/cgi X-SVN-Commit-Revision: 53009 X-SVN-Commit-Repository: doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9DB5C83E71 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.967,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-doc-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the doc tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 May 2019 18:57:21 -0000 Author: wosch Date: Sun May 12 18:57:19 2019 New Revision: 53009 URL: https://svnweb.freebsd.org/changeset/doc/53009 Log: sort versions with major.minor.patch number, e.g.: 5.1.1 <> 5.2.2 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 Sun May 12 18:25:31 2019 (r53008) +++ head/en_US.ISO8859-1/htdocs/cgi/man.cgi Sun May 12 18:57:19 2019 (r53009) @@ -672,7 +672,7 @@ $manPathDefault = 'FreeBSD 12.0-RELEASE and Ports'; 'HP-UX 10.01', "$manLocalDir/HP-UX-10.01", 'HP-UX 9.07', "$manLocalDir/HP-UX-9.07", - 'IRIX-6.5.30', "$manLocalDir/IRIX-6.5.30/catman/a_man:$manLocalDir/IRIX-6.5.30/catman/p_man:$manLocalDir/IRIX-6.5.30/catman/u_man:$manLocalDir/IRIX-6.5.30/dt", + 'IRIX 6.5.30', "$manLocalDir/IRIX-6.5.30/catman/a_man:$manLocalDir/IRIX-6.5.30/catman/p_man:$manLocalDir/IRIX-6.5.30/catman/u_man:$manLocalDir/IRIX-6.5.30/dt", 'SunOS 5.10', "$manLocalDir/SunOS-5.10", 'SunOS 5.9', "$manLocalDir/SunOS-5.9", @@ -911,18 +911,53 @@ sub sort_versions { my @b = ( lc($b) =~ m,^(\D+)([\d\.]+)(\D*)$, ); if (@a and @b) { - return $a[0] cmp $b[0] || (-1 * ($a[1] <=> $b[1])) || $a[2] cmp $a[2] || $a cmp $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 } # 2.9.1 BSD - @a = ( lc($a) =~ m,^(\d\.+)(.*)$, ); - @b = ( lc($b) =~ m,^(\d\.+)(.*)$, ); + @a = ( lc($a) =~ m,^([\d\.]+)(.*)$, ); + @b = ( lc($b) =~ m,^([\d\.]+)(.*)$, ); if (@a and @b) { - return (-1 * ( $a[0] <=> $b[0])) || $a[1] <=> $b[1] || $a cmp $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 { + return &version_compare(@_) * -1; +} + +# compare two versions, e.g.: 5.1.1 <> 5.2.2 +sub version_compare { + my $a = shift; + my $b = shift; + + my @a = split( '\.', $a ); + my @b = split( '\.', $b ); + + my $max = @a >= @b ? @a : @b; + + for ( my $i = 0 ; $i < $max ; $i++ ) { + + # 5.1 <=> 5.1.1 + return -1 if !defined $a[$i]; + + # 5.1.1 <=> 5.1 + return +1 if !defined $b[$i]; + + if ( ( $a[$i] <=> $b[$i] ) != 0 ) { + return $a[$i] <=> $b[$i]; + } + } + + return 0; } # FreeBSD manual pages first before any other manual pages