mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Don't use "if [ $? -ne 0 ]"; personally, I blame JMarc ;-)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5693 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c0eb43a927
commit
e27f7329c9
@ -1,3 +1,7 @@
|
||||
2002-11-21 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* scripts/lyxpreview2bitmap.sh: Don't use "if [ $? -ne 0 ]; then..."
|
||||
|
||||
2002-11-20 John Levon <levon@movementarian.org>
|
||||
|
||||
* images/math/: implement missing math icons
|
||||
|
@ -53,11 +53,11 @@
|
||||
|
||||
# Three helper functions.
|
||||
FIND_IT () {
|
||||
which ${EXECUTABLE} > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
which ${EXECUTABLE} > /dev/null ||
|
||||
{
|
||||
echo "Unable to find \"${EXECUTABLE}\". Please install."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
BAIL_OUT () {
|
||||
@ -110,33 +110,33 @@ METRICSFILE=${BASE}.metrics
|
||||
|
||||
# LaTeX -> DVI.
|
||||
cd ${DIR}
|
||||
latex ${TEXFILE}
|
||||
if [ $? -ne 0 ]; then
|
||||
latex ${TEXFILE} ||
|
||||
{
|
||||
echo "Failed: latex ${TEXFILE}"
|
||||
BAIL_OUT
|
||||
fi
|
||||
}
|
||||
|
||||
# Parse ${LOGFILE} to obtain bounding box info to output to
|
||||
# ${METRICSFILE}.
|
||||
# This extracts lines starting "Preview: Tightpage" and
|
||||
# "Preview: Snippet".
|
||||
grep -E 'Preview: [ST]' ${LOGFILE} > ${METRICSFILE}
|
||||
if [ $? -ne 0 ]; then
|
||||
grep -E 'Preview: [ST]' ${LOGFILE} > ${METRICSFILE} ||
|
||||
{
|
||||
echo "Failed: grep -E 'Preview: [ST]' ${LOGFILE}"
|
||||
REQUIRED_VERSION
|
||||
BAIL_OUT
|
||||
fi
|
||||
}
|
||||
|
||||
# Parse ${LOGFILE} to obtain ${RESOLUTION} for the gs process to follow.
|
||||
# 1. Extract font size from a line like "Preview: Fontsize 20.74pt"
|
||||
# Use grep for speed and because it gives an error if the line is
|
||||
# not found.
|
||||
LINE=`grep 'Preview: Fontsize' ${LOGFILE}`
|
||||
if [ $? -ne 0 ]; then
|
||||
LINE=`grep 'Preview: Fontsize' ${LOGFILE}` ||
|
||||
{
|
||||
echo "Failed: grep 'Preview: Fontsize' ${LOGFILE}"
|
||||
REQUIRED_VERSION
|
||||
BAIL_OUT
|
||||
fi
|
||||
}
|
||||
# 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
|
||||
# case there are multiple lines "Preview: Fontsize". (There shouldn't
|
||||
@ -148,11 +148,11 @@ LATEXFONT=`echo "${LINE}" | sed 's/[^0-9\.]//g; 1q'`
|
||||
# "Preview: Magnification 2074"
|
||||
# If no such line found, default to MAGNIFICATION=1000.
|
||||
LINE=`grep 'Preview: Magnification' ${LOGFILE}`
|
||||
if [ $? -ne 0 ]; then
|
||||
MAGNIFICATION=1000
|
||||
else
|
||||
if LINE=`grep 'Preview: Magnification' ${LOGFILE}`; then
|
||||
# Strip out everything that won't form an /integer/.
|
||||
MAGNIFICATION=`echo "${LINE}" | sed 's/[^0-9]//g; 1q'`
|
||||
else
|
||||
MAGNIFICATION=1000
|
||||
fi
|
||||
|
||||
# 3. Compute resolution.
|
||||
@ -162,11 +162,11 @@ RESOLUTION=`echo "scale=2; \
|
||||
| bc`
|
||||
|
||||
# DVI -> PostScript
|
||||
dvips -o ${PSFILE} ${DVIFILE}
|
||||
if [ $? -ne 0 ]; then
|
||||
dvips -o ${PSFILE} ${DVIFILE} ||
|
||||
{
|
||||
echo "Failed: dvips -o ${PSFILE} ${DVIFILE}"
|
||||
BAIL_OUT
|
||||
fi
|
||||
}
|
||||
|
||||
# PostScript -> Bitmap files
|
||||
# Older versions of gs have problems with a large degree of
|
||||
@ -184,12 +184,11 @@ fi
|
||||
gs -q -dNOPAUSE -dBATCH -dSAFER \
|
||||
-sDEVICE=${GSDEVICE} -sOutputFile=${BASE}%d.${GSSUFFIX} \
|
||||
-dGraphicsAlphaBit=${ALPHA} -dTextAlphaBits=${ALPHA} \
|
||||
-r${RESOLUTION} ${PSFILE}
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
-r${RESOLUTION} ${PSFILE} ||
|
||||
{
|
||||
echo "Failed: gs ${PSFILE}"
|
||||
BAIL_OUT
|
||||
fi
|
||||
}
|
||||
|
||||
# All has been successful, so remove everything except the bitmap files
|
||||
# and the metrics file.
|
||||
@ -200,11 +199,7 @@ rm -f ${FILES} texput.log
|
||||
# The bitmap files can have large amounts of whitespace to the left and
|
||||
# right. This can be cropped if so desired.
|
||||
CROP=1
|
||||
|
||||
which pnmcrop > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
CROP=0
|
||||
fi
|
||||
which pnmcrop > /dev/null || CROP=0
|
||||
|
||||
# There's no point cropping the image if using PNG images. If you want to
|
||||
# crop, use PPM.
|
||||
@ -212,8 +207,8 @@ fi
|
||||
if [ ${CROP} -eq 1 -a "${GSDEVICE}" = "pnmraw" ]; then
|
||||
for FILE in ${BASE}*.${GSSUFFIX}
|
||||
do
|
||||
pnmcrop -left ${FILE} | pnmcrop -right > ${BASE}.tmp
|
||||
if [ $? -eq 0 ]; then
|
||||
if pnmcrop -left ${FILE} 2> /dev/null |\
|
||||
pnmcrop -right 2> /dev/null > ${BASE}.tmp; then
|
||||
mv ${BASE}.tmp ${FILE}
|
||||
else
|
||||
rm -f ${BASE}.tmp
|
||||
@ -221,3 +216,5 @@ if [ ${CROP} -eq 1 -a "${GSDEVICE}" = "pnmraw" ]; then
|
||||
done
|
||||
rm -f ${BASE}.tmp
|
||||
fi
|
||||
|
||||
echo "Previews generated!"
|
||||
|
@ -1,5 +1,7 @@
|
||||
2002-11-21 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* forms/fdfix.sh: Don't use "if [ $? -ne 0 ]; then..."
|
||||
|
||||
* FormSpellchecker.C (updateState): new method, replacing Black Magic.
|
||||
Should also resolve Darren Freeman's redraw of the status bar problem.
|
||||
|
||||
|
@ -109,7 +109,6 @@ void FormSpellchecker::updateState(State state)
|
||||
|
||||
double const wordcount = controller().getCount();
|
||||
|
||||
// set slider 'finished' status
|
||||
fl_set_slider_bounds(dialog_->slider_progress, 0.0, wordcount);
|
||||
fl_set_slider_value(dialog_->slider_progress, wordcount);
|
||||
fl_set_object_label(dialog_->slider_progress, "100 %");
|
||||
|
@ -36,26 +36,28 @@ EOF
|
||||
#===============
|
||||
# Initial checks
|
||||
if [ ! -f $1 ]; then
|
||||
echo "Input file does not exist. Cannot continue"
|
||||
exit 1
|
||||
echo "Input file does not exist. Cannot continue"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIRNAME=`dirname $1`
|
||||
BASENAME=`basename $1 .fd`
|
||||
|
||||
if [ $1 = ${BASENAME} ]; then
|
||||
echo "Input file is not a .fd file. Cannot continue"
|
||||
exit 1
|
||||
echo "Input file is not a .fd file. Cannot continue"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#===================================
|
||||
# Create the initial .c and .h files
|
||||
FDESIGN=fdesign
|
||||
FDFILE=${BASENAME}.fd
|
||||
if (cd ${DIRNAME} && ${FDESIGN} -convert ${FDFILE}); then : ; else
|
||||
echo "\"${FDESIGN} -convert ${FDFILE}\" failed. Please investigate."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
(cd ${DIRNAME} && ${FDESIGN} -convert ${FDFILE}) ||
|
||||
{
|
||||
echo "\"${FDESIGN} -convert ${FDFILE}}\" failed. Please investigate."
|
||||
exit 1
|
||||
}
|
||||
|
||||
#==================================
|
||||
# Modify the .h file for use by LyX
|
||||
@ -87,8 +89,8 @@ rm -f ${EXTERN_FUNCS}
|
||||
|
||||
# Patch the .h file if a patch exists
|
||||
if [ -f "${HPATCH}" ] ; then
|
||||
echo "Patching ${HOUT} with ${HPATCH}"
|
||||
patch -s ${HOUT} < ${HPATCH}
|
||||
echo "Patching ${HOUT} with ${HPATCH}"
|
||||
patch -s ${HOUT} < ${HPATCH}
|
||||
fi
|
||||
|
||||
# Clean up, to leave the finished .h file. We can be a little tricky here
|
||||
@ -99,14 +101,13 @@ fi
|
||||
rm -f ${HIN}
|
||||
MOVE_H_FILE=1
|
||||
if [ -r ${BASENAME}.h ]; then
|
||||
if cmp -s ${HOUT} ${BASENAME}.h; then
|
||||
MOVE_H_FILE=0
|
||||
fi
|
||||
cmp -s ${HOUT} ${BASENAME}.h && MOVE_H_FILE=0
|
||||
fi
|
||||
|
||||
if [ ${MOVE_H_FILE} -eq 1 ]; then
|
||||
mv ${HOUT} ${BASENAME}.h
|
||||
mv ${HOUT} ${BASENAME}.h
|
||||
else
|
||||
rm -f ${HOUT}
|
||||
rm -f ${HOUT}
|
||||
fi
|
||||
|
||||
#==================================
|
||||
@ -124,16 +125,15 @@ echo "#include <config.h>" >> ${COUT}
|
||||
echo "#include \"forms_gettext.h\"" >> ${COUT}
|
||||
echo "#include \"gettext.h\"" >> ${COUT}
|
||||
|
||||
if grep bmtable ${CIN} > /dev/null; then
|
||||
echo "#include \"bmtable.h\"" >> ${COUT}
|
||||
fi
|
||||
grep bmtable ${CIN} > /dev/null &&
|
||||
echo "#include \"bmtable.h\"" >> ${COUT}
|
||||
|
||||
sed -f ${FDFIXC} < ${CIN} >> ${COUT}
|
||||
|
||||
# Patch the .C file if a patch exists
|
||||
if [ -f "${CPATCH}" ] ; then
|
||||
echo "Patching ${COUT} with ${CPATCH}"
|
||||
patch -s ${COUT} < ${CPATCH}
|
||||
echo "Patching ${COUT} with ${CPATCH}"
|
||||
patch -s ${COUT} < ${CPATCH}
|
||||
fi
|
||||
|
||||
# Clean up, to leave the finished .C file
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-11-21 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* GraphicsConverter.C (build_script, move_file):
|
||||
Don't use "if [ $? -ne 0 ]; then..."
|
||||
|
||||
2002-11-04 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* PreviewLoader.C (IncrementedFileName): STRCONV
|
||||
|
@ -242,14 +242,14 @@ string const move_file(string const & from_file, string const & to_file)
|
||||
ostringstream command;
|
||||
command << "fromfile=" << from_file << "\n"
|
||||
<< "tofile=" << to_file << "\n\n"
|
||||
<< "'mv' -f ${fromfile} ${tofile}\n"
|
||||
<< "if [ $? -ne 0 ]; then\n"
|
||||
<< "\t'cp' -f ${fromfile} ${tofile}\n"
|
||||
<< "\tif [ $? -ne 0 ]; then\n"
|
||||
<< "'mv' -f ${fromfile} ${tofile} ||\n"
|
||||
<< "{\n"
|
||||
<< "\t'cp' -f ${fromfile} ${tofile} ||\n"
|
||||
<< "\t{\n"
|
||||
<< "\t\texit 1\n"
|
||||
<< "\tfi\n"
|
||||
<< "\t}\n"
|
||||
<< "\t'rm' -f ${fromfile}\n"
|
||||
<< "fi\n";
|
||||
<< "}\n";
|
||||
|
||||
return STRCONV(command.str());
|
||||
}
|
||||
@ -320,14 +320,14 @@ bool build_script(string const & from_file,
|
||||
command = LibScriptSearch(command);
|
||||
|
||||
// Store in the shell script
|
||||
script << "\n" << command << "\n\n";
|
||||
script << "\n" << command << " ||\n";
|
||||
|
||||
// Test that this was successful. If not, remove
|
||||
// ${outfile} and exit the shell script
|
||||
script << "if [ $? -ne 0 ]; then\n"
|
||||
script << "{\n"
|
||||
<< "\t'rm' -f ${outfile}\n"
|
||||
<< "\texit 1\n"
|
||||
<< "fi\n\n";
|
||||
<< "}\n\n";
|
||||
|
||||
// Test that the outfile exists.
|
||||
// ImageMagick's convert will often create ${outfile}.0,
|
||||
|
Loading…
Reference in New Issue
Block a user