+ return cur->device;
+ }
+ }
+ cur = cur->next;
+ }
+ return NULL;
+}
+
+char *mtab_first(void **iter)
+{
+ struct _mtab_entry_t *mtab_iter;
+
+ if (!iter)
+ return NULL;
+ mtab_iter = mtab_cache;
+ *iter = (void *) mtab_iter;
+ return mtab_next(iter);
+}
+
+char *mtab_next(void **iter)
+{
+ char *mp;
+
+ if (iter == NULL || *iter == NULL)
+ return NULL;
+ mp = ((struct _mtab_entry_t *) (*iter))->mountpt;
+ *iter = (void *) ((struct _mtab_entry_t *) (*iter))->next;
+ return mp;
+}
+
+/* Don't bother to clean up, since exit() does that
+ * automagically, so we can save a few bytes */
+#ifdef BB_FEATURE_CLEAN_UP
+void mtab_free(void)
+{
+ struct _mtab_entry_t *this, *next;
+
+ this = mtab_cache;
+ while (this) {
+ next = this->next;
+ if (this->device)
+ free(this->device);
+ if (this->mountpt)
+ free(this->mountpt);
+ free(this);
+ this = next;
+ }