2
0

version-scan.pl 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/usr/bin/env perl
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) 2010 - 2022, 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 %manversion;
  34. my %headerversion;
  35. my $error;
  36. open(M, "<$manpage");
  37. while(<M>) {
  38. if($_ =~ /^.ip (CURL_VERSION_[A-Z0-9_]+)/i) {
  39. $manversion{$1}++;
  40. }
  41. }
  42. close(M);
  43. open(H, "<$header");
  44. while(<H>) {
  45. if($_ =~ /^\#define (CURL_VERSION_[A-Z0-9_]+)/i) {
  46. $headerversion{$1}++;
  47. }
  48. }
  49. close(H);
  50. for my $h (keys %headerversion) {
  51. if(!$manversion{$h}) {
  52. print STDERR "$manpage: missing $h\n";
  53. $error++;
  54. }
  55. }
  56. for my $h (keys %manversion) {
  57. if(!$headerversion{$h}) {
  58. print STDERR "$manpage: $h is not in the header!\n";
  59. $error++;
  60. }
  61. }
  62. exit $error;