MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / SkipArgPrefix

Function SkipArgPrefix

Descent3/args.cpp:90–104  ·  view source on GitHub ↗

Strip '-', '--', and '+' flag prefix, so --foo, -foo, +foo => foo, but pass through - -- + ++

Source from the content-addressed store, hash-verified

88
89// Strip '-', '--', and '+' flag prefix, so --foo, -foo, +foo => foo, but pass through - -- + ++
90const char *SkipArgPrefix(const char *arg) {
91 if (*arg != '\0' && *(arg + 1) != '\0') {
92 if (*arg == '-') {
93 if (*(arg + 1) == '-' && *(arg + 2) != '\0') {
94 return arg + 2;
95 }
96 if (*(arg + 1) != '-') {
97 return arg + 1;
98 }
99 } else if (*arg == '+' && *(arg + 1) != '+') {
100 return arg + 1;
101 }
102 }
103 return arg;
104}
105
106int FindArg(const char *which) {
107 if (which == nullptr)

Callers 1

FindArgFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected