/usr/bin/eztrace_indent_fortran is in eztrace 1.1-2-1ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #!/usr/bin/perl -w
use strict;
use warnings;
#############################################################"
package main;
sub indent_file( $$ ) {
my $input_handle = shift;
my $output_handle = shift;
my $concatenate=0;
my $current_concatenation="";
while(<$input_handle>) {
my $currentLine = $_;
if($currentLine =~ m/^\s*subroutine.+\(/) {
$concatenate=1;
$current_concatenation="";
}
if($concatenate == 1) {
$currentLine=~ s/\n//;
$currentLine=~ s/^\s*>//;
$currentLine=~ s/^\s*\$//;
$currentLine=~ s/^\s+//g;
$current_concatenation.=$currentLine;
if($currentLine =~ m/\)/) {
# end of the subroutine prototype
$concatenate=0;
$currentLine=$current_concatenation."\n";
}
}
if($concatenate==0) {
printf $output_handle "%s", $currentLine;
}
}
}
if(@ARGV < 1) {
printf STDERR "Usage: $0 input_file [output_file]\n";
exit 1;
}
my $output_file;
my $input_file=$ARGV[0];
my $input_handle;
my $output_handle;
if(@ARGV != 2) {
$output_handle=*STDOUT;
} else {
$output_file=$ARGV[1];
open($output_handle, '>', $output_file)
or die "Couldn't open $output_file for writing!";
}
open($input_handle, '<', $input_file)
or die "Couldn't open $input_file for reading!";
indent_file($input_handle, $output_handle);
if(@ARGV == 2) {
close($output_handle);
printf "Output trace: %s\n", $output_file;
}
close($input_handle);
|