int main(void) { (void)box_float; (void)box_double; (void)box_string; /*Allocate an environment * The environment size depends on how many nested functions there are ? */ svalue_t **env = calloc(sizeof (svalue_t *), 2); /* Get the final closure */ svalue_t *closure1 = make_closure(make_doubleadder, env); /* Invoke the closure that the closure returns */ svalue_t *c1 = invoke1(closure1, box_int(23)); svalue_t *c2 = invoke1(c1, box_int(5)); svalue_t *result = invoke1(c2, box_int(334)); /* The final result */ printf("print 23 + 5 + 334 == %d\n", result->value.integer); svalue_t *a = box_int(123); svalue_t *b = box_int(455); svalue_t *improper = box_pair(a, b); improper->value.pair.right = improper; /* woo cyclic pair */ printf("(%d, %d)\n", improper->value.pair.left->value.integer, improper->value.pair.right->value.pair.left->value.integer); return 0; }
int cmdSetPassword(CLISESSION *pSession, int argc, char **argv, void *pHandler) { CIF4Invoke invoke("127.0.0.1", m_nLocalAgentPort); CIF4Invoke invoke1("127.0.0.1", m_nLocalAgentPort); if (!Confirm(pSession, MSG_DEFAULT)) return CLIERR_OK; invoke.AddParam("2.10.2", pSession->szUser); if (!CLIAPI_Command(pSession, invoke.GetHandle(), "106.3")) return CLIERR_OK; invoke1.AddParam("2.10.2", pSession->szUser); invoke1.AddParam("2.10.3", argv[0]); invoke1.AddParam("2.10.4", pSession->nGroup); if (!CLIAPI_Command(pSession, invoke1.GetHandle(), "106.4")) return CLIERR_OK; OUTTEXT(pSession, "Password changed.\r\n"); return CLIERR_OK; }