summaryrefslogtreecommitdiff
path: root/Build/source/texk/ps2pkm/flisearch.c
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
committerKarl Berry <karl@freefriends.org>2006-01-17 21:41:51 +0000
commit487ca4806cc046076293cf6cc5fbba0db282bac7 (patch)
tree847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/ps2pkm/flisearch.c
parenta3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff)
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/ps2pkm/flisearch.c')
-rw-r--r--Build/source/texk/ps2pkm/flisearch.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/Build/source/texk/ps2pkm/flisearch.c b/Build/source/texk/ps2pkm/flisearch.c
new file mode 100644
index 00000000000..e196f6f1e29
--- /dev/null
+++ b/Build/source/texk/ps2pkm/flisearch.c
@@ -0,0 +1,42 @@
+/*
+ * FILE: psearch.c
+ * PURPOSE: search files through possible recursive path
+ * VERSION: 1.0 (Oct. 1995)
+ * AUTHOR: Piet Tutelaers
+ */
+
+#include <stdio.h>
+#include <string.h> /* strcmp() */
+#include "basics.h" /* fatal(), msg() */
+#include "filenames.h" /* */
+#include "psearch.h" /* search_flipath() */
+
+char *fontname; int dpi, margin = 0;
+
+int main(int argc, char *argv[]) {
+ char *path, *file, *fn;
+ int matching(char *, int);
+
+ /* get path and file arguments */
+ if (argc != 4) fatal("Usage: psearch path fontname dpi\n");
+ path = argv[1]; fontname = argv[2]; dpi = atoi(argv[3]);
+
+ /* find <file> in <path> */
+ fn = search_flipath(path, matching);
+ if (fn == NULL) msg("%s at %d dpi not found\n", fontname, dpi);
+ else msg("%s: %s at %d dpi found\n", fn, fontname, dpi);
+ exit(0);
+}
+
+/*
+ * Function used to search for one single font in FLI path
+ */
+int matching(char *font, int size) {
+
+ if ((strcmp(font, fontname) == 0) && (size == dpi ||
+ (size >= dpi - margin && size <= dpi+margin)))
+ return 1;
+ else
+ return 0;
+}
+