|
| 1 | +#!/usr/bin/perl |
| 2 | +#*************************************************************************** |
| 3 | +# _ _ ____ _ |
| 4 | +# Project ___| | | | _ \| | |
| 5 | +# / __| | | | |_) | | |
| 6 | +# | (__| |_| | _ <| |___ |
| 7 | +# \___|\___/|_| \_\_____| |
| 8 | +# |
| 9 | +# Copyright (C) Daniel Stenberg, <[email protected]>, et al. |
| 10 | +# |
| 11 | +# This software is licensed as described in the file COPYING, which |
| 12 | +# you should have received as part of this distribution. The terms |
| 13 | +# are also available at https://curl.se/docs/copyright.html. |
| 14 | +# |
| 15 | +# You may opt to use, copy, modify, merge, publish, distribute and/or sell |
| 16 | +# copies of the Software, and permit persons to whom the Software is |
| 17 | +# furnished to do so, under the terms of the COPYING file. |
| 18 | +# |
| 19 | +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 20 | +# KIND, either express or implied. |
| 21 | +# |
| 22 | +# SPDX-License-Identifier: curl |
| 23 | +# |
| 24 | +########################################################################### |
| 25 | + |
| 26 | +# symbols-in-versions |
| 27 | +my $siv = $ARGV[0]; |
| 28 | + |
| 29 | +# sort by version |
| 30 | +my $bynumber = $ARGV[1]; |
| 31 | + |
| 32 | +my $html = "manpage.html"; |
| 33 | +my $changelog = "/changes.html"; |
| 34 | + |
| 35 | +print "<table>\n"; |
| 36 | +print "<tr><th>Name</th>". |
| 37 | + "<th>Added</th>". |
| 38 | + "<th>Deprecated</th>". |
| 39 | + "<th>Last</th>". |
| 40 | + "</tr>\n"; |
| 41 | + |
| 42 | +sub vernum { |
| 43 | + my ($ver)= @_; |
| 44 | + my @a = split(/\./, $ver); |
| 45 | + return $a[0] * 10000 + $a[1] * 100 + $a[2]; |
| 46 | +} |
| 47 | + |
| 48 | +sub verlink { |
| 49 | + my ($v)=@_; |
| 50 | + if($v && ($v ne "-")) { |
| 51 | + my $link = $v; |
| 52 | + $link =~ s/\./_/g; |
| 53 | + return "<a href=\"$changelog#$link\">$v</a>"; |
| 54 | + } |
| 55 | + return ""; |
| 56 | +} |
| 57 | + |
| 58 | +open(O, "<$siv"); |
| 59 | +while(<O>) { |
| 60 | + chomp; |
| 61 | + if($_ =~ /^(\S+) +([0-9.]+) *([^ ]*) *([0-9.]*)/) { |
| 62 | + my ($sym, $intro, $depr, $last) = ($1, $2, $3, $4); |
| 63 | + push @syms, $sym; |
| 64 | + $sintro{$sym}=$intro; |
| 65 | + $sdepr{$sym}=$depr; |
| 66 | + $slast{$sym}=$last; |
| 67 | + } |
| 68 | +} |
| 69 | +close(O); |
| 70 | + |
| 71 | +my @sorted; |
| 72 | +if($bynumber) { |
| 73 | + @sorted = reverse sort {vernum($sintro{$a}) <=> vernum($sintro{$b})} @syms; |
| 74 | +} |
| 75 | +else { |
| 76 | + # byname |
| 77 | + @sorted = sort @syms; |
| 78 | +} |
| 79 | + |
| 80 | +for my $s (@sorted) { |
| 81 | + printf "<tr><td>$s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", |
| 82 | + verlink($sintro{$s}), |
| 83 | + verlink($sdepr{$s}), |
| 84 | + verlink($slast{$s}); |
| 85 | +} |
| 86 | +print "</table>\n"; |
0 commit comments