Author: tpot Date: 2005-06-03 12:31:56 +0000 (Fri, 03 Jun 2005) New Revision: 7225
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7225 Log: Create a MprVar object from a NTSTATUS, e.g: res: { is_err: true, is_ok: false, errstr: "NT_STATUS_IO_TIMEOUT", v: -1073741643 } Modified: branches/SAMBA_4_0/source/scripting/ejs/mprutil.c Changeset: Modified: branches/SAMBA_4_0/source/scripting/ejs/mprutil.c =================================================================== --- branches/SAMBA_4_0/source/scripting/ejs/mprutil.c 2005-06-03 12:13:33 UTC (rev 7224) +++ branches/SAMBA_4_0/source/scripting/ejs/mprutil.c 2005-06-03 12:31:56 UTC (rev 7225) @@ -166,3 +166,26 @@ return list; } +/* + turn a NTSTATUS into a MprVar object with lots of funky properties +*/ +struct MprVar mprNTSTATUS(NTSTATUS status) +{ + struct MprVar res, val; + + res = mprCreateObjVar("ntstatus", MPR_DEFAULT_HASH_SIZE); + + val = mprCreateStringVar(nt_errstr(status), 1); + mprCreateProperty(&res, "errstr", &val); + + val = mprCreateIntegerVar(NT_STATUS_V(status)); + mprCreateProperty(&res, "v", &val); + + val = mprCreateBoolVar(NT_STATUS_IS_OK(status)); + mprCreateProperty(&res, "is_ok", &val); + + val = mprCreateBoolVar(NT_STATUS_IS_ERR(status)); + mprCreateProperty(&res, "is_err", &val); + + return res; +}