summaryrefslogtreecommitdiffstats
path: root/ast/cexpand.pl
blob: 0795c04a9703f55dd5b0fee37d36253510fadfad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/star/Perl/bin/perl
   while( $line = <STDIN> ) {
      chomp( $line );
      if( $line =~ /^\/\*(.*)\*\/\s*$/ ) {
         print "\n/*";
         $len = 0;
         foreach $word ( split '\s+', $1 ) {
            $len += length( $word ) + 1;
            if( $len > 70 ) {
               print "\n   ";
               $len = length( $word ) + 1;
            }
            print " $word";
         }
         print " */\n";

      } else {
         print "$line\n";
      }

   }