1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-04 08:22:08 +03:00

r23711: Refactor the actual creation of object into its own small function.

Michael
(This used to be commit 26349c0b17)
This commit is contained in:
Michael Adam
2007-07-04 23:21:51 +00:00
committed by Gerald (Jerry) Carter
parent 254e1ad28b
commit 4b1fbd17c4

View File

@ -116,7 +116,7 @@ if (@ARGV) {
exit 1; exit 1;
} }
# rpc open/close functions: # utility functions:
sub open_rpc_pipe { sub open_rpc_pipe {
print "opening rpc pipe\n"; print "opening rpc pipe\n";
@ -129,20 +129,22 @@ sub close_rpc_pipe {
close(IPC); close(IPC);
} }
sub do_create {
my $target_name = shift;
print "creating $target_type $target_name\n";
print IPC "$rpc_cmd $target_name\n";
}
# main: # main:
open_rpc_pipe(); open_rpc_pipe();
if ("x$startnum" eq "x") { if ("x$startnum" eq "x") {
my $target_name = $prefix; do_create($prefix);
print "creating $target_type $target_name\n";
print IPC "$rpc_cmd $target_name\n";
} }
else { else {
for (my $num = 1; $num <= $num_targets; ++$num) { for (my $num = 1; $num <= $num_targets; ++$num) {
my $target_name = sprintf "%s%.05d", $prefix, $startnum + $num - 1; do_create(sprintf "%s%.05d", $prefix, $startnum + $num - 1);
print "creating $target_type $target_name\n";
print IPC "$rpc_cmd $target_name\n";
if (($num) % 500 == 0) { if (($num) % 500 == 0) {
printf("500 ".$target_type."s created\n"); printf("500 ".$target_type."s created\n");
close_rpc_pipe(); close_rpc_pipe();
@ -151,5 +153,6 @@ else {
} }
} }
} }
close_rpc_pipe(); close_rpc_pipe();