+my $t;
+if ($Config{usethreads}) {
+ require Thread;
+# print "Using Thread Method\n";
+ $t = Thread->new(\&dostdin);
+ donetwork();
+ $t->join;
+ kill(-1, $$);
+} else {
+# print "Using Fork Method\n";
+ die "can't fork: $!" unless defined($childpid = fork());
+ if ($childpid) {
+ donetwork();
+ kill 'TERM', $childpid;
+ } else {
+ dostdin();
+ }
+}
+exit 0;