diff options
author | joe <joe@FreeBSD.org> | 2000-10-18 17:48:10 +0000 |
---|---|---|
committer | joe <joe@FreeBSD.org> | 2000-10-18 17:48:10 +0000 |
commit | e8f6f29b2cc1e2f1b5374e825b1285d5cc5414aa (patch) | |
tree | a393fb885b35955d018bb116ffeafc1ada3cb306 | |
parent | 21e1325b98a47f8eefa5782ff99df94d52d92c6f (diff) | |
download | FreeBSD-src-e8f6f29b2cc1e2f1b5374e825b1285d5cc5414aa.zip FreeBSD-src-e8f6f29b2cc1e2f1b5374e825b1285d5cc5414aa.tar.gz |
Opening braces should be at the end of the controlling line. Else
and elsif belong on the same line as the closing brace for the
previous if or elsif block.
Suggested by: des
-rw-r--r-- | share/man/man7/style.perl.7 | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/share/man/man7/style.perl.7 b/share/man/man7/style.perl.7 index 7ca5493..a25fd99 100644 --- a/share/man/man7/style.perl.7 +++ b/share/man/man7/style.perl.7 @@ -137,7 +137,7 @@ blank line: my $pid; # Child PID local *PIPE; # Pipe my $output; # Output from command -} + } .Ed .Pp Whenever possible code should be run through the code checker @@ -150,6 +150,38 @@ or .Ar script.pl and produce no warnings. .Pp +Opening braces should be at the end of the controlling line. Else +and elsif belong on the same line as the closing brace for the +previous if or elsif block: +.Bd -literal -offset 0i + sub foo($@) { + my $cmd = shift; # Command to run + my @args = @_; # Arguments to command + + my $pid; # Child PID + local *PIPE; # Pipe + my $output; # Output from command + + unless (defined($pid = open(PIPE, "-|"))) { + die("open(): $!\\n"); + } elsif ($pid == 0) { + exec($cmd, @args); + die("exec(): $!\\n"); + } + $output = ""; + while (<PIPE>) { + $output .= $_; + } + waitpid($pid, 0); + if ($? & 0xff) { + die("$cmd caught a signal " . ($? & 0x7f) . "\\n"); + } elsif ($?) { + die("$cmd returned exit code " . ($? >> 8) . "\\n"); + } + return $output; + } +.Ed +.Pp Indentation and block style should follow .Xr style 9 where applicable. |