Add a new option --check to gdb/contrib/spellcheck.sh, to do the spell
check and bail out ASAP with an exit code of 1 if misspelled words were
found, or 0 otherwise.
Verified with shellcheck.
usage ()
{
- echo "usage: $(basename "$0") <file|dir>+"
+ echo "usage: $(basename "$0") [--check] <file|dir>+"
}
make_absolute ()
files=$(mktemp)
trap 'rm -f "$files"' EXIT
+ while true; do
+ case " $1 " in
+ " --check ")
+ check=true
+ shift
+ ;;
+ *)
+ break
+ ;;
+ esac
+ done
+
if [ $# -eq -0 ]; then
usage
exit 1
main ()
{
declare -a unique_files
+ check=false
parse_args "$@"
get_dictionary
return
fi
+ if $check; then
+ exit 1
+ fi
+
declare -A words_done
local i word replacement
i=0