about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRichard Nyberg <rnyberg@murmeldjur.se>2006-10-07 13:16:27 +0000
committerRichard Nyberg <rnyberg@murmeldjur.se>2006-10-07 13:16:27 +0000
commita497ca472a72db4cbe7d8d1831d7b71fe2480778 (patch)
tree1e4b8cd56dda082f1db3eb505260f21b1fdb3d5f
parent0eb36d3914b11b6cd7dc77de5380a191d0e6a124 (diff)
downloadbtpd-a497ca472a72db4cbe7d8d1831d7b71fe2480778.tar.gz
btpd-a497ca472a72db4cbe7d8d1831d7b71fe2480778.zip
Help text changes and make del and start take the --help option.
-rw-r--r--cli/add.c12
-rw-r--r--cli/btcli.c20
-rw-r--r--cli/del.c17
-rw-r--r--cli/start.c23
-rw-r--r--cli/stop.c8
5 files changed, 59 insertions, 21 deletions
diff --git a/cli/add.c b/cli/add.c
index cc7e383..2b237df 100644
--- a/cli/add.c
+++ b/cli/add.c
@@ -7,19 +7,23 @@ usage_add(void)
         "Add torrents to btpd.\n"
         "\n"
         "Usage: add [--topdir] -d dir file\n"
-        "       add file ...\n"
         "\n"
         "Arguments:\n"
-        "file ...\n"
-        "\tOne or more torrents to add.\n"
+        "file\n"
+        "\tThe torrent file to add.\n"
         "\n"
         "Options:\n"
         "-d dir\n"
         "\tUse the dir for content.\n"
         "\n"
+        "-n name\n"
+        "\tSet the name displayed for this torrent.\n"
+        "\n"
+        "--nostart, -N\n"
+        "\tDon't activate the torrent after adding it.\n"
+        "\n"
         "--topdir\n"
         "\tAppend the torrent top directory (if any) to the content path.\n"
-        "\tThis option cannot be used without the '-d' option.\n"
         "\n"
         );
     exit(1);
diff --git a/cli/btcli.c b/cli/btcli.c
index f1305a2..1b0c2de 100644
--- a/cli/btcli.c
+++ b/cli/btcli.c
@@ -122,14 +122,18 @@ usage(void)
         "\tShow this text or help for the specified command.\n"
         "\n"
         "Commands:\n"
-        "add\n"
-        "del\n"
-        "kill\n"
-        "list\n"
-        "start\n"
-        "stat\n"
-        "stop\n"
-        "\n");
+        "add\t-\tAdd torrents to btpd.\n"
+        "del\t-\tRemove torrents from btpd.\n"
+        "kill\t-\tShut down btpd.\n"
+        "list\t-\tList torrents.\n"
+        "start\t-\tActivate torrents.\n"
+        "stat\t-\tDisplay stats for active torrents.\n"
+        "stop\t-\tDeactivate torrents.\n"
+        "\n"
+        "Note:\n"
+        "Torrents can be specified either with its number or its file.\n"
+        "\n"
+        );
     exit(1);
 }
 
diff --git a/cli/del.c b/cli/del.c
index 91e53b6..dbbf3c6 100644
--- a/cli/del.c
+++ b/cli/del.c
@@ -9,22 +9,33 @@ usage_del(void)
         "Usage: del torrent ...\n"
         "\n"
         "Arguments:\n"
-        "file ...\n"
+        "torrent ...\n"
         "\tThe torrents to remove.\n"
         "\n");
     exit(1);
 }
 
+static struct option del_opts [] = {
+    { "help", no_argument, NULL, 'H' },
+    {NULL, 0, NULL, 0}
+};
+
 void
 cmd_del(int argc, char **argv)
 {
+    int ch;
     struct ipc_torrent t;
 
-    if (argc < 2)
+    while ((ch = getopt_long(argc, argv, "", del_opts, NULL)) != -1)
+        usage_del();
+    argc -= optind;
+    argv += optind;
+
+    if (argc < 1)
         usage_del();
 
     btpd_connect();
-    for (int i = 1; i < argc; i++)
+    for (int i = 0; i < argc; i++)
         if (torrent_spec(argv[i], &t))
             handle_ipc_res(btpd_del(ipc, &t), "del", argv[i]);
 }
diff --git a/cli/start.c b/cli/start.c
index 28d3ce1..e3a3684 100644
--- a/cli/start.c
+++ b/cli/start.c
@@ -4,24 +4,39 @@ void
 usage_start(void)
 {
     printf(
-        "Start torrents.\n"
+        "Activate torrents.\n"
         "\n"
-        "Usage: start torrent\n"
+        "Usage: start torrent ...\n"
+        "\n"
+        "Arguments:\n"
+        "torrent ...\n"
+        "\tThe torrents to activate.\n"
         "\n"
         );
     exit(1);
 }
 
+static struct option start_opts [] = {
+    { "help", no_argument, NULL, 'H' },
+    {NULL, 0, NULL, 0}
+};
+
 void
 cmd_start(int argc, char **argv)
 {
+    int ch;
     struct ipc_torrent t;
 
-    if (argc < 2)
+    while ((ch = getopt_long(argc, argv, "", start_opts, NULL)) != -1)
+        usage_start();
+    argc -= optind;
+    argv += optind;
+
+    if (argc < 1)
         usage_start();
 
     btpd_connect();
-    for (int i = 1; i < argc; i++)
+    for (int i = 0; i < argc; i++)
         if (torrent_spec(argv[i], &t))
             handle_ipc_res(btpd_start(ipc, &t), "start", argv[i]);
 }
diff --git a/cli/stop.c b/cli/stop.c
index 2377980..218d7d6 100644
--- a/cli/stop.c
+++ b/cli/stop.c
@@ -4,14 +4,18 @@ void
 usage_stop(void)
 {
     printf(
-        "Stop torrents.\n"
+        "Deactivate torrents.\n"
         "\n"
         "Usage: stop -a\n"
         "       stop torrent ...\n"
         "\n"
+        "Arguments:\n"
+        "torrent ...\n"
+        "\tThe torrents to deactivate.\n"
+        "\n"
         "Options:\n"
         "-a\n"
-        "\tStop all active torrents.\n"
+        "\tDeactivate all active torrents.\n"
         "\n"
         );
     exit(1);