Commit b44c1193 authored by Robert Ricci's avatar Robert Ricci

Add an optional pid/eid option to eventdebug

parent b15ac73b
......@@ -21,15 +21,23 @@ use Getopt::Std;
use strict;
sub usage {
warn "Usage: $0 [-b] [-s server] [-p port] <event>\n";
warn "Usage: $0 [-b] [-s server] [-p port] [pid/eid]\n";
return 1;
}
my %opt = ();
my $expt = "";
getopt("s:p:hb", \%opt);
if ($opt{h}) { exit &usage; }
if (@ARGV) { exit &usage; }
if (@ARGV) {
$expt = shift @ARGV;
}
if (@ARGV) {
usage();
exit 1;
}
my ($server,$port);
if ($opt{s}) { $server = $opt{s}; } else { $server = "localhost"; }
......@@ -45,6 +53,10 @@ if (!$handle) { die "Unable to register with event system\n"; }
my $tuple = address_tuple_alloc();
if (!$tuple) { die "Could not allocate an address tuple\n"; }
if ($expt) {
%$tuple = ( expt => $expt );
}
if (!event_subscribe($handle,\&callbackFunc,$tuple)) {
die "Could not subscribe to event\n";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment