Added body-of-text to BIB-1 ANY and the WAIS profile
[yaz-moved-to-github.git] / util / tpath.c
1 /*
2  * Copyright (c) 1995, Index Data.
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: tpath.c,v $
7  * Revision 1.1  1995-11-01 16:35:00  quinn
8  * Making data1 look for tables in data1_tabpath
9  *
10  *
11  */
12
13 #include <stdio.h>
14 #include <string.h>
15
16 FILE *yaz_path_fopen(char *path, char *name, char *mode)
17 {
18     char spath[512] = "";
19
20     if (!path)
21         return fopen(name, mode);
22
23     do
24     {
25         FILE *f;
26
27         if (sscanf(path, "%511[^:]", spath) < 1)
28             return 0;
29         sprintf(spath + strlen(spath), "/%s", name);
30         if ((f = fopen(spath, mode)))
31             return f;
32         if ((path = strchr(path, ':')))
33             path++;
34     }
35     while (path);
36     return 0;
37 }