summaryrefslogtreecommitdiff
path: root/examples/Misc
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1996-11-18 06:51:10 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1996-11-18 06:51:10 +0000
commit16d93002bf5208ce8642a2a095815b184503fbad (patch)
tree4a2ffefc1e386fba5a0fedcc0bc5a617accf3711 /examples/Misc
parent71526e6d725759bdcef2aac3ac17f0ce42808dcd (diff)
downloadATCD-16d93002bf5208ce8642a2a095815b184503fbad.tar.gz
Foo
Diffstat (limited to 'examples/Misc')
-rw-r--r--examples/Misc/Makefile1
-rw-r--r--examples/Misc/test_get_opt.cpp51
2 files changed, 52 insertions, 0 deletions
diff --git a/examples/Misc/Makefile b/examples/Misc/Makefile
index 8f950973535..fd4a1a9afc8 100644
--- a/examples/Misc/Makefile
+++ b/examples/Misc/Makefile
@@ -9,6 +9,7 @@
#----------------------------------------------------------------------------
BIN = test_dump \
+ test_get_opt \
test_profile_timer \
test_read_buffer \
test_sstring \
diff --git a/examples/Misc/test_get_opt.cpp b/examples/Misc/test_get_opt.cpp
new file mode 100644
index 00000000000..a35216ed956
--- /dev/null
+++ b/examples/Misc/test_get_opt.cpp
@@ -0,0 +1,51 @@
+// $Id$
+
+// Test the ACE_Get_Opt class.
+
+#include "ace/Get_Opt.h"
+#include "ace/Log_Msg.h"
+
+int
+main (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opt (argc, argv, "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.optarg));
+ 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.optarg));
+ 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.optarg));
+ 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.optarg));
+ break;
+ default:
+ ACE_DEBUG ((LM_DEBUG, "got %c, which is unrecognized!\n", c));
+ break;
+ }
+
+ for (int i = get_opt.optind; i < argc; i++)
+ ACE_DEBUG ((LM_DEBUG, "optind = %d, argv[optind] = %s\n",
+ i, argv[i]));
+
+ return 0;
+}