You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

34 lines
655 B

#define MICHLIB_NOSOURCE
#include "ParseArgs.h"
using michlib::SList;
CLArgs ParseArgs(int argc, char** argv)
{
CLArgs out;
out["_name"] = argv[0];
for(int i = 0; i < argc; i++)
{
MString carg = argv[i];
out["_arg" + MString(i)] = carg;
bool namevalue = false;
for(size_t c = 0; c < carg.Len(); c++)
if(carg[c] == '=')
{
MString name = carg.SubStr(1, c);
MString val = carg.SubStr(c + 2, carg.Len() - c - 1);
out[name] = val;
namevalue = true;
break;
}
if(!namevalue) out[carg] = "";
}
SList sl;
michlib_internal::ParseParameterFile("/etc/odm.conf", sl, 0);
return out;
}