2 * Copyright (c) 1995-2002, Index Data.
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
6 * $Id: tpath.c,v 1.6 2002-04-04 20:49:46 adam Exp $
16 #include <yaz/tpath.h>
19 FILE *yaz_path_fopen(const char *path, const char *name, const char *mode)
21 return yaz_path_fopen_base (path, name, mode, 0);
24 FILE *yaz_path_fopen_base(const char *path, const char *name, const char *mode,
33 const char *path_sep = 0;
40 /* somewhat dirty since we have to consider Windows
43 if (strchr ("/\\.", *path))
45 path_sep = strchr (path+1, ':');
47 else if (path[0] && path[1])
48 path_sep = strchr (path+2, ':');
50 len = path_sep - path;
53 if (!strchr ("/\\", *path) && base)
59 memcpy (spath+slen, path, len);
61 if (!strchr("/\\", spath[slen-1]))
64 strcpy (spath+slen, name);
65 if ((f = fopen(spath, mode)))
75 int yaz_is_abspath (const char *p)
82 if (*p && p[1] == ':' && isalpha(*p))