X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev_lib.c;h=16b473f57608058177702f46b162faeb13f7bf99;hb=1eae2f3f712ff839bf80721bf9c44a76a78460dc;hp=381492db01feb4bf51f0cf84f7c5250b20759fac;hpb=4b06c852cb7da274b50f665a75367f901d8064ae;p=elogind.git diff --git a/udev_lib.c b/udev_lib.c index 381492db0..16b473f57 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;