diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-28 22:45:45 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-28 22:45:49 +0100 |
commit | 7d8c71019c111134c15a7903ec9acfb5713755fe (patch) | |
tree | 3e7f2441e2a326cfe3ab810ddf00e9a1edc9ebbe /src/satd-rm.c | |
parent | m (diff) | |
download | sat-7d8c71019c111134c15a7903ec9acfb5713755fe.tar.gz sat-7d8c71019c111134c15a7903ec9acfb5713755fe.tar.bz2 sat-7d8c71019c111134c15a7903ec9acfb5713755fe.tar.xz |
partially implement satd-list, satd-rm, and satd-run
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'src/satd-rm.c')
-rw-r--r-- | src/satd-rm.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/satd-rm.c b/src/satd-rm.c index 6a9f6cd..58b9eed 100644 --- a/src/satd-rm.c +++ b/src/satd-rm.c @@ -39,6 +39,8 @@ main(int argc, char *argv[]) size_t n = 0; char *message = NULL; char **msg_argv = NULL; + char **arg; + int rc = 0; /* Receive and validate message. */ t (readall(SOCK_FILENO, &message, &n) || !n || message[n - 1]); @@ -46,7 +48,21 @@ main(int argc, char *argv[]) msg_argv = restore_array(message, n, NULL); t (!msg_argv); - return 0; + /* Perform action. */ + for (arg = msg_argv; *arg; arg++) + t (remove_job(*arg, 0) && errno); + +done: + /* Cleanup. */ + shutdown(SOCK_FILENO, SHUT_WR); + close(SOCK_FILENO); + free(msg_argv); + free(message); + return rc; fail: + if (send_string(SOCK_FILENO, STDERR_FILENO, argv[0], ": ", strerror(errno), "\n", NULL)) + perror(argv[0]); + rc = 1; + goto done; } |