my $output_sem : shared = Thread::Semaphore->new();
####
if ($success)
{
$output_sem->down();
erase($input_window);
addstr($input_window, $buffer);
refresh($input_window);
$ptr = length($buffer);
curs_to_ptr($input_window, $ptr);
$output_sem->up();
}
####
elsif ($key eq chr(1)) # home
{
$output_sem->down();
$ptr = 0;
curs_to_ptr($input_window, $ptr);
$output_sem->up();
}
####
sub icb_print
{
my ($window, $color, $fmt, @args) = @_;
my $buf = sprintf ($fmt, @args);
$output_sem->down();
if ($use_color)
{
attron ($window, COLOR_PAIR($colors{$color})) if ($colors{$color});
attron ($window, A_BOLD) if ($attr{$color} & 1);
attron ($window, A_REVERSE) if ($attr{$color} & 2);
}
addstr($window, $buf);
if ($use_color)
{
attroff ($window, COLOR_PAIR($colors{$color})) if ($colors{$color});
attroff ($window, A_BOLD) if ($attr{$color} & 1);
attroff ($window, A_REVERSE) if ($attr{$color} & 2);
}
refresh($window);
log_send($buf) if ($log_sem);
if (chomp($buf))
{
if ($page[0])
{
$page[1]++ unless ($page[2]); # count newlines
if ($page[1] > $page[0]) # maintain paused flag
{
unless ($page[2])
{
$page[2] = 1;
icb_print ($window, 'more', "%s\n", " ---- PAUSED: Press Enter to continue ---- ");
}
}
}
}
$output_sem->up();
}