summaryrefslogtreecommitdiff
path: root/tests/ARGV_Test.cpp
blob: 621d6fd586def3b8ff5ebaf318d879a1f394bd0d (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
46
47
48
49
50
51
52
53
// $Id$

// ============================================================================
//
// = LIBRARY
//    tests
//
// = DESCRIPTION
//    This simple test illustrates how to use advanced features of
//    <ACE_ARGV>. 
//
// = AUTHOR
//    Suresh Kannan <kannan@uav.ae.gatech.edu>
//
// ============================================================================

#include "ace/ARGV.h"
#include "test_config.h"

ACE_RCSID(tests, ARGV_Test, "$Id$")

int 
main (int, char *argv[])
{
  ACE_START_TEST (ACE_TEXT ("ARGV_Test"));

  // From command line.
  ACE_ARGV cl (argv);

  // My own stuff.
  ACE_ARGV my;		

  // Add to my stuff.
  my.add ("-ORBEndpoint iiop://localhost:12345");

  // Combine the two (see the ace/ARGV.h constructors documentation).
  ACE_ARGV a (cl.argv (),
              my.argv ());

  ACE_DEBUG ((LM_DEBUG,
              ACE_TEXT ("argc = %d\n"),
              ACE_TEXT (a.argc ())));

  // Print the contents of the combined <ACE_ARGV>.
  for (size_t i = 0; i < a.argc (); i++)
    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("(%d) %s\n"),
                i,
                a.argv ()[i]));

  ACE_END_TEST;
  return 0;
}