From c663607f257b8afb7d3ef84f0dae7569b7c525fb Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Mon, 10 Mar 2003 16:21:31 +0000 Subject: [PATCH] Small clean-up. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6425 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/ChangeLog | 2 ++ lib/scripts/lyxpreview2bitmap.sh | 22 +++++++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 9ae19278f9..340265fb85 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -4,6 +4,8 @@ 'latex', 'dvips', 'gs' and 'pnmcrop' and move their definition to the top of the script. + * scripts/lyxpreview2bitmap.sh: enable BAIL_OUT to print a message. + 2003-03-10 Angus Leeming * images/graphics-insert.xpm: rename as diff --git a/lib/scripts/lyxpreview2bitmap.sh b/lib/scripts/lyxpreview2bitmap.sh index f6a8562885..dfcd7e9991 100644 --- a/lib/scripts/lyxpreview2bitmap.sh +++ b/lib/scripts/lyxpreview2bitmap.sh @@ -72,6 +72,8 @@ FIND_IT () BAIL_OUT () { + test $# -eq 1 && echo $1 + # Remove everything except the original .tex file. FILES=`ls ${BASE}* | sed -e "/${BASE}\.tex/d"` rm -f ${FILES} texput.log @@ -105,9 +107,8 @@ elif [ "$3" = "png" ]; then GSDEVICE=png16m GSSUFFIX=png else - echo "Unrecognised output format ${OUTPUTFORMAT}." - echo "Expected either \"ppm\" or \"png\"." - BAIL_OUT + BAIL_OUT "Unrecognised output format ${OUTPUTFORMAT}. \ + Expected either \"ppm\" or \"png\"." fi # We use latex, dvips and gs, so check that they're all there. @@ -127,8 +128,7 @@ readonly TEXFILE LOGFILE DVIFILE PSFILE METRICSFILE cd ${DIR} ${LATEX} ${TEXFILE} || { - echo "Failed: ${LATEX} ${TEXFILE}" - BAIL_OUT + BAIL_OUT "Failed: ${LATEX} ${TEXFILE}" } # Parse ${LOGFILE} to obtain bounding box info to output to @@ -137,9 +137,8 @@ ${LATEX} ${TEXFILE} || # "Preview: Snippet". grep -E 'Preview: [ST]' ${LOGFILE} > ${METRICSFILE} || { - echo "Failed: grep -E 'Preview: [ST]' ${LOGFILE}" REQUIRED_VERSION ${LOGFILE} - BAIL_OUT + BAIL_OUT "Failed: grep -E 'Preview: [ST]' ${LOGFILE}" } # Parse ${LOGFILE} to obtain ${RESOLUTION} for the gs process to follow. @@ -148,9 +147,8 @@ grep -E 'Preview: [ST]' ${LOGFILE} > ${METRICSFILE} || # not found. LINE=`grep 'Preview: Fontsize' ${LOGFILE}` || { - echo "Failed: grep 'Preview: Fontsize' ${LOGFILE}" REQUIRED_VERSION ${LOGFILE} - BAIL_OUT + BAIL_OUT "Failed: grep 'Preview: Fontsize' ${LOGFILE}" } # The sed script strips out everything that won't form a decimal number # from the line. It bails out after the first match has been made in @@ -179,8 +177,7 @@ RESOLUTION=`echo "scale=2; \ # DVI -> PostScript ${DVIPS} -o ${PSFILE} ${DVIFILE} || { - echo "Failed: ${DVIPS} -o ${PSFILE} ${DVIFILE}" - BAIL_OUT + BAIL_OUT "Failed: ${DVIPS} -o ${PSFILE} ${DVIFILE}" } # PostScript -> Bitmap files @@ -201,8 +198,7 @@ ${GS} -q -dNOPAUSE -dBATCH -dSAFER \ -dGraphicsAlphaBit=${ALPHA} -dTextAlphaBits=${ALPHA} \ -r${RESOLUTION} ${PSFILE} || { - echo "Failed: ${GS} ${PSFILE}" - BAIL_OUT + BAIL_OUT "Failed: ${GS} ${PSFILE}" } # All has been successful, so remove everything except the bitmap files -- 2.39.2