This file is indexed.

/usr/share/chalow/add-extent.pl is in chalow 1.0-3.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
#!/usr/bin/env perl
# $Id: add-extent.pl,v 1.3 2003/08/25 11:50:33 yto Exp $
# HTML ¤Î img ¥¿¥°¤Ë width ¤È height ¤ò­¤¹

use strict;
use File::Copy;

# identify ¼«Æ°ÀßÄê
my $IDENTIFY = `which identify`;
die "NO identify!" unless ($IDENTIFY =~ /identify$/);
chomp $IDENTIFY;

if (@ARGV == 0) {
    print << "USAGE";
usage: prog <file> [file]...
USAGE
    ;
} else {

    for my $fname (@ARGV) {

	# HTML ¥Õ¥¡¥¤¥ë¤ò°ìµ¤¤ËÆɤ߹þ¤à
	open(IN, $fname) or die;
	my $all = join('', <IN>);
	close(IN);

	# cache ¥Õ¥¡¥¤¥ë
	my $cfn = $fname;
	$cfn =~ s!/[^/]*$!!;	# ¥Ñ¥¹
	$cfn .= "/cache_extent-info";
	my %file_info;
	my $file_info_update_flag = 0;
	if (open(F, $cfn)) {
	    while(<F>) {
		next if (/^\#/ or /^\s*$/);
		my @c = split(/\s/);
		if (@c == 3) {
		    $file_info{$c[0]} = [@c[1..2]];
		}
	    }
	    close(F);
	}

	# img ¥¿¥°¤ÎÉôʬ¤ò¼è¤ê¤À¤¹¡£
	my @con = split(/(<img.+?>)/ims, $all);

	next if (scalar(@con) == 1); # img ¥¿¥°¤¬Ìµ¤¤¥Õ¥¡¥¤¥ë¤Ï²¿¤â¤·¤Ê¤¤

	my $num = 0;
	for (my $i = 0; $i < @con; $i++) {

	    if ($con[$i] =~ /^(<img.+?>)/ims) {
		my $in = $1;

		# width ¤È height ¤ÎξÊý¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï²¿¤â¤·¤Ê¤¤
		next if ($in =~ /\W((width|height)\W.+?\W){2}/i); # ad hoc

		# width or height ¤ò¾Ã¤¹
		$con[$i] =~ s/\s+(width|height)=[^\s]+//gims;

		# ²èÁü¥Õ¥¡¥¤¥ë̾¤ò¼è¤ê½Ð¤¹
		die unless ($in =~ /\ssrc="?(\S+?)"?[\s>]/i);
		my $imgfn = $1;

		# identify ¤Ç width ¤È height ¤ò¼èÆÀ
		next unless (-e $imgfn);
		my ($w, $h);
		if (defined $file_info{$imgfn}) {
		    ($w, $h) = @{$file_info{$imgfn}};
		} else {
		    ($w, $h) = (`$IDENTIFY $imgfn` =~ /(\d+)x(\d+)/);
		    $file_info{$imgfn} = [$w, $h];
		    $file_info_update_flag = 1;
#		    print join("----", @{$file_info{$imgfn}}),"\n";
		}
		die if $?;

		# img ¥¿¥°Æâ¤Ë width ¤È height ¤òÄɲÃ
		$con[$i] =~ s|>$| width="$w" height="$h">|ims;
		$num++;
	    }

	    # cache ¥Õ¥¡¥¤¥ë¤Î½ñ¤­¹þ¤ß
	    if ($file_info_update_flag and open(F, "> $cfn")) {
		foreach my $f (sort keys %file_info) {
		    print F "$f @{$file_info{$f}}\n";
		}
		close(F);
	    }
	}

	next if ($num == 0);	# Êѹ¹²Õ½ê¤Ê¤·

	# Êѹ¹²Õ½ê¤¬¤¢¤Ã¤¿¤é¡¢¸µ¤Î¥Õ¥¡¥¤¥ë¤òÂàÈò¤·¤Æ¤«¤é¡¢¾å½ñ¤­¤¹¤ë
	copy($fname, "$fname.bak") or die;
	open(OUT, "> $fname") or die;
	print OUT join("", @con);
	close(OUT);
    }

}