# change-monitor.pl
# Check if some file or directory has changed

sub get_change_status
{
local %change;
&read_file("$module_config_directory/change", \%change);
local $t = $change{$_[0]->{'file'}};
local @st = stat($_[0]->{'file'});
local $rv;
if ($t && $st[9] != $t) {
	$rv = { 'up' => 0 };
	}
elsif (!$t) {
	$rv = { 'up' => -1 };
	}
else {
	$rv = { 'up' => 1 };
	}
$change{$_[0]->{'file'}} = $st[9];
&write_file("$module_config_directory/change", \%change);
return $rv;
}

sub show_change_dialog
{
print "<tr> <td><b>$text{'change_file'}</b></td>\n";
printf "<td colspan=3><input name=file size=30 value='%s'> %s</td> </tr>\n",
	$_[0]->{'file'}, &file_chooser_button("file", 0);
}

sub parse_change_dialog
{
$_[0]->{'file'} = $in{'file'};
}

