pomo

A simple pomodoro timer
Log | Files | Refs | README | LICENSE

commit bf82caf6e00f92dce995f9838337ce249948c871
parent c2b5ba6b3ca85ab2207238fce8e1460596933237
Author: Ivan Tham <pickfire@riseup.net>
Date:   Mon,  2 Nov 2020 11:41:01 +0800

Use shell to execute notifyext (-e)

Fix `spt -e 'mpv music.ogg' -n notify-send`, use execvp to allow
easier reuse of the cmt that appeared later.

Fix #15

Diffstat:
Mspt.c | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/spt.c b/spt.c @@ -29,7 +29,7 @@ volatile static sig_atomic_t display, suspend; /* function declarations */ static void die(const char *errstr, ...); -static void spawn(char *cmd, char *cmt); +static void spawn(char *argv[]); static void notify_send(char *cmt); static void display_state(int remaining, int suspend); static void toggle_display(int sigint); @@ -49,12 +49,12 @@ die(const char *errstr, ...) } void -spawn(char *cmd, char *cmt) +spawn(char *argv[]) { if (fork() == 0) { setsid(); - execlp(cmd, cmd, "spt", cmt, NULL); - die("spt: execlp %s\n", cmd); + execvp(argv[0], argv); + die("spt: execvp %s\n", argv[0]); perror(" failed"); exit(0); } @@ -64,7 +64,7 @@ void notify_send(char *cmt) { if (strcmp(notifycmd, "")) - spawn(notifycmd, cmt); + spawn((char *[]) { notifycmd, "spt", cmt, NULL }); #ifdef NOTIFY else { notify_init("spt"); @@ -77,7 +77,7 @@ notify_send(char *cmt) #endif /* NOTIFY */ if (strcmp(notifyext, "")) /* extra commands to use */ - spawn(notifyext, NULL); + spawn((char *[]) { "/bin/sh", "-c", notifyext, NULL }); } void