void xs_tftpd_start(xsMachine *the) { int s; void *instance; xsVars(1); xsGet(xsVar(0), xsArg(0), xsID("nativeSocket")); s = xsToInteger(xsVar(0)); instance = tftpd_connect(s, the, &xsThis); if (instance == NULL) mc_xs_throw(the, "tftpd: no mem"); xsSetHostData(xsThis, instance); }
void xs_tftpd_connect(xsMachine *the) { int s; void *instance; xsVars(1); xsGet(xsVar(0), xsArg(0), xsID("nativeSocket")); s = xsToInteger(xsVar(0)); instance = tftpd_connect(s, the, &xsThis); if (instance == NULL) { xsSetBoolean(xsResult, 0); return; } xsSetHostData(xsThis, instance); xsSetBoolean(xsResult, 1); }