4 * Copyright 2008 Massachusetts Institute of Technology.
7 * Export of this software from the United States of America may
8 * require a specific license from the United States Government.
9 * It is the responsibility of any person or organization contemplating
10 * export to obtain such a license before exporting.
12 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13 * distribute this software and its documentation for any purpose and
14 * without fee is hereby granted, provided that the above copyright
15 * notice appear in all copies and that both that copyright notice and
16 * this permission notice appear in supporting documentation, and that
17 * the name of M.I.T. not be used in advertising or publicity pertaining
18 * to distribution of the software without specific, written prior
19 * permission. Furthermore if you modify this software you must label
20 * your software as modified software and not distribute it in such a
21 * fashion that it might be confused with the original M.I.T. software.
22 * M.I.T. makes no representations about the suitability of
23 * this software for any purpose. It is provided "as is" without express
24 * or implied warranty.
33 ParseOpts::IsValidOpt(
37 return (m_ValidOpts[ch % 256] != 0);
47 fprintf(stderr, " -%c %s\n", ch, text);
56 fprintf(stderr, "Usage: %s [options]\n", program);
57 PrintOpt('k', "stop server");
58 #ifdef CCAPI_TEST_OPTIONS
59 PrintOpt('s', "string");
60 PrintOpt('e', "endpoint");
61 PrintOpt('m', "maxcalls");
62 PrintOpt('n', "mincalls");
63 PrintOpt('f', "flag_wait_op");
64 PrintOpt('u', "unprotected");
65 PrintOpt('b', "use security callback");
67 PrintOpt('c', "output debug info to console");
72 ParseOpts::SetValidOpts(
76 memset(m_ValidOpts, 0, sizeof(m_ValidOpts));
78 for (p = valid_opts; *p; p++) {
79 m_ValidOpts[*p % sizeof(m_ValidOpts)] = 1;
91 for (i = 1; i < argc; i++) {
92 if ((*argv[i] == '-') || (*argv[i] == '/')) {
93 char ch = tolower(*(argv[i]+1));
98 opts.bShutdown = TRUE;
100 #ifdef CCAPI_TEST_OPTIONS
102 opts.pszString = argv[++i];
105 opts.pszEndpoint = argv[++i];
108 opts.cMaxCalls = (unsigned int) atoi(argv[++i]);
111 opts.cMinCalls = (unsigned int) atoi(argv[++i]);
114 opts.fDontWait = (unsigned int) atoi(argv[++i]);
117 opts.bDontProtect = TRUE;
120 opts.bSecCallback = TRUE;
124 opts.bConsole = TRUE;
138 ParseOpts::ParseOpts(char* valid_opts)
140 SetValidOpts(valid_opts);
143 ParseOpts::ParseOpts()
147 ParseOpts::~ParseOpts()