aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-04-04 14:10:26 +0200
committerMattias Andrée <maandree@kth.se>2021-04-04 14:10:26 +0200
commit6321be300b804894c8c150fac8749741b13dfb2d (patch)
treedefa3c9145ecdf6e3f74c4fcf09b20a50a81983f
parentm + move common code from get-contact-birthday.c and list-birthdays.c to common-birthday.c (diff)
downloadcontacts-6321be300b804894c8c150fac8749741b13dfb2d.tar.gz
contacts-6321be300b804894c8c150fac8749741b13dfb2d.tar.bz2
contacts-6321be300b804894c8c150fac8749741b13dfb2d.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--Makefile6
-rw-r--r--TODO2
-rw-r--r--common.h3
-rw-r--r--config.mk2
-rw-r--r--find-contact-by-chat.c2
-rw-r--r--set-contact-birthday.c4
6 files changed, 12 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index b2b1f21..0bbc52e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,11 @@
.POSIX:
CONFIGFILE = config.mk
-include $(CONFIGFILE)
CALLTYPE = multicall-hardlinks
# multicall-hardlinks = multiple hardlinks of the same multicall binary is installed
# multicall-symlinks = multiple links to a multicall binary named $(PREFIX)/bin/contacts are installed
# singlecall = separate binaries are install for each command (greatly wastes space when statically linked)
-include $(CALLTYPE).mk
BIN =\
@@ -64,6 +62,10 @@ OBJ = $(BIN:=.o) common-birthday.o
BOBJ = $(OBJ:.o=.bo)
+include $(CONFIGFILE)
+include $(CALLTYPE).mk
+
+
$(OBJ): $(@:.o=.c) $(HDR)
$(BOBJ): $(@:.bo=.c) $(HDR)
diff --git a/TODO b/TODO
index fd5b32e..c16c1de 100644
--- a/TODO
+++ b/TODO
@@ -4,7 +4,6 @@ Add tools for .addresses
Test find-contact-by-chat
Test find-contact-by-email
-Test find-contact-by-name
Test find-contact-by-number
Test find-contact-by-organisation
Test find-contact-by-pgpkey
@@ -12,7 +11,6 @@ Test find-contact-by-photo
Test find-contact-by-site
Test get-contact-chats
Test get-contact-emails
-Test get-contact-name
Test get-contact-numbers
Test get-contact-organisations
Test get-contact-pgpkeys
diff --git a/common.h b/common.h
index 6f38731..7abe91a 100644
--- a/common.h
+++ b/common.h
@@ -14,6 +14,9 @@
/* common-birthday.c */
+#if defined(__GNUC__) || defined(__clang__)
+__attribute__((__pure__))
+#endif
int get_age(struct libcontacts_birthday *bday, const struct tm *now);
void print_birthdate(struct libcontacts_birthday *bday, const struct tm *now);
void print_birthday(struct libcontacts_birthday *bday, const struct tm *now);
diff --git a/config.mk b/config.mk
index 5724519..271b296 100644
--- a/config.mk
+++ b/config.mk
@@ -5,4 +5,4 @@ CC = cc
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
CFLAGS = -std=c99 -Wall -Os
-LDFLAGS = -s -lcontacts -lsimple
+LDFLAGS = -lcontacts -lsimple -s
diff --git a/find-contact-by-chat.c b/find-contact-by-chat.c
index 282f847..529b32c 100644
--- a/find-contact-by-chat.c
+++ b/find-contact-by-chat.c
@@ -11,7 +11,7 @@ main(int argc, char *argv[])
struct passwd *user;
struct libcontacts_contact **contacts;
struct libcontacts_chat **chats, *chat;
- char *context = NULL, *service;
+ char *context = NULL, *service = NULL;
size_t i;
ARGBEGIN {
diff --git a/set-contact-birthday.c b/set-contact-birthday.c
index 535e635..9db0987 100644
--- a/set-contact-birthday.c
+++ b/set-contact-birthday.c
@@ -64,10 +64,12 @@ main(int argc, char *argv[])
if (before_on_common == 0)
usage();
before_on_common = 1;
+ break;
case 'B':
if (before_on_common == 1)
usage();
before_on_common = 0;
+ break;
case 'u':
remove = 1;
break;
@@ -114,7 +116,7 @@ main(int argc, char *argv[])
if (day)
contact.birthday->day = day < 0 ? 0 : (unsigned char)day;
if (before_on_common >= 0)
- contact.birthday->before_on_common = before_on_common;
+ contact.birthday->before_on_common = (unsigned char)before_on_common;
}
if (libcontacts_save_contact(&contact, user)) {
weprintf("libcontacts_save_contact %s:", *argv);