X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=util%2Ftpath.c;fp=util%2Ftpath.c;h=ec4e981d70741145951f76bb7a838312da594e39;hp=0000000000000000000000000000000000000000;hb=3ffa5dbc563e15bccb012f3d3d00a993f87ace82;hpb=6b3cb0bd17248f844cae8744d29816809db1673f diff --git a/util/tpath.c b/util/tpath.c new file mode 100644 index 0000000..ec4e981 --- /dev/null +++ b/util/tpath.c @@ -0,0 +1,37 @@ +/* + * Copyright (c) 1995, Index Data. + * See the file LICENSE for details. + * Sebastian Hammer, Adam Dickmeiss + * + * $Log: tpath.c,v $ + * Revision 1.1 1995-11-01 16:35:00 quinn + * Making data1 look for tables in data1_tabpath + * + * + */ + +#include +#include + +FILE *yaz_path_fopen(char *path, char *name, char *mode) +{ + char spath[512] = ""; + + if (!path) + return fopen(name, mode); + + do + { + FILE *f; + + if (sscanf(path, "%511[^:]", spath) < 1) + return 0; + sprintf(spath + strlen(spath), "/%s", name); + if ((f = fopen(spath, mode))) + return f; + if ((path = strchr(path, ':'))) + path++; + } + while (path); + return 0; +}