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 26# pass files as argument(s) 27 28my $docroot="https://curl.se/libcurl/c"; 29 30for $f (@ARGV) { 31 open(NEW, ">$f.new"); 32 open(F, "<$f"); 33 while(<F>) { 34 my $l = $_; 35 if($l =~ /\/* $docroot/) { 36 # just ignore preciously added refs 37 } 38 elsif($l =~ /^( *).*curl_easy_setopt\([^,]*, *([^ ,]*) *,/) { 39 my ($prefix, $anc) = ($1, $2); 40 $anc =~ s/_//g; 41 print NEW "$prefix/* $docroot/curl_easy_setopt.html#$anc */\n"; 42 print NEW $l; 43 } 44 elsif($l =~ /^( *).*(curl_([^\(]*))\(/) { 45 my ($prefix, $func) = ($1, $2); 46 print NEW "$prefix/* $docroot/$func.html */\n"; 47 print NEW $l; 48 } 49 else { 50 print NEW $l; 51 } 52 } 53 close(F); 54 close(NEW); 55 56 system("mv $f $f.org"); 57 system("mv $f.new $f"); 58} 59