add a comment
[project/uci.git] / file.c
diff --git a/file.c b/file.c
index 6f43715..601fef5 100644 (file)
--- a/file.c
+++ b/file.c
@@ -564,6 +564,22 @@ int uci_load(struct uci_context *ctx, const char *name, struct uci_package **pac
        return uci_import(ctx, file, name, package);
 }
 
+/* 
+ * This function returns the filename by returning the string
+ * after the last '/' character. By checking for a non-'\0'
+ * character afterwards, directories are ignored (glob marks
+ * those with a trailing '/'
+ */
+static inline char *get_filename(char *path)
+{
+       char *p;
+
+       p = strrchr(path, '/');
+       p++;
+       if (!*p)
+               return NULL;
+       return p;
+}
 
 char **uci_list_configs(struct uci_context *ctx)
 {