Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / Bug_1627_Regression / client.cpp
blob06d1e6e6dd029909026401bbbb8c9f93a8e9a1bf
1 #include "TestC.h"
2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR *ior = ACE_TEXT("corbaloc:iiop:localhost:12345/Name\\2dwith\\2dhyphens");
5 int shutdown_server = 0;
7 int
8 parse_args (int argc, ACE_TCHAR *argv[])
10 ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:"));
11 int c;
13 while ((c = get_opts ()) != -1)
14 switch (c)
16 case 'k':
17 ior = get_opts.opt_arg ();
18 break;
19 case 's':
20 shutdown_server = 1;
21 break;
22 case '?':
23 default:
24 ACE_ERROR_RETURN ((LM_ERROR,
25 "usage: %s "
26 "-k <ior> "
27 "\n",
28 argv [0]),
29 -1);
31 // Indicates successful parsing of the command line
32 return 0;
35 int
36 ACE_TMAIN(int argc, ACE_TCHAR *argv[])
38 int result = 0;
39 try
41 CORBA::ORB_var orb =
42 CORBA::ORB_init (argc, argv);
44 if (parse_args (argc, argv) != 0)
45 return 1;
47 CORBA::Object_var tmp =
48 orb->string_to_object(ior);
50 Test_var server =
51 Test::_narrow(tmp.in ());
53 if (CORBA::is_nil (server.in ()))
55 ACE_ERROR_RETURN ((LM_DEBUG,
56 "Nil Test::Server reference <%s>\n",
57 ior),
58 1);
62 server->test_method();
63 result =0;
66 orb->destroy ();
68 catch (const CORBA::Exception&)
70 result =1;
73 return result;