Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / POA / Bug_1592_Regression / client.cpp
blobecf0b20b1263910b58285d369efbcdb68d6dd29d
1 #include "ace/Get_Opt.h"
2 #include "testC.h"
4 const ACE_TCHAR * ior = 0;
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 default:
20 ACE_ERROR_RETURN ((LM_ERROR,
21 "Usage: %s "
22 "-k IOR\n",
23 argv[0]),
24 -1);
27 return 0;
30 int
31 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
33 int status = 0;
35 try
37 CORBA::ORB_var orb = CORBA::ORB_init (argc,
38 argv,
39 "Client ORB");
41 if (::parse_args (argc, argv) != 0)
42 return -1;
44 // Start out with the first IOR. Interaction with the second
45 // IOR occurs during the various interceptions executed during
46 // this test.
47 CORBA::Object_var object = orb->string_to_object (ior);
49 test_var server = test::_narrow (object.in ());
51 if (CORBA::is_nil (server.in ()))
53 ACE_ERROR_RETURN ((LM_ERROR,
54 "Object reference <%s> is nil.\n",
55 ior),
56 1);
59 server->op ();
61 server->shutdown ();
63 orb->destroy ();
65 catch (const CORBA::Exception& ex)
67 ex._tao_print_exception ("Caught exception:");
68 return -1;
71 return status;