Cleanup of warnings

This commit is contained in:
Ole Tange 2009-03-12 16:35:05 +01:00
parent f38da581b7
commit b166d16217
2 changed files with 12 additions and 11 deletions

View file

@ -6,7 +6,7 @@ parallel - build and execute command lines from standard input in parallel
=head1 SYNOPSIS =head1 SYNOPSIS
B<parallel> [options] [command [arguments]] < list_of_arguments B<parallel> [-0cfgqsuvx] [-j num] [command [arguments]] < list_of_arguments
=head1 DESCRIPTION =head1 DESCRIPTION
@ -319,6 +319,7 @@ use IO::File;
use POSIX ":sys_wait_h"; use POSIX ":sys_wait_h";
use File::Temp qw/ tempfile tempdir /; use File::Temp qw/ tempfile tempdir /;
use Getopt::Std; use Getopt::Std;
use strict;
my ($processes,$command); my ($processes,$command);
getopts("0cdefgj:qsuvx") || die_usage(); getopts("0cdefgj:qsuvx") || die_usage();
@ -385,7 +386,7 @@ sub generate_command_line {
# Emulate xargs if there is a command and -x is set # Emulate xargs if there is a command and -x is set
$arg_length += length $next_arg + 1; $arg_length += length $next_arg + 1;
debug("arglen $arg_length\n"); debug("arglen $arg_length\n");
$job_line_length = length($command) + 1 + $arg_length; my $job_line_length = length($command) + 1 + $arg_length;
debug("linelen $job_line_length\n"); debug("linelen $job_line_length\n");
if($job_line_length >= $Global::command_line_max_len) { if($job_line_length >= $Global::command_line_max_len) {
unget_arg(pop @quoted_args); unget_arg(pop @quoted_args);
@ -450,7 +451,7 @@ sub binary_find_max_length {
my ($lower, $upper) = (@_); my ($lower, $upper) = (@_);
if($lower == $upper or $lower == $upper-1) { return $lower; } if($lower == $upper or $lower == $upper-1) { return $lower; }
my $middle = int (($upper-$lower)/2 + $lower); my $middle = int (($upper-$lower)/2 + $lower);
$debug && print "$lower,$upper,$middle\n"; debug("$lower,$upper,$middle\n");
if (is_acceptable_command_line_length($middle)) { if (is_acceptable_command_line_length($middle)) {
return binary_find_max_length($middle,$upper); return binary_find_max_length($middle,$upper);
} else { } else {
@ -464,7 +465,7 @@ sub is_acceptable_command_line_length {
# (Can this be done prettier?) # (Can this be done prettier?)
my $len = shift; my $len = shift;
my $testscript = q{'system ("true "."x"x$ARGV[0]); exit $?;'}; my $testscript = q{'system ("true "."x"x$ARGV[0]); exit $?;'};
$debug && print "perl -e $testscript $len\n"; debug("perl -e $testscript $len\n");
system "perl -e $testscript $len"; system "perl -e $testscript $len";
return not $?; return not $?;
} }
@ -493,6 +494,7 @@ sub processes_available_by_system_limit {
my $spawning_too_slow=0; my $spawning_too_slow=0;
my $time = time; my $time = time;
my %fh; my %fh;
my @children;
DoNotReap(); DoNotReap();
# Reserve filehandles # Reserve filehandles
@ -517,6 +519,7 @@ sub processes_available_by_system_limit {
# System process limit # System process limit
$system_limit % 10 or $time=time; $system_limit % 10 or $time=time;
my $child;
if($child = fork()) { if($child = fork()) {
push (@children,$child); push (@children,$child);
} elsif(defined $child) { } elsif(defined $child) {
@ -557,7 +560,7 @@ sub processes_available_by_system_limit {
# Cleanup: Close the files # Cleanup: Close the files
for (keys %fh) { close $fh{$_} } for (keys %fh) { close $fh{$_} }
# Cleanup: Kill the children # Cleanup: Kill the children
for $pid (@children) { for my $pid (@children) {
kill 15, $pid; kill 15, $pid;
waitpid($pid,0); waitpid($pid,0);
} }
@ -836,7 +839,7 @@ sub die_usage {
sub usage { sub usage {
print "Usage:\n"; print "Usage:\n";
print "parallel [options] [command [arguments]] < list_of_arguments\n"; print "parallel [-0cfgqsuvx] [command [arguments]] < list_of_arguments\n";
} }
# #
@ -904,5 +907,3 @@ $main::opt_u = $main::opt_c = $main::opt_f = $main::opt_q =
$main::opt_0 = $main::opt_s = $main::opt_v = $main::opt_g = $main::opt_0 = $main::opt_s = $main::opt_v = $main::opt_g =
$main::opt_j = $main::opt_d = $main::opt_x =1; $main::opt_j = $main::opt_d = $main::opt_x =1;
$Global::xargs = 1; $Global::xargs = 1;

View file

@ -1,4 +1,4 @@
.\" Automatically generated by Pod::Man 2.18 (Pod::Simple 3.05) .\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05)
.\" .\"
.\" Standard preamble: .\" Standard preamble:
.\" ======================================================================== .\" ========================================================================
@ -124,7 +124,7 @@
.\" ======================================================================== .\" ========================================================================
.\" .\"
.IX Title "PARALLEL 1" .IX Title "PARALLEL 1"
.TH PARALLEL 1 "2009-02-18" "perl v5.10.0" "User Contributed Perl Documentation" .TH PARALLEL 1 "2009-03-12" "perl v5.10.0" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents. .\" way too many mistakes in technical documents.
.if n .ad l .if n .ad l
@ -133,7 +133,7 @@
parallel \- build and execute command lines from standard input in parallel parallel \- build and execute command lines from standard input in parallel
.SH "SYNOPSIS" .SH "SYNOPSIS"
.IX Header "SYNOPSIS" .IX Header "SYNOPSIS"
\&\fBparallel\fR [options] [command [arguments]] < list_of_arguments \&\fBparallel\fR [\-0cfgqsuvx] [\-j num] [command [arguments]] < list_of_arguments
.SH "DESCRIPTION" .SH "DESCRIPTION"
.IX Header "DESCRIPTION" .IX Header "DESCRIPTION"
For each line of input \fBparallel\fR will execute \fBcommand\fR with the For each line of input \fBparallel\fR will execute \fBcommand\fR with the