fort77 (1.15-8) fort77.in

Summary

 fort77.in |   21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

    
download this patch

Patch contents

--- fort77-1.15.orig/fort77.in
+++ fort77-1.15/fort77.in
@@ -12,6 +12,8 @@
 $debug = 0;
 $debugcmd = "";
 
+$cppcmd = "/lib/cpp -traditional";
+
 # Loop over all options; pull all options from @ARGV and put all
 # arguments into @argv.	 This is needed because, apparently, UNIX
 # compilers acceppt options anywhere on the command line.
@@ -32,7 +34,7 @@
 
     if (/^-[CUuaEhRrz]$/ || /^-I[24]$/ || /^-onetrip$/ || /^-![clPR]$/ ||
 	/^-ext$/ || /^-!bs$/ || /^-W[1-9][0-9]*$/ || /^-w8$/ || /^-w66$/ ||
-	/^-r8$/ || /^-N[^n][0-9]+$/) {
+	/^-r8$/ || /^-N[^n][0-9]+$/ || /^-trapuv$/) {
 	push (@fopts, $_);
     }
     elsif (/^-Nn[0-9]+$/) {
@@ -208,7 +210,7 @@
     $lfile = "";
     $basefile = "";
 
-    if (/\.[fF]$/) {
+    if (/\.[fF]$/ || (/\.[fF][oO][rR]$/)) {
 	$ffile = $_;
 	$basefile = $ffile;
     }
@@ -229,12 +231,12 @@
 	    $cfile = "$tmpdir/fort77-$$-$seq.c";
 	}
 	if ($debug) {
-	    $debugcmd = ' | @PERL@ -p -e \'s/^(#line.*)""/$1"'
-		. $ffile . '"/\' '
+	    $debugcmd = ' | @PERL@ -p -e \'s|^(#line.*)""|$1"'
+		. $ffile . '"|\' '
 	}
 	if ($cpp || ($ffile =~ /\.F$/)) {
 #         Backslashes at the end of comment lines confuse cpp...
-	    $pipe =  "| @CPP@ -traditional " . 
+	    $pipe =  "| $cppcmd " . 
 		join(' ',@cppopts) . " | @F2C@ " .
 		    join(' ',@fopts) . $debugcmd . " > $cfile";
 	    print STDERR "$0: Running \"$pipe\"" if $verbose;
@@ -258,6 +260,7 @@
 	if ($retcode && !$keep_c) {
 	    print STDERR "$0: unlinking $cfile\n" if $verbose;
 	    unlink $cfile;
+            $? = $retcode;  # Is this right?  Seems to work -- broonie
 	    die "$0: aborting compilation\n";
 	}
 
@@ -266,9 +269,9 @@
 	if ($extract_prototypes) {
 	    $pfile = ($basefile =~ /([^\/]*\.).$/)[0] . "P";
 	    open(CFILE, "$cfile") || die ("$0: Cannot open $cfile\n");
-	    while (($line = <CFILE>) &&
-		   ($line !~ '#ifdef P_R_O_T_O_T_Y_P_E_S\n')) {
-		print $line;
+	    while ((<CFILE>) &&
+		   ($_ !~ '#ifdef P_R_O_T_O_T_Y_P_E_S\n')) {
+		print $_;
 	    }
 	    if ($_) {
 		open(PFILE, ">$pfile") || die ("$0: Cannot open $pfile\n");
@@ -289,7 +292,7 @@
 	    push(@command,'-o',$output,$compile_only);
 	}
 	elsif ((!$compile_only) || ($compile_only eq '-c')) {
-	    $lfile = ($basefile =~ /([^\/]*\.).$/)[0] . "o";
+	    $lfile = ($basefile =~ /([^\/\.]*\.).*$/)[0] . "o";
 	    push(@command, '-c', '-o', $lfile);
 	}
 	elsif ($compile_only eq '-S') {