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
This commit is contained in:
Ivan Tham 2016-10-29 13:02:15 +08:00
parent 161f63ae60
commit 4844396830
2 changed files with 13 additions and 17 deletions

6
TODO
View File

@ -1,5 +1 @@
Misc
----
$ grep -n 'TODO' spt.c
# vim:ft=markdown:
Good luck! Nothing TODO for now.

24
spt.c
View File

@ -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 */