瀏覽代碼

Help text changes and make del and start take the --help option.

master
Richard Nyberg 18 年之前
父節點
當前提交
a497ca472a
共有 5 個檔案被更改,包括 59 行新增21 行删除
  1. +8
    -4
      cli/add.c
  2. +12
    -8
      cli/btcli.c
  3. +14
    -3
      cli/del.c
  4. +19
    -4
      cli/start.c
  5. +6
    -2
      cli/stop.c

+ 8
- 4
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);


+ 12
- 8
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);
}



+ 14
- 3
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]);
}

+ 19
- 4
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]);
}

+ 6
- 2
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);


Loading…
取消
儲存