std sh til-kron
[sunny256-utils.git] / cfold
blob702367134d0d52f5e73747271b810ac849042155
1 #!/usr/bin/env perl
3 # cfold
4 # File ID: 602c35c8-5d37-11df-a51d-90e6ba3022ac
5 # Inserts fold marks in C source before and after stdin.
6 # Select text in visual line mode and filter the block through this script.
8 use strict;
9 use warnings;
11 $| = 1;
13 my $Line = <STDIN>;
14 my ($Indent, $Title) = ("", "");
16 defined($ARGV[0]) && ($Title = join(" ", @ARGV) . " ");
17 $Line =~ /^(\s+)/ && ($Indent = $1);
18 print("$Indent/* $Title\x7B\x7B\x7B */\n$Line");
20 while (<STDIN>) {
21 print($_);
24 print("$Indent/* \x7D\x7D\x7D */\n");