2
0

version-scan.pl 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/env perl
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) 2010 - 2020, 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. ###########################################################################
  23. #
  24. # Verify that curl_version_info.3 documents all the CURL_VERSION_ bits
  25. # from the header.
  26. #
  27. use strict;
  28. use warnings;
  29. my $manpage=$ARGV[0];
  30. my $header=$ARGV[1];
  31. my %manversion;
  32. my %headerversion;
  33. my $error;
  34. open(M, "<$manpage");
  35. while(<M>) {
  36. if($_ =~ /^.ip (CURL_VERSION_[A-Z0-9_]+)/i) {
  37. $manversion{$1}++;
  38. }
  39. }
  40. close(M);
  41. open(H, "<$header");
  42. while(<H>) {
  43. if($_ =~ /^\#define (CURL_VERSION_[A-Z0-9_]+)/i) {
  44. $headerversion{$1}++;
  45. }
  46. }
  47. close(H);
  48. for my $h (keys %headerversion) {
  49. if(!$manversion{$h}) {
  50. print STDERR "$manpage: missing $h\n";
  51. $error++;
  52. }
  53. }
  54. for my $h (keys %manversion) {
  55. if(!$headerversion{$h}) {
  56. print STDERR "$manpage: $h is not in the header!\n";
  57. $error++;
  58. }
  59. }
  60. exit $error;