version 1.36, 2012/08/06 11:45:04
|
version 1.37, 2014/07/17 20:28:57
|
|
|
// | // |
////////////////////////////////////////////////////////////////////////// | ////////////////////////////////////////////////////////////////////////// |
// | // |
// Author: Bob Blair (bblair@bmc.com) |
|
// |
|
// Modified By: Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
|
// David Dillard, VERITAS Software Corp. |
|
// (david.dillard@veritas.com) |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
| |
|
|
{ | { |
unsigned int size = opt.size(); | unsigned int size = opt.size(); |
if (size == 0) | if (size == 0) |
|
{ |
return false; | return false; |
|
} |
for (unsigned int i = 0; i < size; i++) | for (unsigned int i = 0; i < size; i++) |
{ | { |
char c = static_cast<char>(opt[i]); | char c = static_cast<char>(opt[i]); |
|
|
static int catagorize(const char* s) | static int catagorize(const char* s) |
{ | { |
if (s[0] != '-') | if (s[0] != '-') |
|
{ |
return 0; | return 0; |
|
} |
else | else |
|
{ |
if (s[1] == '-') | if (s[1] == '-') |
|
{ |
return 2; | return 2; |
|
} |
|
} |
return 1; | return 1; |
} | } |
| |
|
|
{ | { |
unsigned int lim = _args.size(); | unsigned int lim = _args.size(); |
if (n < lim) | if (n < lim) |
|
{ |
return _args[n]; | return _args[n]; |
|
} |
else | else |
|
{ |
return _emptyopt; | return _emptyopt; |
} | } |
|
} |
| |
// Return first index | // Return first index |
unsigned int getoopt::first() const | unsigned int getoopt::first() const |
|
|
{ | { |
flagspec& o = _flagspecs[i]; | flagspec& o = _flagspecs[i]; |
if (o.islong && s == o.name) | if (o.islong && s == o.name) |
|
{ |
return &_flagspecs[i]; | return &_flagspecs[i]; |
} | } |
|
} |
return 0; | return 0; |
} | } |
| |
|
|
{ | { |
flagspec& o = _flagspecs[i]; | flagspec& o = _flagspecs[i]; |
if (!o.islong && c == o.name[0]) | if (!o.islong && c == o.name[0]) |
|
{ |
return &_flagspecs[i]; | return &_flagspecs[i]; |
} | } |
|
} |
return 0; | return 0; |
} | } |
| |