From 6321be300b804894c8c150fac8749741b13dfb2d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 4 Apr 2021 14:10:26 +0200 Subject: m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 6 ++++-- TODO | 2 -- common.h | 3 +++ config.mk | 2 +- find-contact-by-chat.c | 2 +- set-contact-birthday.c | 4 +++- 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); -- cgit v1.2.3-70-g09d2