/*
- 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);
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");
/*
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");
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");
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");
/*
}
}
-
-
-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");