221
|
1 #!/usr/bin/env perl
|
150
|
2 #
|
|
3 # Simple little Perl script that takes the cxx-sections.data file as
|
|
4 # input and generates a directory structure that mimics the standard's
|
|
5 # structure.
|
|
6 use English;
|
221
|
7 use warnings;
|
150
|
8
|
|
9 $current_indent_level = -4;
|
|
10 while ($line = <STDIN>) {
|
|
11 $line =~ /^\s*/;
|
|
12 $next_indent_level = length($MATCH);
|
|
13 if ($line =~ /\[([^\]]*)\]/) {
|
|
14 my $section = $1;
|
|
15 while ($next_indent_level < $current_indent_level) {
|
|
16 chdir("..");
|
|
17 $current_indent_level -= 4;
|
|
18 }
|
|
19
|
|
20 if ($next_indent_level == $current_indent_level) {
|
|
21 chdir("..");
|
|
22 } else {
|
|
23 $current_indent_level = $next_indent_level;
|
|
24 }
|
|
25 mkdir($section);
|
|
26 chdir($section);
|
|
27 }
|
|
28 }
|