16 #include <sys/types.h>
31 #define S_ISREG(x) (x & _S_IFREG)
36 #include <libxml/parser.h>
37 #include <libxml/tree.h>
38 #include <libxml/xinclude.h>
64 if (stat(path, &st) < 0)
71 if (S_ISREG(st.st_mode))
73 xmlDoc *doc = xmlReadFile(path,
76 + XML_PARSE_NSCLEAN + XML_PARSE_NONET);
77 int r = xmlXIncludeProcess(doc);
86 xmlNodePtr t = xmlDocGetRootElement(doc);
88 *sib = xmlAddNextSibling(*sib, xmlCopyNode(t, 1));
114 sib = xmlNewComment((
const xmlChar *)
wrbuf_cstr(w));
115 xmlReplaceNode(*np, sib);
137 c = xmlNewComment((
const xmlChar *)
wrbuf_cstr(w));
138 sib = xmlAddNextSibling(sib, c);
147 for (n = n->children; n; n = n->next)
149 if (n->type == XML_ELEMENT_NODE)
151 if (!strcmp((
const char *) n->name,
"include"))
153 xmlChar *src = xmlGetProp(n, (xmlChar *)
"src");
void yaz_file_globfree(yaz_glob_res_t *res)
release glob result
const char * yaz_file_glob_get_file(yaz_glob_res_t res, size_t idx)
return resulting matching file
int yaz_file_glob2(const char *pattern, yaz_glob_res_t *res, unsigned flags)
perform glob (with flags)
void yaz_log(int level, const char *fmt,...)
Writes log message.
#define YLOG_FATAL
log level: fatal
#define YLOG_ERRNO
log level: append system error message
int yaz_is_abspath(const char *p)
checks whether path is absolute
void wrbuf_destroy(WRBUF b)
destroy WRBUF and its buffer
void wrbuf_rewind(WRBUF b)
empty WRBUF content (length of buffer set to 0)
WRBUF wrbuf_alloc(void)
construct WRBUF
void wrbuf_printf(WRBUF b, const char *fmt,...)
writes printf result to WRBUF
const char * wrbuf_cstr(WRBUF b)
returns WRBUF content as C-string
void wrbuf_puts(WRBUF b, const char *buf)
appends C-string to WRBUF
Header for WRBUF (growing buffer)
static int config_include_one(yaz_xml_include_t config, xmlNode **sib, const char *path)
int yaz_xml_include_glob(xmlNode *n, const char *base_path, unsigned glob_flags)
substitute include nodes in a tree
static int config_include_src(yaz_xml_include_t config, xmlNode **np, const char *src)
static void conf_dir_path(yaz_xml_include_t config, WRBUF w, const char *src)
struct yaz_xml_include_s * yaz_xml_include_t
static int process_config_includes(yaz_xml_include_t config, xmlNode *n)
int yaz_xml_include_simple(xmlNode *n, const char *base_path)
substitute include nodes in a tree
XML Include (not to be confused with W3C XInclude)
Header with fundamental macros.