summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/src/template_lmo.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-base/src/template_lmo.c')
-rw-r--r--modules/luci-base/src/template_lmo.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/modules/luci-base/src/template_lmo.c b/modules/luci-base/src/template_lmo.c
index 3d1eaf4e0..cd4c609a7 100644
--- a/modules/luci-base/src/template_lmo.c
+++ b/modules/luci-base/src/template_lmo.c
@@ -216,7 +216,7 @@ int lmo_load_catalog(const char *lang, const char *dir)
if (!_lmo_active_catalog)
_lmo_active_catalog = cat;
- return 0;
+ return cat->archives ? 0 : -1;
err:
if (dh) closedir(dh);
@@ -301,6 +301,20 @@ int lmo_translate(const char *key, int keylen, char **out, int *outlen)
return -1;
}
+void lmo_iterate(lmo_iterate_cb_t cb, void *priv)
+{
+ unsigned int i;
+ lmo_entry_t *e;
+ lmo_archive_t *ar;
+
+ if (!_lmo_active_catalog)
+ return;
+
+ for (ar = _lmo_active_catalog->archives; ar; ar = ar->next)
+ for (i = 0, e = &ar->index[0]; i < ar->length; e = &ar->index[++i])
+ cb(ntohl(e->key_id), ar->mmap + ntohl(e->offset), ntohl(e->length), priv);
+}
+
void lmo_close_catalog(const char *lang)
{
lmo_archive_t *ar, *next;