2 * ACE_Get_Opt long_only examples. Sample code from The ACE
3 * Programmer's Guide, Copyright 2003 Addison-Wesley. All Rights Reserved.
6 #include "ace/OS_NS_string.h"
7 #include "ace/Get_Opt.h"
8 #include "ace/Log_Msg.h"
11 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
13 static const ACE_TCHAR options
[] = ACE_TEXT (":f:");
15 (argc
, argv
, options
, 1, 0, ACE_Get_Opt::PERMUTE_ARGS
, 1);
16 if (cmd_opts
.long_option
17 (ACE_TEXT ("config"), 'f', ACE_Get_Opt::ARG_REQUIRED
) == -1)
21 ACE_TCHAR config_file
[MAXPATHLEN
];
22 ACE_OS::strcpy (config_file
, ACE_TEXT ("HAStatus.conf"));
23 while ((option
= cmd_opts ()) != EOF
)
26 ACE_OS::strncpy (config_file
,
33 ((LM_ERROR
, ACE_TEXT ("-%c requires an argument\n"),
34 cmd_opts
.opt_opt ()), -1);
39 ((LM_ERROR
, ACE_TEXT ("Parse error.\n")), -1);
42 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("Config file is %s\n"), config_file
));