[project @ 1998-02-04 20:53:43 by sof]
authorsof <unknown>
Wed, 4 Feb 1998 20:53:43 +0000 (20:53 +0000)
committersof <unknown>
Wed, 4 Feb 1998 20:53:43 +0000 (20:53 +0000)
Avoid use of system() for simple stuff like touching.

ghc/utils/mkdependHS/mkdependHS.prl

index c8f6daf..afad027 100644 (file)
@@ -193,16 +193,15 @@ foreach $sf (@Src_files) {
 }
 
 
-# OK, mangle the Makefile
-unlink("$Makefile.bak");
-
 #
-# If no output file exist as yet, create one.
+# Create backup version of output file.
 # 
-if ( ! -f $Makefile.bak ) {
-   system("touch $Makefile.bak");
-} 
-if ( -f $Makefile ) {
+if ( ! -f $Makefile ) {
+   # truncate() may not be implemented, so we
+   # play it safe here.
+   local(*TRUNC);
+   open(TRUNC,"> $Makefile.bak") && close(TRUNC);
+} else {
    rename($Makefile,"$Makefile.bak");
 }
 # now copy Makefile.bak into Makefile, rm'ing old dependencies