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