diff options
author | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:30 +0000 |
---|---|---|
committer | William R. Otte <wotte@dre.vanderbilt.edu> | 2006-07-24 15:50:30 +0000 |
commit | c44379cc7d9c7aa113989237ab0f56db12aa5219 (patch) | |
tree | 66a84b20d47f2269d8bdc6e0323f338763424d3a /ACE/examples/Misc/test_get_opt.cpp | |
parent | 3aff90f4a822fcf5d902bbfbcc9fa931d6191a8c (diff) | |
download | ATCD-c44379cc7d9c7aa113989237ab0f56db12aa5219.tar.gz |
Repo restructuring
Diffstat (limited to 'ACE/examples/Misc/test_get_opt.cpp')
-rw-r--r-- | ACE/examples/Misc/test_get_opt.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/ACE/examples/Misc/test_get_opt.cpp b/ACE/examples/Misc/test_get_opt.cpp new file mode 100644 index 00000000000..3fd0a16ac80 --- /dev/null +++ b/ACE/examples/Misc/test_get_opt.cpp @@ -0,0 +1,54 @@ +// $Id$ + +// Test the ACE_Get_Opt class. + +#include "ace/OS_main.h" +#include "ace/Get_Opt.h" +#include "ace/Log_Msg.h" + +ACE_RCSID(Misc, test_get_opt, "$Id$") + +int +ACE_TMAIN (int argc, ACE_TCHAR *argv[]) +{ + ACE_Get_Opt get_opt (argc, argv, ACE_TEXT("ab:cd:ef:gh:")); + int c; + + while ((c = get_opt ()) != EOF) + switch (c) + { + case 'a': + ACE_DEBUG ((LM_DEBUG, "got a\n")); + break; + case 'b': + ACE_DEBUG ((LM_DEBUG, "got b with arg %s\n", get_opt.opt_arg ())); + break; + case 'c': + ACE_DEBUG ((LM_DEBUG, "got c\n")); + break; + case 'd': + ACE_DEBUG ((LM_DEBUG, "got d with arg %s\n", get_opt.opt_arg ())); + break; + case 'e': + ACE_DEBUG ((LM_DEBUG, "got e\n")); + break; + case 'f': + ACE_DEBUG ((LM_DEBUG, "got f with arg %s\n", get_opt.opt_arg ())); + break; + case 'g': + ACE_DEBUG ((LM_DEBUG, "got g\n")); + break; + case 'h': + ACE_DEBUG ((LM_DEBUG, "got h with arg %s\n", get_opt.opt_arg ())); + break; + default: + ACE_DEBUG ((LM_DEBUG, "got %c, which is unrecognized!\n", c)); + break; + } + + for (int i = get_opt.opt_ind (); i < argc; i++) + ACE_DEBUG ((LM_DEBUG, "optind = %d, argv[optind] = %s\n", + i, argv[i])); + + return 0; +} |