aboutsummaryrefslogtreecommitdiff
path: root/src/Probe.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/Probe.java')
-rw-r--r--src/Probe.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/Probe.java b/src/Probe.java
index 6e4543b..a5238c1 100644
--- a/src/Probe.java
+++ b/src/Probe.java
@@ -1,6 +1,6 @@
package fr.dgac.ivy ;
-import gnu.getopt.Getopt;
import java.io.*;
+import gnu.getopt.Getopt;
/**
* terminal implementation in java of the ivyprobe.
@@ -12,9 +12,14 @@ import java.io.*;
*/
class Probe implements IvyApplicationListener, IvyMessageListener {
+ /**
+ * help message for the standalone program
+ */
+ public static final String helpmsg = "usage: java fr.dgac.ivy.Probe [options] [regexp]\n\t-b BUS\tspecifies the Ivy bus domain\n\t-q\tquiet, no tty output\n\t-d\tdebug\n\t-h\thelp\n\n\t regexp is a Perl5 compatible regular expression";
+
public static void main(String[] args) throws IvyException {
Probe p = new Probe();
- Getopt opt = new Getopt("Probe",args,"b:d");
+ Getopt opt = new Getopt("Probe",args,"b:dh");
int c;
String domain=Ivy.getDomain(null);
while ((c = opt.getopt()) != -1) switch (c) {
@@ -24,12 +29,14 @@ class Probe implements IvyApplicationListener, IvyMessageListener {
case 'd':
System.setProperty("IVY_DEBUG","yes");
break;
+ case 'h':
default:
+ System.out.println(helpmsg);
+ System.exit(0);
}
// connexion to the Bus
- Ivy bus;
try {
- bus=new Ivy("JPROBE","JPROBE ready",p);
+ Ivy bus=new Ivy("JPROBE","JPROBE ready",p);
for (int i=opt.getOptind();i<args.length;i++) {
System.out.println("you want to subscribe to " + args[i]);
bus.bindMsg(args[i],p);
@@ -69,7 +76,7 @@ class Probe implements IvyApplicationListener, IvyMessageListener {
public void die(IvyClient client, int id) {
looping=false;
- System.out.println(client.getApplicationName() + " received die msg from "+ id );
+ System.out.println("received die msg from " + client.getApplicationName() );
}
public void directMessage(IvyClient client, int id, String arg) {