Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1#!/usr/bin/perl
2# SPDX-License-Identifier: GPL-2.0
3# Prefix all lines with "# ", unbuffered. Command being piped in may need
4# to have unbuffering forced with "stdbuf -i0 -o0 -e0 $cmd".
5use strict;
6
7binmode STDIN;
8binmode STDOUT;
9
10STDOUT->autoflush(1);
11
12my $needed = 1;
13while (1) {
14 my $char;
15 my $bytes = sysread(STDIN, $char, 1);
16 exit 0 if ($bytes == 0);
17 if ($needed) {
18 print "# ";
19 $needed = 0;
20 }
21 print $char;
22 $needed = 1 if ($char eq "\n");
23}