Changeset 328 for trunk/gtk


Ignore:
Timestamp:
Jun 11, 2006, 6:08:58 AM (15 years ago)
Author:
joshe
Message:

Add -h and -v command-line options.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/main.c

    r327 r328  
    268268GList *
    269269readargs(int argc, char **argv) {
     270  char *name;
     271
     272  if(NULL == (name = strrchr(argv[0], '/')) || '\0' == *(++name))
     273    name = argv[0];
     274
    270275  while(0 < --argc) {
    271276    argv++;
     
    274279    else if('-' != argv[0][0])
    275280      return checkfilenames(argc, argv);
     281    else if(0 == strcmp("-v", *argv) || 0 == strcmp("--version", *argv)) {
     282      printf("%s %s (%d) http://transmission.m0k.org/\n",
     283             name, VERSION_STRING, VERSION_REVISION);
     284      exit(0);
     285    }
     286    else if(0 == strcmp("-h", *argv) || 0 == strcmp("--help", *argv)) {
     287      printf("usage: %1$s [-hv] [files...]\n\n"
     288"If %1$s is already running then a second copy will not be\n"
     289"started, any torrents on the command-line will be opened in the first.\n",
     290             name);
     291      exit(0);
     292    }
    276293  }
    277294
Note: See TracChangeset for help on using the changeset viewer.