]> git.draconx.ca Git - dxcommon.git/blobdiff - t/msgfmt.sh
tests: Add some coverage of the gettext.mk snippet.
[dxcommon.git] / t / msgfmt.sh
diff --git a/t/msgfmt.sh b/t/msgfmt.sh
new file mode 100755 (executable)
index 0000000..6cb09ee
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Copyright © 2023 Nick Bowler
+#
+# Fake msgfmt program for testing.
+#
+# License WTFPL2: Do What The Fuck You Want To Public License, version 2.
+# This is free software: you are free to do what the fuck you want to.
+# There is NO WARRANTY, to the extent permitted by law.
+
+outfile=messages.mo
+for arg
+do
+  arg=${lastarg:+"$lastarg="}$arg
+  lastarg=
+
+  save_IFS=$IFS; IFS='='
+  set x $arg; shift; shift; optarg=$*
+  IFS=$save_IFS
+
+  case $arg in
+  -o|--output-file) lastarg=--output-file ;;
+  --output-file=*) outfile=$optarg ;;
+  esac
+done
+
+exec 1>"$outfile"