diff options
author | Mattias Andrée <maandree@kth.se> | 2021-04-08 17:58:54 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-04-08 18:15:49 +0200 |
commit | 508828c5861bf8487b995df537cbfa0b0b7a8ba4 (patch) | |
tree | 0ae6366528057f6fea28cb347d7c582850708a85 /libcontacts_list_contacts.c | |
parent | Add test for libcontacts_get_path (diff) | |
download | libcontacts-508828c5861bf8487b995df537cbfa0b0b7a8ba4.tar.gz libcontacts-508828c5861bf8487b995df537cbfa0b0b7a8ba4.tar.bz2 libcontacts-508828c5861bf8487b995df537cbfa0b0b7a8ba4.tar.xz |
Add with_me parameter to libcontacts_list_contacts and libcontacts_load_contacts
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | libcontacts_list_contacts.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libcontacts_list_contacts.c b/libcontacts_list_contacts.c index fbf56ee..6879999 100644 --- a/libcontacts_list_contacts.c +++ b/libcontacts_list_contacts.c @@ -3,7 +3,7 @@ int -libcontacts_list_contacts(char ***idsp, const struct passwd *user) +libcontacts_list_contacts(char ***idsp, const struct passwd *user, int with_me) { char *dirnam; DIR *dir; @@ -36,10 +36,12 @@ libcontacts_list_contacts(char ***idsp, const struct passwd *user) goto start; while ((f = readdir(dir))) { - if (strchr(f->d_name, '.')) - continue; - if (!f->d_name[0] || strchr(f->d_name, '\0')[-1] == '~') + if (f->d_name[0] == '.') { + if (!with_me || strcmp(f->d_name, ".me")) + continue; + } else if (!f->d_name[0] || strchr(f->d_name, '\0')[-1] == '~') { continue; + } if (!((*idsp)[i++] = strdup(f->d_name))) goto fail; start: |