-/* $OpenBSD: mdesc.c,v 1.9 2015/05/23 14:26:06 jsg Exp $ */
+/* $OpenBSD: mdesc.c,v 1.10 2018/07/12 14:46:45 kettenis Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
md_delete_node(md, node);
}
+void
+md_find_delete_nodes(struct md *md, const char *name)
+{
+ struct md_node *node;
+
+ while ((node = md_find_node(md, name)))
+ md_delete_node(md, node);
+}
+
struct md *
md_alloc(void)
{
fclose(fp);
}
+
+uint32_t
+md_size(const char *path)
+{
+ uint32_t size;
+ FILE *fp;
+
+ fp = fopen(path, "r");
+ if (fp == NULL)
+ err(1, "fopen");
+
+ fseek(fp, 0, SEEK_END);
+ size = ftell(fp);
+ fclose(fp);
+
+ return size;
+}
-/* $OpenBSD: mdesc.h,v 1.5 2012/11/26 20:08:16 kettenis Exp $ */
+/* $OpenBSD: mdesc.h,v 1.6 2018/07/12 14:46:45 kettenis Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
void md_delete_node(struct md *, struct md_node *);
void md_find_delete_node(struct md *, const char *);
+void md_find_delete_nodes(struct md *, const char *);
void md_collect_garbage(struct md *);
struct md *md_read(const char *);
void md_write(struct md *, const char *);
+uint32_t md_size(const char *);