1
0
mirror of https://github.com/samba-team/samba.git synced 2025-10-30 08:23:49 +03:00

r8318: added a bunch more ejs calls.

getgr*()
  getpw*()
  strlower()
  strupper()
  IfaceList()
This commit is contained in:
Andrew Tridgell
2005-07-11 09:19:50 +00:00
committed by Gerald (Jerry) Carter
parent 5f079d7463
commit 1517ad490d
7 changed files with 249 additions and 4 deletions

View File

@@ -64,6 +64,20 @@ static int ejs_typeof(MprVarHandle eid, int argc, struct MprVar **argv)
return 0;
}
/*
return the list of configured network interfaces
*/
static int ejs_IfaceList(MprVarHandle eid, int argc, struct MprVar **argv)
{
int i, count = iface_count();
struct MprVar ret = mprCreateObjVar("interfaces", MPR_DEFAULT_HASH_SIZE);
for (i=0;i<count;i++) {
mprAddArray(&ret, i, mprString(iface_n_ip(i)));
}
mpr_Return(eid, ret);
return 0;
}
/*
libinclude() allows you to include js files using a search path specified
@@ -123,8 +137,11 @@ void smb_setup_ejs_functions(void)
smb_setup_ejs_rpc();
smb_setup_ejs_auth();
smb_setup_ejs_options();
smb_setup_ejs_nss();
smb_setup_ejs_string();
ejsDefineCFunction(-1, "typeof", ejs_typeof, NULL, MPR_VAR_SCRIPT_HANDLE);
ejsDefineCFunction(-1, "IfaceList", ejs_IfaceList, NULL, MPR_VAR_SCRIPT_HANDLE);
ejsDefineStringCFunction(-1, "libinclude", ejs_libinclude, NULL, MPR_VAR_SCRIPT_HANDLE);
}