summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-07-04 23:21:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:47 -0500
commit4b1fbd17c4de11e9da610e3ecd83a975a8e64df2 (patch)
tree286af38c1d45c82ac4a6593ea12535d374640ed8 /examples
parent254e1ad28b095b54ac3df3c840c6a7f3b27da203 (diff)
downloadsamba-4b1fbd17c4de11e9da610e3ecd83a975a8e64df2.tar.gz
samba-4b1fbd17c4de11e9da610e3ecd83a975a8e64df2.tar.bz2
samba-4b1fbd17c4de11e9da610e3ecd83a975a8e64df2.zip
r23711: Refactor the actual creation of object into its own small function.
Michael (This used to be commit 26349c0b173e8baf6fa43deb39cb2bfdb31bf18e)
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/scripts/users_and_groups/createdomobj.pl17
1 files changed, 10 insertions, 7 deletions
diff --git a/examples/scripts/users_and_groups/createdomobj.pl b/examples/scripts/users_and_groups/createdomobj.pl
index 4bcfb8edf3..6568b21664 100755
--- a/examples/scripts/users_and_groups/createdomobj.pl
+++ b/examples/scripts/users_and_groups/createdomobj.pl
@@ -116,7 +116,7 @@ if (@ARGV) {
exit 1;
}
-# rpc open/close functions:
+# utility functions:
sub open_rpc_pipe {
print "opening rpc pipe\n";
@@ -129,20 +129,22 @@ sub close_rpc_pipe {
close(IPC);
}
+sub do_create {
+ my $target_name = shift;
+ print "creating $target_type $target_name\n";
+ print IPC "$rpc_cmd $target_name\n";
+}
+
# main:
open_rpc_pipe();
if ("x$startnum" eq "x") {
- my $target_name = $prefix;
- print "creating $target_type $target_name\n";
- print IPC "$rpc_cmd $target_name\n";
+ do_create($prefix);
}
else {
for (my $num = 1; $num <= $num_targets; ++$num) {
- my $target_name = sprintf "%s%.05d", $prefix, $startnum + $num - 1;
- print "creating $target_type $target_name\n";
- print IPC "$rpc_cmd $target_name\n";
+ do_create(sprintf "%s%.05d", $prefix, $startnum + $num - 1);
if (($num) % 500 == 0) {
printf("500 ".$target_type."s created\n");
close_rpc_pipe();
@@ -151,5 +153,6 @@ else {
}
}
}
+
close_rpc_pipe();