/* Returns UserListCtx.ResumeIndex out of passed UserListCtx */ unsigned int mprListGetResumeIndex(struct MprVar *listCtx) { NTSTATUS status; unsigned int resume = 0; struct MprVar *mprResumeIndex; if (listCtx == NULL) return 0; mprResumeIndex = listCtx; status = mprGetVar(&mprResumeIndex, "ResumeIndex"); if (!NT_STATUS_IS_OK(status)) goto done; resume = (unsigned int) mprVarToInteger(mprResumeIndex); done: return resume; }
/* find a mpr component, allowing for sub objects, using the '.' convention */ NTSTATUS mprGetVar(struct MprVar **v, const char *name) { const char *p = strchr(name, '.'); char *objname; NTSTATUS status; if (p == NULL) { *v = mprGetProperty(*v, name, NULL); if (*v == NULL) { DEBUG(1,("mprGetVar unable to find '%s'\n", name)); return NT_STATUS_INVALID_PARAMETER; } return NT_STATUS_OK; } objname = talloc_strndup(mprMemCtx(), name, p-name); NT_STATUS_HAVE_NO_MEMORY(objname); *v = mprGetProperty(*v, objname, NULL); NT_STATUS_HAVE_NO_MEMORY(*v); status = mprGetVar(v, p+1); talloc_free(objname); return status; }