From 4844396830fe79f995b298c35b99200b04f6809e Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sat, 29 Oct 2016 13:02:15 +0800 Subject: [PATCH] Simple logic fixup and prepare for release - When -D_NOTIFY, notifycmd (-m) will be runned now - Remove '\n' in buf in display_state() for -m echo - Remove break; after usage() since die() is called - Hooray! TODO is clean, everything is nice for now - Haha, yet another rectangle blocky commit message --- TODO | 6 +----- spt.c | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/TODO b/TODO index 3803a28..062586c 100644 --- a/TODO +++ b/TODO @@ -1,5 +1 @@ -Misc ----- - $ grep -n 'TODO' spt.c - -# vim:ft=markdown: +Good luck! Nothing TODO for now. diff --git a/spt.c b/spt.c index cbbc0c5..73565ae 100644 --- a/spt.c +++ b/spt.c @@ -63,16 +63,17 @@ spawn(char *cmd, char *cmt) void notify_send(char *cmt) { -#ifdef NOTIFY - notify_init("spt"); - NotifyNotification *n = notify_notification_new("spt", cmt, \ - "dialog-information"); - notify_notification_show(n, NULL); - g_object_unref(G_OBJECT(n)); - notify_uninit(); -#else - if (strcmp(notifycmd, "")) /* TODO: call function in config.h */ + if (strcmp(notifycmd, "")) spawn(notifycmd, cmt); +#ifdef NOTIFY + else { + notify_init("spt"); + NotifyNotification *n = notify_notification_new("spt", cmt, \ + "dialog-information"); + notify_notification_show(n, NULL); + g_object_unref(G_OBJECT(n)); + notify_uninit(); + } #endif /* NOTIFY */ if (strcmp(notifyext, "")) /* extra commands to use */ @@ -82,9 +83,9 @@ notify_send(char *cmt) void display_state(int remaining, int suspend) { - char buf[22]; + char buf[21]; - snprintf(buf, 22, "Remaining: %02d:%02d %s\n", + snprintf(buf, 21, "Remaining: %02d:%02d %s", remaining / 60, remaining % 60, (suspend) ? "◼" : "▶"); @@ -131,7 +132,6 @@ main(int argc, char *argv[]) "see LICENSE for details\n"); default: usage(); - break; } ARGEND; /* add SIGUSR1 handler: remaining_time */