115 |
local(%ctab) = ('&', '&', '<', '<', '>', '>'); |
local(%ctab) = ('&', '&', '<', '<', '>', '>'); |
116 |
# |
# |
117 |
# fork and exec global(1) to avoid command substitutions in $pattern. |
# fork and exec global(1) to avoid command substitutions in $pattern. |
118 |
|
# The --fileid print the file id of the path at the head of each line. |
119 |
# |
# |
120 |
open(PIPE, "-|") || exec '@globalpath@', '-x'.$flag.$iflag.$oflag, '-e', $pattern; |
open(PIPE, "-|") || exec '@globalpath@', '-x'.$flag.$iflag.$oflag, '--fileid', '-e', $pattern; |
121 |
if ($?) { |
if ($?) { |
122 |
print "@error_begin@Error@error_end@\n"; |
print "@error_begin@Error@error_end@\n"; |
123 |
print "@message_begin@Cannot execute global. <a href='$htmlbase/mains.@normal_suffix@'>[return]</a>@message_end@\n"; |
print "@message_begin@Cannot execute global. <a href='$htmlbase/mains.@normal_suffix@'>[return]</a>@message_end@\n"; |
131 |
$cnt = 0; |
$cnt = 0; |
132 |
local($tag, $lno, $filename); |
local($tag, $lno, $filename); |
133 |
print "@verbatim_begin@\n"; |
print "@verbatim_begin@\n"; |
134 |
open(PIPEOUT, "| @gtagspath@ --convert"); |
# |
135 |
if ($?) { |
# Input format: |
136 |
print "@error_begin@Error@error_end@\n"; |
# |
137 |
print "@message_begin@Cannot execute gtags --convert. <a href='$htmlbase/mains.@normal_suffix@'>[return]</a>@message_end@\n"; |
# fid tag lno filename |
138 |
print "@body_end@\n"; |
# --------------------------------------------- |
139 |
print "@page_end@\n"; |
# 100@main 32 ./main.c main(argc, argv) |
140 |
exit 0; |
# |
|
} |
|
|
$| = 1; # flush buffer |
|
141 |
while (<PIPE>) { |
while (<PIPE>) { |
142 |
$cnt++; |
$cnt++; |
143 |
($tag, $lno, $filename) = split; |
($fid_tag, $lno, $filename) = split; |
144 |
|
($fid, $tag) = split(/@/, $fid_tag); |
145 |
|
s/^[0-9]+@//; |
146 |
s/([&<>])/$ctab{$1}/ge; |
s/([&<>])/$ctab{$1}/ge; |
147 |
# " ./$filename " is replaced with file number by gtags --convert. |
s!(^[^ \t]+)!<a href='$htmlbase/S/$fid.@HTML@#L$lno'>$1<\/a>!; |
148 |
s!(^[^ \t]+)!<a href='$htmlbase/S/ ./$filename .@HTML@#L$lno'>$1<\/a>!; |
print; |
|
print PIPEOUT; |
|
149 |
} |
} |
|
$| = 1; # flush buffer |
|
150 |
close(PIPE); |
close(PIPE); |
|
close(PIPEOUT); |
|
151 |
print "@verbatim_end@\n"; |
print "@verbatim_end@\n"; |
152 |
if ($cnt == 0) { |
if ($cnt == 0) { |
153 |
print "@message_begin@Pattern not found. <a href='$htmlbase/mains.@normal_suffix@'>[return]</a>@message_end@\n"; |
print "@message_begin@Pattern not found. <a href='$htmlbase/mains.@normal_suffix@'>[return]</a>@message_end@\n"; |