#STDOUT->setbuf('');
+my $tag = scalar(@ARGV) ? '.'.shift : '';
+
use vars qw( $Debug );
-$Debug = 3; #2 will turn on child logging, 3 will log packet contents,
+$Debug = 2; #2 will turn on child logging, 3 will log packet contents,
#including potentially compromising information
-my $socket = "/usr/local/freeside/selfservice_socket";
+my $socket = "/usr/local/freeside/selfservice_socket$tag";
my $pid_file = "$socket.pid";
-my $log_file = "/usr/local/freeside/selfservice.log";
+my $log_file = "/usr/local/freeside/selfservice$tag.log";
-my $lock_file = "/usr/local/freeside/selfservice.writelock";
+my $lock_file = "/usr/local/freeside/selfservice$tag.writelock";
#my $me = '[client]';
#handle some commands weirdly?
$packet->{_token}=$$;
- warn "[child-$$] locking write stream" if $Debug > 1;
+ warn "[child-$$] locking write stream\n" if $Debug > 1;
lock_write;
- warn "[child-$$] sending packet to remote server" if $Debug > 1;
+ warn "[child-$$] sending packet to remote server\n" if $Debug > 1;
nstore_fd($packet, \*STDOUT) or die "FATAL: can't send response: $!";
- warn "[child-$$] flushing write stream" if $Debug > 1;
+ warn "[child-$$] flushing write stream\n" if $Debug > 1;
STDOUT->flush or die "FATAL: can't flush: $!";
- warn "[child-$$] releasing write lock" if $Debug > 1;
+ warn "[child-$$] releasing write lock\n" if $Debug > 1;
unlock_write;
- warn "[child-$$] closing write stream" if $Debug > 1;
+ warn "[child-$$] closing write stream\n" if $Debug > 1;
close STDOUT or die "FATAL: can't close write stream: $!"; #??!
- warn "[child-$$] waiting for response from parent" if $Debug > 1;
+ warn "[child-$$] waiting for response from parent\n" if $Debug > 1;
my $w = new IO::Select;
$w->add(\*STDIN);
until ( $w->can_read ) {