diff options
Diffstat (limited to 'udev_lib.c')
-rw-r--r-- | udev_lib.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/udev_lib.c b/udev_lib.c index 381492db01..16b473f576 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -152,6 +152,26 @@ size_t buf_get_line(char *buf, size_t buflen, size_t cur) return count - cur; } +void leading_slash(char *path) +{ + int len; + + len = strlen(path); + if (len > 0 && path[len-1] != '/') { + path[len] = '/'; + path[len+1] = '\0'; + } +} + +void no_leading_slash(char *path) +{ + int len; + + len = strlen(path); + if (len > 0 && path[len-1] == '/') + path[len-1] = '\0'; +} + struct files { struct list_head list; char name[NAME_SIZE]; @@ -180,7 +200,7 @@ static int file_list_insert(char *filename, struct list_head *file_list) return 0; } -/* calls function for file or every file found in directory */ +/* calls function for every file found in specified directory */ int call_foreach_file(int fnct(char *f) , char *dirname, char *suffix) { struct dirent *ent; |