Add `rdbl-luks`, git textconv diff filter for LUKS headers
[sunny256-utils.git] / txt2uc
blob90b228cf05689cc4695635a8fceede66a95fcab6
1 #!/bin/sh
3 #==============================================================================
4 # txt2uc
5 # File ID: 821a49a8-3776-11e5-8c4f-fefdb24f8e10
7 # Convert UTF-8 text into the format created by unichar(1).
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #==============================================================================
13 progname=txt2uc
14 VERSION=0.3.1
16 opt_help=0
17 opt_quiet=0
18 opt_verbose=0
19 while test -n "$1"; do
20 case "$1" in
21 -h|--help) opt_help=1; shift ;;
22 -q|--quiet) opt_quiet=$(($opt_quiet + 1)); shift ;;
23 -v|--verbose) opt_verbose=$(($opt_verbose + 1)); shift ;;
24 --version) echo $progname $VERSION; exit 0 ;;
25 --) shift; break ;;
27 if printf '%s\n' "$1" | grep -q ^-; then
28 echo "$progname: $1: Unknown option" >&2
29 exit 1
30 else
31 break
33 break ;;
34 esac
35 done
36 opt_verbose=$(($opt_verbose - $opt_quiet))
38 if test "$opt_help" = "1"; then
39 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
40 cat <<END
42 Convert UTF-8 text into the format created by unichar(1). Displays all
43 characters used, also things like combining chars and that bloody BOM.
45 Usage: $progname [options]
47 Options:
49 -h, --help
50 Show this help.
51 -q, --quiet
52 Be more quiet. Can be repeated to increase silence.
53 -v, --verbose
54 Increase level of verbosity. Can be repeated.
55 --version
56 Print version information.
58 END
59 exit 0
62 tohex -u | zeropad -s 4 -x | fmt -1 | while read f; do
63 sqlite3 ~/.unichar.sqlite "SELECT * FROM chars WHERE s LIKE '$f;%';"
64 done
66 # vim: set ts=8 sw=8 sts=8 noet fo+=w tw=79 fenc=UTF-8 :