[PATCH] Make sieveshell better behaved when called from non-shell contexts

James Lamanna jlamanna at gmail.com
Mon Feb 11 12:48:21 EST 2008


Hi,
I've attached a patch to make sieveshell be better behaved when there
may not be a $TERM around.
For instance, this fixes some perl TERM/Readline errors I've been
seeing when executing sieveshell from a PHP script.

Thanks,

-- James

--- sieveshell.pl.orig  2008-02-11 09:37:59.000000000 -0800
+++ sieveshell.pl       2008-02-11 09:43:49.000000000 -0800
@@ -171,13 +171,16 @@
     die "unable to connect to server";
 }

-my $term = Term::ReadLine->new("sieveshell");
+my $term;

-$term->ornaments(0);
+if ($interactive) {
+  $term = Term::ReadLine->new("sieveshell");
+  $term->ornaments(0);
+}

 while(defined($_  = ($interactive ? $term->readline('> ') : <$filehandle>))){

-  $term->addhistory($_);
+  if ($interactive) { $term->addhistory($_); }

   my @words = split ' ',$_;
   my $str;


More information about the Cyrus-devel mailing list