repo.or.cz
/
hband-tools.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
new tool
[hband-tools.git]
/
user-tools
/
header
blob
f7299f3655b30f8f7dddee4d653c6286c41eb1d5
1
#!/usr/bin/env perl
2
3
=pod
4
5
=head1 NAME
6
7
header - Echo the input stream up to the first empty line (usual end-of-header marker)
8
9
=head1 SYNOPSIS
10
11
header I<FILE> [I<FILE> [I<FILE> [...]]]
12
13
header < I<FILE>
14
15
=cut
16
17
if
(
not
@ARGV
)
18
{
19
push
@ARGV
,
'/dev/stdin'
;
20
}
21
22
for
my
$idx
(
0
..
$#ARGV
)
23
{
24
my
$path
=
$ARGV
[
$idx
];
25
open my
$fh
,
'<'
,
$path
;
26
while
(<
$fh
>)
27
{
28
last if
/^\r?\n?$/
;
29
print
;
30
}
31
if
(
$idx
<
$#ARGV
)
32
{
33
print
"
\n
"
;
34
}
35
}