1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-25 17:57:42 +03:00

r8317: convert the example scripts over to the new GetOptions() call

(This used to be commit 5f079d74630cf6431ec8af7240f60054cf8b9ab7)
This commit is contained in:
Andrew Tridgell 2005-07-11 07:43:36 +00:00 committed by Gerald (Jerry) Carter
parent f583a85d4d
commit 1864b27857
4 changed files with 54 additions and 11 deletions

View File

@ -1,7 +1,18 @@
/*
demonstrate use of argv
demonstrate use of GetOptions
*/
var ok;
var options = new Object();
ok = GetOptions(ARGV, options,
"POPT_AUTOHELP",
"POPT_COMMON_SAMBA",
"myopt=s",
"intopt=i",
"noopt");
printVars(ok);
println("You called this script with arguments:");
printVars(ARGV);
printVars(options);

View File

@ -3,6 +3,17 @@
test echo pipe calls from ejs
*/
var options = new Object();
ok = GetOptions(ARGV, options,
"POPT_AUTOHELP",
"POPT_COMMON_SAMBA",
"POPT_COMMON_CREDENTIALS");
if (ok == false) {
println("Failed to parse options: " + options.ERROR);
return -1;
}
libinclude("base.js");
/*
@ -198,7 +209,11 @@ if (ARGV.length == 0) {
exit(0);
}
var binding = ARGV[0];
if (options.ARGV.length != 1) {
println("Usage: samr.js <BINDING>");
return -1;
}
var binding = options.ARGV[0];
var conn = new Object();
print("Connecting to " + binding + "\n");

View File

@ -3,6 +3,16 @@
demonstrate access to irpc calls from ejs
*/
var options = new Object();
ok = GetOptions(ARGV, options,
"POPT_AUTOHELP",
"POPT_COMMON_SAMBA");
if (ok == false) {
println("Failed to parse options: " + options.ERROR);
return -1;
}
var conn = new Object();
status = irpc_connect(conn, "nbt_server");

View File

@ -3,9 +3,19 @@
test samr calls from ejs
*/
var options = new Object();
ok = GetOptions(ARGV, options,
"POPT_AUTOHELP",
"POPT_COMMON_SAMBA",
"POPT_COMMON_CREDENTIALS");
if (ok == false) {
println("Failed to parse options: " + options.ERROR);
return -1;
}
libinclude("base.js");
libinclude("samr.js");
libinclude("samr.js");
/*
@ -96,14 +106,11 @@ function test_EnumDomains(conn, handle)
}
}
if (ARGV.length == 0) {
print("Usage: samr.js <RPCBINDING>\n");
exit(0);
if (options.ARGV.length != 1) {
println("Usage: samr.js <BINDING>");
return -1;
}
var binding = ARGV[0];
var binding = options.ARGV[0];
var conn = new Object();
print("Connecting to " + binding + "\n");