mirror of
https://github.com/erlang/spec.git
synced 2026-04-15 17:33:42 +00:00
73 lines
1.5 KiB
Bash
Executable File
73 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
#
|
|
# %CopyrightBegin%
|
|
#
|
|
# Copyright Ericsson AB 2017. All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
# %CopyrightEnd%
|
|
#
|
|
|
|
#
|
|
# Usage:
|
|
# fixpoint <output files> -- <command>
|
|
#
|
|
# This script repeatedly runs <command> until all <output files>
|
|
# stops changing between runs. This of course does not work well
|
|
# with any arbitrary command :-)
|
|
#
|
|
|
|
files=
|
|
|
|
while [ $# -gt 0 ]; do
|
|
if [ "$1" = "--" ]; then
|
|
shift
|
|
cmd=${1+"$@"}
|
|
break;
|
|
fi
|
|
files="$files $1"
|
|
shift
|
|
done
|
|
|
|
if [ "$cmd" = "" ]; then
|
|
echo "$prog: Missing command" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
changed=true
|
|
|
|
echo $files
|
|
|
|
while [ $changed = true ]; do
|
|
echo $cmd
|
|
eval $cmd 1>/dev/null 2>/dev/null
|
|
changed=false
|
|
for f in $files; do
|
|
if [ -e "$f" ]; then
|
|
if [ -e "$f.prev" ]; then
|
|
diff "$f" "$f.prev" 1>/dev/null 2>/dev/null || changed=true
|
|
else
|
|
changed=true
|
|
fi
|
|
cp "$f" "$f.prev"
|
|
else
|
|
if [ -e "$f.prev" ]; then
|
|
changed=true
|
|
rm "$f.prev"
|
|
fi
|
|
fi
|
|
done
|
|
done
|