X-Git-Url: http://git.samba.org/samba.git/?p=ira%2Fwip.git;a=blobdiff_plain;f=examples%2Fscripts%2Fusers_and_groups%2Fcreatedomobj.pl;h=36e0c0f9fd080865f2cf9927c0f33dcc0d6d815e;hp=4bcfb8edf3e29ba3bc70d56ed45c08f06adea7fd;hb=57d6b313dfb29cb753f66358d972e473b7d251da;hpb=85f7c7127f6542850282a3f86451e8e4e16736c6 diff --git a/examples/scripts/users_and_groups/createdomobj.pl b/examples/scripts/users_and_groups/createdomobj.pl index 4bcfb8edf3e..36e0c0f9fd0 100755 --- a/examples/scripts/users_and_groups/createdomobj.pl +++ b/examples/scripts/users_and_groups/createdomobj.pl @@ -10,7 +10,7 @@ # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free -# Software Foundation; either version 2 of the License, or (at your option) +# Software Foundation; either version 3 of the License, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, but WITHOUT @@ -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();