void DoOption(const char* p, OBConversion& Conv, OBConversion::Option_type typ, int& arg, int argc, char *argv[]) { while(p && *p) //can have multiple single char options { char ch[2]="?"; *ch = *p++; const char* txt=NULL; //Get the option text if needed int nParams = Conv.GetOptionParams(ch, typ); if(nParams) { if(*p) { txt = p; //use text immediately following the option letter p=NULL; //no more single char options } else if(arg<argc-1) { txt = argv[++arg]; //use text from next arg if(*txt=='-') { //...unless it is another option cerr << "Option -" << ch << " takes a parameter" << endl; exit(0); } } } Conv.AddOption(ch, typ, txt); } }