Files
mercury/scripts/mercury_update_interface.in
Zoltan Somogyi 622d8c5656 Update the programming style of some scripts.
scripts/init_grade_options.sh-subr:
scripts/mdb.in:
scripts/mercury_config.in:
scripts/mercury_update_interface.in:
scripts/mgnuc.in:
scripts/ml.in:
scripts/parse_ml_options.sh-subr.in:
    Indent by four spaces, not by tabs, or by three spaces.

    Use ${varname}, not just $varname.

    Put successive commands on separate lines.

    Indent case statements in a consistent manner: put case patterns
    on their own lines; put ;;s on their own lines.

    Replace the [ command with test.

    Put quotes around strings that should be considered one word
    even if they are empty or contain spaces.

    Fix English in messages and comments.
2023-09-30 23:36:03 +10:00

57 lines
1.6 KiB
Bash

#! /bin/sh
#---------------------------------------------------------------------------#
# vim: ts=4 sw=4 et ft=sh
#---------------------------------------------------------------------------#
# @configure_input@
#---------------------------------------------------------------------------#
# Copyright (C) 1995-1997 The University of Melbourne.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#---------------------------------------------------------------------------#
#
# MERCURY_UPDATE_INTERFACE
#
# usage:
# mercury_update_interface [-v] filename
#
# Move `filename.tmp' to `filename', but only if necessary.
# If they are identical, then we simply remove `filename.tmp',
# and leave `filename's time-stamp unaltered.
#
# If the `-v' (verbose) option is specified, then we print progress messages.
#
# Enviroment variables: none.
verbose=false
if test "$#" -ge 1 -a "$1" = "-v"
then
verbose=true
shift
fi
if test "$#" -ne 1
then
echo "Usage: `basename $0` filename" 1>&2
exit 1
fi
filename="$1"
if test ! -f "${filename}"
then
${verbose} && echo "creating \`${filename}'." 1>&2
mv -f "${filename}.tmp" "${filename}"
# Work-around for a parallel gmake problem
exit 0
elif cmp -s "${filename}.tmp" "${filename}"
then
${verbose} && echo "\`${filename}' has not changed." 1>&2
rm -f "${filename}.tmp"
else
echo "\`${filename}' has CHANGED." 1>&2
mv -f "${filename}.tmp" "${filename}"
# Work-around for a parallel gmake problem.
exit 0
fi