summaryrefslogtreecommitdiff
path: root/java/tests/Misc/ParseArgsTest.java
blob: 5baddd2745d38fce188dec67825c185df15f3fe9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// ============================================================================
//
// = PACKAGE
//    tests.Misc
// 
// = FILENAME
//    ParseArgsTest.java
//
// = AUTHOR
//    Prashant Jain
// 
// ============================================================================
package tests.Misc;

import JACE.OS.*;
import JACE.Misc.*;

public class ParseArgsTest
{
  public static void main (String args[])
  {
    String s;
    GetOpt opt = new GetOpt (args, "p:rs:");
    for (int c; (c = opt.next ()) != -1; )
      {
	switch (c)
	  {
	  case 'p':
	    s = opt.optarg ();
	    ACE.DEBUG ("Option <p> selected with argument " + s);
	    break;
	  case 'r':
	    ACE.DEBUG ("Option <r> selected");
	    break;
	  case 's':
	    s = opt.optarg ();
	    ACE.DEBUG ("Option <s> selected with argument " + s);
	    break;
	  default:
	    ACE.DEBUG ("Usage: java tests.Misc.ParseArgsTest [-p arg1] [-r] [-s arg2]");
	    break;
	  }
      }
  }
}