1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r7261: Pass by reference is done in js via MPR_TYPE_OBJECT. Update argument

parsing and example for resolveName().
(This used to be commit 1a4a549317)
This commit is contained in:
Tim Potter 2005-06-04 03:32:18 +00:00 committed by Gerald (Jerry) Carter
parent 6ade5fc245
commit b124351079
2 changed files with 13 additions and 7 deletions

View File

@ -271,6 +271,11 @@ static int ejs_resolve_name(MprVarHandle eid, int argc, struct MprVar **argv)
goto done;
}
if (argv[0]->type != MPR_TYPE_OBJECT) {
ejsSetErrorMsg(eid, "resolvename invalid arguments");
goto done;
}
if (argv[1]->type != MPR_TYPE_STRING) {
ejsSetErrorMsg(eid, "resolveName invalid arguments");
goto done;
@ -291,8 +296,8 @@ static int ejs_resolve_name(MprVarHandle eid, int argc, struct MprVar **argv)
nt_status = resolve_name(&name, tmp_ctx, &reply_addr);
if (NT_STATUS_IS_OK(nt_status)) {
mprDestroyAllVars(argv[0]);
*argv[0] = mprCreateStringVar(reply_addr, True);
mprSetPropertyValue(argv[0], "value",
mprCreateStringVar(reply_addr, 1));
}
ejsSetReturnValue(eid, mprNTSTATUS(nt_status));

View File

@ -2,11 +2,12 @@
Demonstrate use of resolveName() js function
*/
var result;
res = resolveName(result, "frogurt");
var result = new Object();
if (!res.is_ok) {
println(res.errstr);
res = resolveName(result, ARGV[0]);
if (res.is_ok) {
println(result.value);
} else {
println(result);
println(res.errstr);
}