about summary refs log tree commit diff
path: root/cli/del.c
diff options
context:
space:
mode:
Diffstat (limited to 'cli/del.c')
-rw-r--r--cli/del.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/cli/del.c b/cli/del.c
new file mode 100644
index 0000000..eaa0a1e
--- /dev/null
+++ b/cli/del.c
@@ -0,0 +1,30 @@
+#include "btcli.h"
+
+void
+usage_del(void)
+{
+    printf(
+        "Remove torrents from btpd.\n"
+        "\n"
+        "Usage: del torrent ...\n"
+        "\n"
+        "Arguments:\n"
+        "file ...\n"
+        "\tThe torrents to remove.\n"
+        "\n");
+    exit(1);
+}
+
+void
+cmd_del(int argc, char **argv)
+{
+    struct ipc_torrent t;
+
+    if (argc < 2)
+        usage_del();
+
+    btpd_connect();
+    for (int i = 1; i < argc; i++)
+        if (torrent_spec(argv[i], &t))
+            handle_ipc_res(btpd_del(ipc, &t), argv[i]);
+}