aboutsummaryrefslogtreecommitdiff
path: root/gdb/contrib
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-10-21 15:07:02 +0200
committerTom de Vries <tdevries@suse.de>2024-10-21 15:07:02 +0200
commit84fbbb5e6140791dbb60f3897c5bac5e9c173780 (patch)
tree00770b61798f1fd039059aa3e6e9500e4febc8dd /gdb/contrib
parent9ee884981410d3d666e9b7b747b50908d891286b (diff)
downloadbinutils-84fbbb5e6140791dbb60f3897c5bac5e9c173780.zip
binutils-84fbbb5e6140791dbb60f3897c5bac5e9c173780.tar.gz
binutils-84fbbb5e6140791dbb60f3897c5bac5e9c173780.tar.bz2
[gdb/contrib] Add spellcheck.sh --check
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.
Diffstat (limited to 'gdb/contrib')
-rwxr-xr-xgdb/contrib/spellcheck.sh19
1 files changed, 18 insertions, 1 deletions
diff --git a/gdb/contrib/spellcheck.sh b/gdb/contrib/spellcheck.sh
index 4203333..3188734 100755
--- a/gdb/contrib/spellcheck.sh
+++ b/gdb/contrib/spellcheck.sh
@@ -76,7 +76,7 @@ sed_separator=$(join $sed_or "${sed_separators[@]}")
usage ()
{
- echo "usage: $(basename "$0") <file|dir>+"
+ echo "usage: $(basename "$0") [--check] <file|dir>+"
}
make_absolute ()
@@ -101,6 +101,18 @@ parse_args ()
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
@@ -311,6 +323,7 @@ replace_word_in_files ()
main ()
{
declare -a unique_files
+ check=false
parse_args "$@"
get_dictionary
@@ -329,6 +342,10 @@ main ()
return
fi
+ if $check; then
+ exit 1
+ fi
+
declare -A words_done
local i word replacement
i=0