3 # View some kernel doc file
5 require './man-lib.pl';
8 $in{'file'} = &simplify_path($in{'file'});
9 $in{'file'} !~ /[\\\&\;\`\'\"\|\*\?\<\>\^\(\)\[\]\{\}\$\n\r]/ ||
10 &error($text{'kernel_epath'});
11 foreach $h (split(/\s+/, $config{'kernel_dir'})) {
12 $ok++ if (&is_under_directory($config{'kernel_dir'}, $in{'file'}));
14 $ok || &error($text{'kernel_epath'});
15 -r $in{'file'} || &error($text{'kernel_epath'});
17 &ui_print_header(undef, $text{'kernel_title'}, "");
19 # Work out compression format
20 open(FILE, $in{'file'});
22 $qm = quotemeta($in{'file'});
23 if ($two eq "\037\213") {
25 &open_execute_command(FILE, "gunzip -c $qm", 1, 1);
27 elsif ($two eq "BZ") {
29 &open_execute_command(FILE, "bunzip2 -c $qm", 1, 1);
34 if ($in{'file'} =~ /\.htm/i) {
35 # Display HTML documentation
36 ($dir = $in{'file'}) =~ s/\/[^\/]+$//;
37 while($line = <FILE>) {
38 $line =~ s/href="([^"]+)"/href="view_doc.cgi?file=$dir\/$1"/ig;
39 $line =~ s/href='([^']+)'/href='view_doc.cgi?file=$dir\/$1'/ig;
40 $line =~ s/href=([^'"\s>]+)/href='view_doc.cgi?file=$dir\/$1'/ig;
47 @for = split(/\s+/, $in{'for'});
48 while($line = <FILE>) {
49 $line = &html_escape($line);
51 $line =~ s/($f)/<b>$1<\/b>/ig;
58 &show_view_table(&text('kernel_header', $in{'file'}), $out);
60 &ui_print_footer("", $text{'index_return'});