shelldap
changeset 124 c1d8da18e65d
parent 121 6c14c49fe429
child 125 6530284a0ae4
equal deleted inserted replaced
121:6c14c49fe429 124:c1d8da18e65d
  2767 my $shell = LDAP::Shell->new;
  2767 my $shell = LDAP::Shell->new;
  2768 my $sigset = POSIX::SigSet->new();
  2768 my $sigset = POSIX::SigSet->new();
  2769 sub ctrl_c_handler {
  2769 sub ctrl_c_handler {
  2770 	print "\n";
  2770 	print "\n";
  2771 	$shell->term->on_new_line;
  2771 	$shell->term->on_new_line;
  2772 	$shell->term->replace_line('', 0);
  2772 	$shell->term->kill_text;
       
  2773 	$shell->term->callback_sigcleanup;
       
  2774 	$shell->term->free_line_state;
       
  2775 	$shell->term->cleanup_after_signal;
       
  2776 	$shell->term->callback_handler_remove;
  2773 	$shell->term->redisplay;
  2777 	$shell->term->redisplay;
  2774 }
  2778 }
  2775 my $sigaction = POSIX::SigAction->new( \&ctrl_c_handler, $sigset, 0);
  2779 my $sigaction = POSIX::SigAction->new( \&ctrl_c_handler, $sigset, 0);
  2776 my $old_action = POSIX::SigAction->new;
  2780 my $old_action = POSIX::SigAction->new;
  2777 POSIX::sigaction(&POSIX::SIGINT, $sigaction, $old_action); # save default one
  2781 POSIX::sigaction(&POSIX::SIGINT, $sigaction, $old_action); # save default one