chiark / gitweb /
WIP island determination; pixmap handling in progress
[ypp-sc-tools.db-test.git] / pctb / yppsc-ppmlookup
diff --git a/pctb/yppsc-ppmlookup b/pctb/yppsc-ppmlookup
new file mode 100755 (executable)
index 0000000..efb785d
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+set -ex
+
+needle=$(pnmnoraw)
+
+exec 3<database.ppm
+
+while true; do
+       read <&3 title
+       if [ x"$title" = x. ]; then
+               exit 0
+       fi
+       straw=$(pnmnoraw <&3)
+       if [ x"$straw" = x"$needle" ]; then
+               printf "%s\n" "$title"
+               exit 0
+       fi
+done