about summary refs log tree commit diff
path: root/cli/stop.c
diff options
context:
space:
mode:
Diffstat (limited to 'cli/stop.c')
-rw-r--r--cli/stop.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/cli/stop.c b/cli/stop.c
new file mode 100644
index 0000000..caf68f4
--- /dev/null
+++ b/cli/stop.c
@@ -0,0 +1,27 @@
+#include "btcli.h"
+
+void
+usage_stop(void)
+{
+    printf(
+        "Stop torrents.\n"
+        "\n"
+        "Usage: stop torrent ...\n"
+        "\n"
+        );
+    exit(1);
+}
+
+void
+cmd_stop(int argc, char **argv)
+{
+    struct ipc_torrent t;
+
+    if (argc < 2)
+        usage_stop();
+
+    btpd_connect();
+    for (int i = 1; i < argc; i++)
+        if (torrent_spec(argv[i], &t))
+            handle_ipc_res(btpd_stop(ipc, &t), argv[i]);
+}