chiark / gitweb /
bin/fix-local-words: Publish this handy script properly.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 14 Mar 2025 15:53:26 +0000 (15:53 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 14 Mar 2025 15:53:39 +0000 (15:53 +0000)
Makefile
bin/fix-local-words [new file with mode: 0755]

index e8a4549d0d71c123ec0a815dbef93285b3eec00e..b178bcc1891fc1a412d658025c6dd3ed293241d8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -267,6 +267,7 @@ SCRIPTLINKS         += hyperspec
 SCRIPTLINKS            += bdl
 SCRIPTLINKS            += datasyms
 SCRIPTLINKS            += fixsub
+SCRIPTLINKS            += fix-local-words
 SCRIPTLINKS            += check-debsyms
 SCRIPTLINKS            += check-blkdev-size
 SCRIPTLINKS            += xremote
diff --git a/bin/fix-local-words b/bin/fix-local-words
new file mode 100755 (executable)
index 0000000..2029480
--- /dev/null
@@ -0,0 +1,17 @@
+#! /bin/sh -e
+
+comment="%%" bad=nil
+while getopts "c:" o; do
+  case $o in
+    c) comment=$OPTARG ;;
+    *) bad=t ;;
+  esac
+done
+shift $(( $OPTIND - 1 ))
+case $bad in t) echo >&2 "usage: $0 [-c COMMENT] [FILE ...]"; exit 2 ;; esac
+
+sed 's/^.*LocalWords: *//' "$@" |
+  tr ' ' '\n' | sort -fu | tr '\n' ' ' |
+  fold -s -w60 |
+  sed "s/^/$comment LocalWords: /; s/[[:space:]]*\$//"
+echo