From 86754d7d53b59ce52de51a32f865d4916c119bdb Mon Sep 17 00:00:00 2001 From: Richard Nyberg Date: Wed, 13 Sep 2006 07:02:07 +0000 Subject: btpd now has a library of torrents indexed by number and info hash. The add and del commands adds or removes torrents from this library. The start and stop commands are used to active or deactivate torrents. Also, a mechanism for qeurying data on torrents has been added. It's only used by the btcli list and stat commands yet though. btcli has been split into different files for each command. Both btpd and btcli now use misc/btpd_if.h for all ipc definitions. Misc changes: - struct metainfo is gone. Use the new mi_* functions. - Add printf format type checking where appropriate. --- cli/kill.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 cli/kill.c (limited to 'cli/kill.c') diff --git a/cli/kill.c b/cli/kill.c new file mode 100644 index 0000000..b2c6862 --- /dev/null +++ b/cli/kill.c @@ -0,0 +1,35 @@ +#include "btcli.h" + +void +usage_kill(void) +{ + printf( + "Shutdown btpd.\n" + "\n" + "Usage: kill [seconds]\n" + "\n" + "Arguments:\n" + "seconds\n" + "\tThe number of seconds btpd waits before giving up on unresponsive\n" + "\ttrackers.\n" + "\n" + ); + exit(1); +} + +void +cmd_kill(int argc, char **argv) +{ + int seconds = -1; + char *endptr; + + if (argc == 2) { + seconds = strtol(argv[1], &endptr, 10); + if (strlen(argv[1]) > endptr - argv[1] || seconds < 0) + usage_kill(); + } else if (argc > 2) + usage_kill(); + + btpd_connect(); + handle_ipc_res(btpd_die(ipc, seconds), "kill"); +} -- cgit 1.4.1