2
0

mksymbolsmanpage.pl 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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. Protocol:
  42. - All
  43. See-also:
  44. - libcurl (3)
  45. - libcurl-easy (3)
  46. - libcurl-multi (3)
  47. - libcurl-security (3)
  48. - libcurl-thread (3)
  49. Added-in: n/a
  50. ---
  51. # libcurl symbols
  52. This man page details version information for public symbols provided in the
  53. libcurl header files. This lists the first version in which the symbol was
  54. introduced and for some symbols two additional information pieces:
  55. The first version in which the symbol is marked "deprecated" - meaning that
  56. since that version no new code should be written to use the symbol as it is
  57. marked for getting removed in a future.
  58. The last version that featured the specific symbol. Using the symbol in source
  59. code makes it no longer compile error-free after that specified version.
  60. This man page is automatically generated from the symbols-in-versions file.
  61. HEADER
  62. ;
  63. sub nameref {
  64. my ($n)=@_;
  65. if($n =~ /^CURLOPT_/) {
  66. if($n eq "CURLOPT_RTSPHEADER") {
  67. $n = "CURLOPT_HTTPHEADER";
  68. }
  69. elsif($n eq "CURLOPT_WRITEHEADER") {
  70. $n = "CURLOPT_HEADERDATA";
  71. }
  72. elsif($n eq "CURLOPT_WRITEINFO") {
  73. ; # now obsolete
  74. }
  75. else {
  76. return "$n(3)";
  77. }
  78. }
  79. elsif($n =~ /^CURLMOPT_/) {
  80. return "$n(3)";
  81. }
  82. elsif($n =~ /^CURLINFO_/) {
  83. my %infotypes = (
  84. 'CURLINFO_TEXT' => 1,
  85. 'CURLINFO_HEADER_IN' => 1,
  86. 'CURLINFO_HEADER_OUT' => 1,
  87. 'CURLINFO_DATA_IN' => 1,
  88. 'CURLINFO_DATA_OUT' => 1,
  89. 'CURLINFO_SSL_DATA_IN' => 1,
  90. 'CURLINFO_SSL_DATA_OUT' => 1,
  91. );
  92. if($infotypes{$n}) {
  93. return "CURLOPT_DEBUGFUNCTION(3)";
  94. }
  95. }
  96. elsif($n =~ /^CURLALTSVC_/) {
  97. return "CURLOPT_ALTSVC_CTRL(3)";
  98. }
  99. elsif($n =~ /^CURLAUTH_/) {
  100. return "CURLOPT_HTTPAUTH(3)";
  101. }
  102. elsif($n =~ /^CURLFORM_/) {
  103. return "curl_formadd(3)";
  104. }
  105. elsif($n =~ /^CURLKH/) {
  106. return "CURLOPT_SSH_KEYFUNCTION(3)";
  107. }
  108. elsif($n =~ /^CURLE_/) {
  109. return "libcurl-errors(3)";
  110. }
  111. elsif($n =~ /^CURLM_/) {
  112. return "libcurl-errors(3)";
  113. }
  114. elsif($n =~ /^CURLUE_/) {
  115. return "libcurl-errors(3)";
  116. }
  117. elsif($n =~ /^CURLHE_/) {
  118. return "libcurl-errors(3)";
  119. }
  120. elsif($n =~ /^CURLSHE_/) {
  121. return "libcurl-errors(3)";
  122. }
  123. elsif($n =~ /^CURLPROTO_/) {
  124. return "CURLINFO_PROTOCOL(3)";
  125. }
  126. elsif($n =~ /^CURLPX_/) {
  127. return "CURLINFO_PROXY_ERROR(3)";
  128. }
  129. elsif($n =~ /^CURLPROXY_/) {
  130. return "CURLOPT_PROXYTYPE(3)";
  131. }
  132. elsif($n =~ /^CURLSSLBACKEND_/) {
  133. return "curl_global_sslset(3)";
  134. }
  135. elsif($n =~ /^CURLSSLOPT_/) {
  136. return "CURLOPT_SSL_OPTIONS(3)";
  137. }
  138. elsif($n =~ /^CURLSSLSET_/) {
  139. return "curl_global_sslset(3)";
  140. }
  141. elsif($n =~ /^CURLUPART_/) {
  142. return "curl_url_get(3)";
  143. }
  144. elsif($n =~ /^CURLU_/) {
  145. return "curl_url_get(3)";
  146. }
  147. elsif($n =~ /^CURLVERSION_/) {
  148. return "curl_version_info(3)";
  149. }
  150. elsif($n =~ /^CURLSHOPT_/) {
  151. if($n eq "CURLSHOPT_NONE") {
  152. $n = "curl_share_setopt";
  153. }
  154. return "$n(3)";
  155. }
  156. elsif($n =~ /^CURLWS_/) {
  157. return "curl_ws_send(3)";
  158. }
  159. elsif($n =~ /^CURL_FORMADD_/) {
  160. return "curl_formadd(3)";
  161. }
  162. elsif($n =~ /^CURL_HTTPPOST_/) {
  163. return "curl_formadd(3)";
  164. }
  165. elsif($n =~ /^CURL_GLOBAL_/) {
  166. return "curl_global_init(3)";
  167. }
  168. elsif($n =~ /^CURL_HTTP_VERSION_/) {
  169. return "CURLOPT_HTTP_VERSION(3)";
  170. }
  171. elsif($n =~ /^CURL_LOCK_/) {
  172. return "CURLSHOPT_SHARE(3)";
  173. }
  174. elsif($n =~ /^CURL_SSLVERSION_/) {
  175. return "CURLOPT_SSLVERSION(3)";
  176. }
  177. elsif($n =~ /^CURL_VERSION_/) {
  178. return "curl_version_info(3)";
  179. }
  180. elsif($n =~ /^CURL_RTSPREQ_/) {
  181. return "CURLOPT_RTSP_REQUEST(3)";
  182. }
  183. elsif($n =~ /^CURLH_/) {
  184. return "curl_easy_header(3)";
  185. }
  186. elsif($n =~ /^CURL_TRAILERFUNC_/) {
  187. return "CURLOPT_TRAILERFUNCTION(3)";
  188. }
  189. elsif($n =~ /^CURLOT_/) {
  190. return "curl_easy_option_next(3)";
  191. }
  192. elsif($n =~ /^CURLFINFOFLAG_/) {
  193. return "CURLOPT_CHUNK_BGN_FUNCTION(3)";
  194. }
  195. elsif($n =~ /^CURLFILETYPE_/) {
  196. return "CURLOPT_CHUNK_BGN_FUNCTION(3)";
  197. }
  198. elsif($n =~ /^CURL_CHUNK_BGN_FUNC_/) {
  199. return "CURLOPT_CHUNK_BGN_FUNCTION(3)";
  200. }
  201. elsif($n =~ /^CURL_CHUNK_END_FUNC_/) {
  202. return "CURLOPT_CHUNK_END_FUNCTION(3)";
  203. }
  204. elsif($n =~ /^CURLSSH_AUTH_/) {
  205. return "CURLOPT_SSH_AUTH_TYPES(3)";
  206. }
  207. elsif($n =~ /^CURL_POLL_/) {
  208. return "CURLMOPT_SOCKETFUNCTION(3)";
  209. }
  210. elsif($n =~ /^CURLMSG_/) {
  211. return "curl_multi_info_read(3)";
  212. }
  213. elsif($n =~ /^CURLFTPAUTH_/) {
  214. return "CURLOPT_FTPSSLAUTH(3)";
  215. }
  216. elsif($n =~ /^CURLFTPMETHOD_/) {
  217. return "CURLOPT_FTP_FILEMETHOD(3)";
  218. }
  219. elsif($n =~ /^CURLFTPSSL_/) {
  220. return "CURLOPT_USE_SSL(3)";
  221. }
  222. elsif($n =~ /^CURLFTP_CREATE_/) {
  223. return "CURLOPT_FTP_CREATE_MISSING_DIRS(3)";
  224. }
  225. elsif($n =~ /^CURLGSSAPI_DELEGATION_/) {
  226. return "CURLOPT_GSSAPI_DELEGATION(3)";
  227. }
  228. elsif($n =~ /^CURLHEADER_/) {
  229. return "CURLOPT_HEADEROPT(3)";
  230. }
  231. elsif($n =~ /^CURLHSTS_/) {
  232. return "CURLOPT_HSTS_CTRL(3)";
  233. }
  234. elsif($n =~ /^CURLIOCMD_/) {
  235. return "CURLOPT_IOCTLFUNCTION(3)";
  236. }
  237. elsif($n =~ /^CURLIOE_/) {
  238. return "CURLOPT_IOCTLFUNCTION(3)";
  239. }
  240. elsif($n =~ /^CURLMIMEOPT_/) {
  241. return "CURLOPT_MIME_OPTIONS(3)";
  242. }
  243. elsif($n =~ /^CURLPAUSE_/) {
  244. return "curl_easy_pause(3)";
  245. }
  246. elsif($n =~ /^CURLPIPE_/) {
  247. return "CURLMOPT_PIPELINING(3)";
  248. }
  249. elsif($n =~ /^CURLSOCKTYPE_/) {
  250. return "CURLOPT_SOCKOPTFUNCTION(3)";
  251. }
  252. elsif($n =~ /^CURLSTS_/) {
  253. return "CURLOPT_HSTSREADFUNCTION(3)";
  254. }
  255. elsif($n =~ /^CURLUSESSL_/) {
  256. return "CURLOPT_USE_SSL(3)";
  257. }
  258. elsif($n =~ /^CURL_CSELECT_/) {
  259. return "curl_multi_socket_action(3)";
  260. }
  261. elsif($n =~ /^CURL_FNMATCHFUNC_/) {
  262. return "CURLOPT_FNMATCH_FUNCTION(3)";
  263. }
  264. elsif($n =~ /^CURL_HET_/) {
  265. return "CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS(3)";
  266. }
  267. elsif($n =~ /^CURL_IPRESOLVE_/) {
  268. return "CURLOPT_IPRESOLVE(3)";
  269. }
  270. elsif($n =~ /^CURL_SEEKFUNC_/) {
  271. return "CURLOPT_SEEKFUNCTION(3)";
  272. }
  273. elsif($n =~ /^CURL_TIMECOND_/) {
  274. return "CURLOPT_TIMECONDITION(3)";
  275. }
  276. elsif($n =~ /^CURL_REDIR_POST_/) {
  277. return "CURLOPT_POSTREDIR(3)";
  278. }
  279. }
  280. while(<STDIN>) {
  281. if($_ =~ /^(CURL[A-Z0-9_.]*) *(.*)/i) {
  282. my ($symbol, $rest)=($1,$2);
  283. my ($intro, $dep, $rem);
  284. if($rest =~ s/^([0-9.]*) *//) {
  285. $intro = $1;
  286. }
  287. if($rest =~ s/^([0-9.]*) *//) {
  288. $dep = $1;
  289. }
  290. if($rest =~ s/^- *([0-9.]*)//) {
  291. $rem = $1;
  292. }
  293. print "\n## $symbol\nIntroduced in $intro.";
  294. if($dep) {
  295. print " Deprecated since $dep.";
  296. }
  297. if($rem) {
  298. print " Last used in $rem.";
  299. }
  300. my $see = $rem || $dep ? "" : nameref($symbol);
  301. if($see) {
  302. print " See $see.";
  303. }
  304. print "\n";
  305. }
  306. }