Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / Bug_2768_Regression / client.cpp
blob52f86afe50f47781089a51ed00d8a1335c4297c3
1 #include "MessengerC.h"
2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR *ior = ACE_TEXT ("");
6 int
7 parse_args (int argc, ACE_TCHAR *argv[])
9 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
10 int c;
12 while ((c = get_opts ()) != -1)
13 switch (c)
15 case 'k':
16 ior = get_opts.opt_arg ();
17 break;
19 case '?':
20 default:
21 ACE_ERROR_RETURN ((LM_ERROR,
22 "usage: %s "
23 "-k <ior> "
24 "\n",
25 argv [0]),
26 -1);
28 // Indicates successful parsing of the command line
29 return 0;
33 int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
35 try
37 //init the orb
38 CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);
40 if (parse_args (argc, argv) != 0)
41 return 1;
43 CORBA::Object_var object_temp =
44 orb->string_to_object (ior);
46 SimpleMessenger::Messenger_var messenger =
47 SimpleMessenger::Messenger::_unchecked_narrow( object_temp.in ());
49 CORBA::PolicyList_var unused;
50 messenger->_validate_connection(unused);
52 messenger->send();
54 orb->destroy();
56 catch (const CORBA::Exception& ex)
58 ex._tao_print_exception ("Exception caught:");
59 return 1;
62 return 0;