aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/man/example-filter.sh
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2012-09-03 17:57:46 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2012-09-03 17:57:46 +0200
commitddb59757f5e4a6c30ede99a2d4f039e881132ab9 (patch)
tree2dbccf700970bdfaa13eaa260a08cb2b26696912 /man/example-filter.sh
parentMake into a real project. (diff)
downloadpassword-store-ddb59757f5e4a6c30ede99a2d4f039e881132ab9.tar.xz
password-store-ddb59757f5e4a6c30ede99a2d4f039e881132ab9.zip
Move examples into manpage.
Diffstat (limited to 'man/example-filter.sh')
-rwxr-xr-xman/example-filter.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/man/example-filter.sh b/man/example-filter.sh
new file mode 100755
index 0000000..2a71d40
--- /dev/null
+++ b/man/example-filter.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# This is a super bootleg script for converting plaintext examples into groff.
+
+while read line; do
+ echo "$line" | while read -n 1 char; do
+ if [[ $char == "%" ]]; then
+ echo -n '%'
+ continue
+ fi
+ ord=$(printf '%d' "'$char")
+ if [[ $ord -eq 0 ]]; then
+ printf ' '
+ elif [[ $ord -gt 127 ]]; then
+ printf '\[u%X]' "'$char"
+ else
+ printf "$char"
+ fi
+ done
+ echo
+ echo ".br"
+done