2
0

test1177.pl 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/usr/bin/env perl
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, 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. # Verify that curl_version_info.3 documents all the CURL_VERSION_ bits
  27. # from the header.
  28. #
  29. use strict;
  30. use warnings;
  31. my $manpage=$ARGV[0];
  32. my $header=$ARGV[1];
  33. my $source=$ARGV[2];
  34. my %manversion;
  35. my %headerversion;
  36. my %manname;
  37. my %sourcename;
  38. my $error=0;
  39. open(my $m, "<", "$manpage");
  40. while(<$m>) {
  41. if($_ =~ / mask bit: (CURL_VERSION_[A-Z0-9_]+)/i) {
  42. $manversion{$1}++;
  43. }
  44. if($_ =~ /^\.ip (.*)/i) {
  45. $manname{$1}++;
  46. }
  47. }
  48. close($m);
  49. open(my $h, "<", "$header");
  50. while(<$h>) {
  51. if($_ =~ /^\#define (CURL_VERSION_[A-Z0-9_]+)/i) {
  52. $headerversion{$1}++;
  53. }
  54. }
  55. close($h);
  56. open(my $s, "<", "$source");
  57. while(<$s>) {
  58. if($_ =~ /FEATURE\("([^"]*)"/) {
  59. $sourcename{$1}++;
  60. }
  61. }
  62. close($s);
  63. $sourcename{'NTLM_WB'}++; # deprecated, fake its presence in code
  64. for my $h (keys %headerversion) {
  65. if(!$manversion{$h}) {
  66. print STDERR "$manpage: missing $h\n";
  67. $error++;
  68. }
  69. }
  70. for my $h (keys %manversion) {
  71. if(!$headerversion{$h}) {
  72. print STDERR "$manpage: $h is not in the header!\n";
  73. $error++;
  74. }
  75. }
  76. for my $n (keys %sourcename) {
  77. if(!$manname{$n}) {
  78. print STDERR "$manpage: missing feature name $n\n";
  79. $error++;
  80. }
  81. }
  82. for my $n (keys %manname) {
  83. if(!$sourcename{$n} && ($n ne "\"no name\"")) {
  84. print STDERR "$manpage: $n is not in the source!\n";
  85. $error++;
  86. }
  87. }
  88. exit $error;