int map_main(int argc, char* argv[]) { ContextMap *context = new ContextMap(); if (!context->parseCmdArgs(argc, argv, 1) || context->getShowHelp() || !context->isValidState()) { if (!context->getErrorMsg().empty()) { cerr << context->getErrorMsg() << endl; } map_help(); delete context; return 0; } FileMap *fileMap = new FileMap(context); bool retVal = fileMap->mapFiles(); delete fileMap; delete context; return retVal ? 0 : 1; }