cleanspell.pl 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/usr/bin/perl
  2. # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  3. #
  4. # SPDX-License-Identifier: curl
  5. #
  6. # Given: a libcurl curldown man page
  7. # Outputs: the same file, minus the SYNOPSIS and the EXAMPLE sections
  8. #
  9. my $f = $ARGV[0];
  10. open(F, "<$f") or die;
  11. my @out;
  12. my $ignore = 0;
  13. while(<F>) {
  14. if($_ =~ /^# (SYNOPSIS|EXAMPLE)/) {
  15. $ignore = 1;
  16. }
  17. elsif($ignore && ($_ =~ /^# [A-Z]/)) {
  18. $ignore = 0;
  19. }
  20. elsif(!$ignore) {
  21. # **bold**
  22. $_ =~ s/\*\*(\S.*?)\*\*//g;
  23. # *italics*
  24. $_ =~ s/\*(\S.*?)\*//g;
  25. $_ =~ s/CURL(M|SH|U|H)code//g;
  26. $_ =~ s/CURL_[A-Z0-9_]*//g;
  27. $_ =~ s/CURLALTSVC_[A-Z0-9_]*//g;
  28. $_ =~ s/CURLAUTH_[A-Z0-9_]*//g;
  29. $_ =~ s/CURLE_[A-Z0-9_]*//g;
  30. $_ =~ s/CURLFORM_[A-Z0-9_]*//g;
  31. $_ =~ s/CURLFTP_[A-Z0-9_]*//g;
  32. $_ =~ s/CURLFTPAUTH_[A-Z0-9_]*//g;
  33. $_ =~ s/CURLFTPMETHOD_[A-Z0-9_]*//g;
  34. $_ =~ s/CURLFTPSSL_[A-Z0-9_]*//g;
  35. $_ =~ s/CURLGSSAPI_[A-Z0-9_]*//g;
  36. $_ =~ s/CURLHEADER_[A-Z0-9_]*//g;
  37. $_ =~ s/CURLINFO_[A-Z0-9_]*//g;
  38. $_ =~ s/CURLM_[A-Z0-9_]*//g;
  39. $_ =~ s/CURLMIMEOPT_[A-Z0-9_]*//g;
  40. $_ =~ s/CURLMOPT_[A-Z0-9_]*//g;
  41. $_ =~ s/CURLOPT_[A-Z0-9_]*//g;
  42. $_ =~ s/CURLPIPE_[A-Z0-9_]*//g;
  43. $_ =~ s/CURLPROTO_[A-Z0-9_]*//g;
  44. $_ =~ s/CURLPROXY_[A-Z0-9_]*//g;
  45. $_ =~ s/CURLPX_[A-Z0-9_]*//g;
  46. $_ =~ s/CURLSHE_[A-Z0-9_]*//g;
  47. $_ =~ s/CURLSHOPT_[A-Z0-9_]*//g;
  48. $_ =~ s/CURLSSLOPT_[A-Z0-9_]*//g;
  49. $_ =~ s/CURLSSH_[A-Z0-9_]*//g;
  50. $_ =~ s/CURLSSLBACKEND_[A-Z0-9_]*//g;
  51. $_ =~ s/CURLU_[A-Z0-9_]*//g;
  52. $_ =~ s/CURLUPART_[A-Z0-9_]*//g;
  53. #$_ =~ s/\bCURLU\b//g; # stand-alone CURLU
  54. $_ =~ s/CURLUE_[A-Z0-9_]*//g;
  55. $_ =~ s/CURLHE_[A-Z0-9_]*//g;
  56. $_ =~ s/CURLWS_[A-Z0-9_]*//g;
  57. $_ =~ s/CURLKH[A-Z0-9_]*//g;
  58. $_ =~ s/CURLUPART_[A-Z0-9_]*//g;
  59. $_ =~ s/CURLUSESSL_[A-Z0-9_]*//g;
  60. $_ =~ s/CURLPAUSE_[A-Z0-9_]*//g;
  61. $_ =~ s/CURLHSTS_[A-Z0-9_]*//g;
  62. $_ =~ s/curl_global_([a-z_]*)//g;
  63. $_ =~ s/curl_(strequal|strnequal|formadd|waitfd|formget|getdate|formfree)//g;
  64. $_ =~ s/curl_easy_([a-z]*)//g;
  65. $_ =~ s/curl_multi_([a-z_]*)//g;
  66. $_ =~ s/curl_mime_(subparts|addpart|filedata|data_cb)//g;
  67. $_ =~ s/curl_ws_(send|recv|meta)//g;
  68. $_ =~ s/curl_url_(dup)//g;
  69. $_ =~ s/curl_pushheader_by(name|num)//g;
  70. $_ =~ s/libcurl-(env|ws)//g;
  71. $_ =~ s/libcurl\\-(env|ws)//g;
  72. $_ =~ s/(^|\W)((tftp|https|http|ftp):\/\/[a-z0-9\-._~%:\/?\#\[\]\@!\$&'()*+,;=\\]+)//gi;
  73. push @out, $_;
  74. }
  75. }
  76. close(F);
  77. open(O, ">$f") or die;
  78. for my $l (@out) {
  79. print O $l;
  80. }
  81. close(O);