Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Bug_1395_Regression / client.cpp
blob8c7cb5f2b56162a9b496bb22d0de6be31d68f6da
1 #include "TestC.h"
2 #include "ace/Get_Opt.h"
4 const ACE_TCHAR *ior = ACE_TEXT("file://test.ior");
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);
61 if (shutdown_server)
63 server->shutdown();
65 else
67 result = server->try_and_create_POA();
70 orb->destroy ();
72 catch (const CORBA::Exception& ex)
74 ex._tao_print_exception ("Exception caught:");
75 result =1;
78 return result;