Skip to content

Commit f5c1c2a

Browse files
authored
Merge pull request briandfoy#295 from mknos/wc-basename
wc: report file arguments as provided
2 parents 26ce0a8 + ae2b454 commit f5c1c2a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

bin/wc

+5-7
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,11 @@ sub wc_fh {
212212
$total_paras += $paras;
213213
$total_lines += $lines; $total_words += $words;
214214
$total_chars += $chars; $total_bytes += $bytes;
215-
$out = do {
216-
if (defined($filename)) {
217-
sprintf(" %s\n",basename($filename))
218-
} else {
219-
"\n"
220-
}
221-
};
215+
if (defined $filename) {
216+
$out = " $filename\n";
217+
} else {
218+
$out = "\n";
219+
}
222220
$out = sprintf(" %9u%s",$bytes,$out) if ($opt{'c'});
223221
$out = sprintf(" %9u%s",$chars,$out) if ($opt{'m'});
224222
$out = sprintf(" %9u%s",$words,$out) if ($opt{'w'});

0 commit comments

Comments
 (0)