help-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[help-texinfo] texi2dvi: Preserve foo.log


From: Akim Demaille
Subject: [help-texinfo] texi2dvi: Preserve foo.log
Date: Tue, 21 Jun 2005 10:37:04 +0200
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Hi!

I think this behavior is better.  Maybe copying back the log file is
wrong on success, I'm really unsure on this part, but since we copy it
back on failure, it should obey -o too.  But maybe we should not copy
it back either?

2005-06-21  Akim Demaille  <address@hidden>

        Always copy the log file back, and under the same name as the
        actual output.
        * util/texi2dvi (move_to_dest): New.
        (run_tex): Use it.

Index: util/texi2dvi
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/texi2dvi,v
retrieving revision 1.54
diff -u -u -r1.54 texi2dvi
--- util/texi2dvi 10 Jun 2005 13:44:47 -0000 1.54
+++ util/texi2dvi 21 Jun 2005 08:33:03 -0000
@@ -317,6 +319,30 @@
   echo "$_res"
 }
 
+# move_to_dest FILE
+# -----------------
+# Move the FILE to the place where the user expects it.  FILE can be
+# the principal output (in which case -o directly apply), or an auxiliary
+# file with the same base name.
+move_to_dest ()
+{
+  set -x
+  _file_noext=`echo "$1" | sed 's/\.[^.]*$//'`
+  _file_ext=`echo "$1" | sed 's/^.*\.//'`
+  _out_noext=`echo "$oname" | sed 's/\.[^.]*$//'`
+  _out_ext=`echo "$oname" | sed 's/^.*\.//'`
+
+  case $tidy:$oname in
+    true:)  _dest=$orig_pwd;;
+    false:) _dest=;;
+    *:*)    _dest=$_out_noext.$_file_ext;;
+  esac
+  if test -n "$_dest"; then
+    verbose "Copying $1 to $_dest"
+    cp -p "$1" "$_dest"
+  fi
+}
+
 
 ## ----------------------- ##
 ## Running the TeX suite.  ##
@@ -349,19 +375,9 @@
 
   verbose "Running $cmd ..."
   if eval "$cmd" >&5; then
-    # Update the actual output.
-    case $tidy:$oname in
-      true:)  dest=$orig_pwd;;
-      false:) dest=;;
-      *:*)    dest=$oname;;
-    esac
-    if test -n "$dest"; then
-      verbose "Copying $oformat file from `pwd` to $dest"
-      cp -p "./$filename_noext.$oformat" "$dest"
-    fi
+    move_to_dest "$filename_noext.$oformat"
   else
-    $tidy &&
-      cp "$filename_noext.log" "$orig_pwd"
+    move_to_dest "$filename_noext.log"
     fatal 1 "$tex exited with bad status, quitting." \
             "see $filename_noext.log for errors."
   fi

reply via email to

[Prev in Thread] Current Thread [Next in Thread]