Pārlūkot izejas kodu

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

master
Richard Nyberg pirms 18 gadiem
vecāks
revīzija
a497ca472a
5 mainītis faili ar 59 papildinājumiem un 21 dzēšanām
  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 Parādīt failu

@@ -7,19 +7,23 @@ usage_add(void)
"Add torrents to btpd.\n" "Add torrents to btpd.\n"
"\n" "\n"
"Usage: add [--topdir] -d dir file\n" "Usage: add [--topdir] -d dir file\n"
" add file ...\n"
"\n" "\n"
"Arguments:\n" "Arguments:\n"
"file ...\n"
"\tOne or more torrents to add.\n"
"file\n"
"\tThe torrent file to add.\n"
"\n" "\n"
"Options:\n" "Options:\n"
"-d dir\n" "-d dir\n"
"\tUse the dir for content.\n" "\tUse the dir for content.\n"
"\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" "--topdir\n"
"\tAppend the torrent top directory (if any) to the content path.\n" "\tAppend the torrent top directory (if any) to the content path.\n"
"\tThis option cannot be used without the '-d' option.\n"
"\n" "\n"
); );
exit(1); exit(1);


+ 12
- 8
cli/btcli.c Parādīt failu

@@ -122,14 +122,18 @@ usage(void)
"\tShow this text or help for the specified command.\n" "\tShow this text or help for the specified command.\n"
"\n" "\n"
"Commands:\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); exit(1);
} }




+ 14
- 3
cli/del.c Parādīt failu

@@ -9,22 +9,33 @@ usage_del(void)
"Usage: del torrent ...\n" "Usage: del torrent ...\n"
"\n" "\n"
"Arguments:\n" "Arguments:\n"
"file ...\n"
"torrent ...\n"
"\tThe torrents to remove.\n" "\tThe torrents to remove.\n"
"\n"); "\n");
exit(1); exit(1);
} }


static struct option del_opts [] = {
{ "help", no_argument, NULL, 'H' },
{NULL, 0, NULL, 0}
};

void void
cmd_del(int argc, char **argv) cmd_del(int argc, char **argv)
{ {
int ch;
struct ipc_torrent t; 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(); usage_del();


btpd_connect(); btpd_connect();
for (int i = 1; i < argc; i++)
for (int i = 0; i < argc; i++)
if (torrent_spec(argv[i], &t)) if (torrent_spec(argv[i], &t))
handle_ipc_res(btpd_del(ipc, &t), "del", argv[i]); handle_ipc_res(btpd_del(ipc, &t), "del", argv[i]);
} }

+ 19
- 4
cli/start.c Parādīt failu

@@ -4,24 +4,39 @@ void
usage_start(void) usage_start(void)
{ {
printf( printf(
"Start torrents.\n"
"Activate torrents.\n"
"\n" "\n"
"Usage: start torrent\n"
"Usage: start torrent ...\n"
"\n"
"Arguments:\n"
"torrent ...\n"
"\tThe torrents to activate.\n"
"\n" "\n"
); );
exit(1); exit(1);
} }


static struct option start_opts [] = {
{ "help", no_argument, NULL, 'H' },
{NULL, 0, NULL, 0}
};

void void
cmd_start(int argc, char **argv) cmd_start(int argc, char **argv)
{ {
int ch;
struct ipc_torrent t; 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(); usage_start();


btpd_connect(); btpd_connect();
for (int i = 1; i < argc; i++)
for (int i = 0; i < argc; i++)
if (torrent_spec(argv[i], &t)) if (torrent_spec(argv[i], &t))
handle_ipc_res(btpd_start(ipc, &t), "start", argv[i]); handle_ipc_res(btpd_start(ipc, &t), "start", argv[i]);
} }

+ 6
- 2
cli/stop.c Parādīt failu

@@ -4,14 +4,18 @@ void
usage_stop(void) usage_stop(void)
{ {
printf( printf(
"Stop torrents.\n"
"Deactivate torrents.\n"
"\n" "\n"
"Usage: stop -a\n" "Usage: stop -a\n"
" stop torrent ...\n" " stop torrent ...\n"
"\n" "\n"
"Arguments:\n"
"torrent ...\n"
"\tThe torrents to deactivate.\n"
"\n"
"Options:\n" "Options:\n"
"-a\n" "-a\n"
"\tStop all active torrents.\n"
"\tDeactivate all active torrents.\n"
"\n" "\n"
); );
exit(1); exit(1);


Notiek ielāde…
Atcelt
Saglabāt