mirror of
https://github.com/transmission/transmission
synced 2025-01-31 11:23:40 +00:00
Add -h and -v command-line options.
This commit is contained in:
parent
85a36967d2
commit
738f24d46d
1 changed files with 17 additions and 0 deletions
17
gtk/main.c
17
gtk/main.c
|
@ -267,12 +267,29 @@ main(int argc, char **argv) {
|
||||||
|
|
||||||
GList *
|
GList *
|
||||||
readargs(int argc, char **argv) {
|
readargs(int argc, char **argv) {
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
if(NULL == (name = strrchr(argv[0], '/')) || '\0' == *(++name))
|
||||||
|
name = argv[0];
|
||||||
|
|
||||||
while(0 < --argc) {
|
while(0 < --argc) {
|
||||||
argv++;
|
argv++;
|
||||||
if(0 == strcmp("--", *argv))
|
if(0 == strcmp("--", *argv))
|
||||||
return checkfilenames(argc - 1, argv + 1);
|
return checkfilenames(argc - 1, argv + 1);
|
||||||
else if('-' != argv[0][0])
|
else if('-' != argv[0][0])
|
||||||
return checkfilenames(argc, argv);
|
return checkfilenames(argc, argv);
|
||||||
|
else if(0 == strcmp("-v", *argv) || 0 == strcmp("--version", *argv)) {
|
||||||
|
printf("%s %s (%d) http://transmission.m0k.org/\n",
|
||||||
|
name, VERSION_STRING, VERSION_REVISION);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
else if(0 == strcmp("-h", *argv) || 0 == strcmp("--help", *argv)) {
|
||||||
|
printf("usage: %1$s [-hv] [files...]\n\n"
|
||||||
|
"If %1$s is already running then a second copy will not be\n"
|
||||||
|
"started, any torrents on the command-line will be opened in the first.\n",
|
||||||
|
name);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in a new issue