Browse Source

Added keys _cmdline and _nargs into parsed arguments.

interpolate
Michael Uleysky 1 year ago
parent
commit
09e22b67cd
  1. 7
      src/ParseArgs.cpp

7
src/ParseArgs.cpp

@ -5,12 +5,15 @@ CLArgs ParseArgs(int argc, char** argv)
{ {
CLArgs out; CLArgs out;
out["_name"] = argv[0]; out["_nargs"] = MString(argc);
for(int i = 0; i < argc; i++)
out["_cmdline"] = out["_name"] = out["_arg0"] = argv[0];
for(int i = 1; i < argc; i++)
{ {
MString carg = argv[i]; MString carg = argv[i];
out["_arg" + MString(i)] = carg; out["_arg" + MString(i)] = carg;
bool namevalue = false; bool namevalue = false;
out["_cmdline"] += " " + carg;
for(size_t c = 0; c < carg.Len(); c++) for(size_t c = 0; c < carg.Len(); c++)
if(carg[c] == '=') if(carg[c] == '=')

Loading…
Cancel
Save