summary refs log tree commit diff
path: root/cli/stop.c
blob: 4d8258d0e07e510e5ef4e66c81b618330611c94a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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), "stop", argv[i]);
}