mksymbolsmanpage.pl 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. use POSIX qw(strftime);
  26. my @ts;
  27. if (defined($ENV{SOURCE_DATE_EPOCH})) {
  28. @ts = localtime($ENV{SOURCE_DATE_EPOCH});
  29. } else {
  30. @ts = localtime;
  31. }
  32. my $date = strftime "%b %e, %Y", @ts;
  33. my $year = strftime "%Y", @ts;
  34. print <<HEADER
  35. ---
  36. c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  37. SPDX-License-Identifier: curl
  38. Title: libcurl-symbols
  39. Section: 3
  40. Source: libcurl
  41. See-also:
  42. - libcurl (3)
  43. - libcurl-easy (3)
  44. - libcurl-multi (3)
  45. - libcurl-security (3)
  46. - libcurl-thread (3)
  47. ---
  48. # libcurl symbols
  49. This man page details version information for public symbols provided in the
  50. libcurl header files. This lists the first version in which the symbol was
  51. introduced and for some symbols two additional information pieces:
  52. The first version in which the symbol is marked "deprecated" - meaning that
  53. since that version no new code should be written to use the symbol as it is
  54. marked for getting removed in a future.
  55. The last version that featured the specific symbol. Using the symbol in source
  56. code will make it no longer compile error-free after that specified version.
  57. This man page is automatically generated from the symbols-in-versions file.
  58. HEADER
  59. ;
  60. while(<STDIN>) {
  61. if($_ =~ /^(CURL[A-Z0-9_.]*) *(.*)/i) {
  62. my ($symbol, $rest)=($1,$2);
  63. my ($intro, $dep, $rem);
  64. if($rest =~ s/^([0-9.]*) *//) {
  65. $intro = $1;
  66. }
  67. if($rest =~ s/^([0-9.]*) *//) {
  68. $dep = $1;
  69. }
  70. if($rest =~ s/^([0-9.]*) *//) {
  71. $rem = $1;
  72. }
  73. print "\n## $symbol\nIntroduced in $intro.";
  74. if($dep) {
  75. print " Deprecated since $dep.";
  76. }
  77. if($rem) {
  78. print " Last used in $rem.";
  79. }
  80. print "\n";
  81. }
  82. }