chiark / gitweb /
Rearrange and tidy up innards of yppsc-ocr-resolver
[ypp-sc-tools.web-live.git] / pctb / yppsc-ppmlookup
1 #!/bin/sh
2 set -ex
3
4 needle=$(pnmnoraw)
5
6 exec 3<database.ppm
7
8 while true; do
9         read <&3 title
10         if [ x"$title" = x. ]; then
11                 exit 0
12         fi
13         straw=$(pnmnoraw <&3)
14         if [ x"$straw" = x"$needle" ]; then
15                 printf "%s\n" "$title"
16                 exit 0
17         fi
18 done