std::string id_manager::replace_placeholders(std::string const& xml) const { assert(!state->current_file); return process_ids(*state, xml); }
int main(int argc, char *argv[]) { char c; int i; idtype_t idtype = P_PID; char *idstr = "pid"; char *pool_name = NULL; uint_t flags = 0; int status; (void) getpname(argv[0]); (void) setlocale(LC_ALL, ""); (void) textdomain(TEXT_DOMAIN); while ((c = getopt(argc, argv, OPTS)) != EOF) { switch (c) { case 'Q': if (flags & (qFLAG | iFLAG | pFLAG)) usage(); flags |= QFLAG; break; case 'e': if (flags & (iFLAG | qFLAG | QFLAG)) usage(); flags |= eFLAG; break; case 'i': for (i = 0; idtypes[i].str != NULL; i++) { if (strcmp(optarg, idtypes[i].str) == 0) { idtype = idtypes[i].idtype; idstr = idtypes[i].str; break; } } if ((flags & (iFLAG | qFLAG | QFLAG)) || idtypes[i].str == NULL) usage(); flags |= iFLAG; break; case 'p': if (flags & (pFLAG | qFLAG | QFLAG)) usage(); flags |= pFLAG; pool_name = optarg; break; case 'q': if (flags & (pFLAG | iFLAG | QFLAG)) usage(); flags |= qFLAG; break; case '?': default: usage(); } } argc -= optind; argv += optind; if (flags & eFLAG && pool_name == NULL) usage(); if (argc < 1 || (flags & (pFLAG | qFLAG | QFLAG)) == 0) usage(); /* * Check to see that the pools facility is enabled */ if (pool_get_status(&status) != PO_SUCCESS) die((ERR_OPEN_DYNAMIC), get_errstr()); if (status == POOL_DISABLED) die((ERR_OPEN_DYNAMIC), strerror(ENOTACTIVE)); if (flags & eFLAG) exec_cmd(pool_name, argv); /*NOTREACHED*/ else process_ids(pool_name, flags, idtype, idstr, argc, argv); return (error); }