"Options:\n"
" -q: Turn off status messages\n"
" -O <file>: Redirect output to file (use \"-\" for stdout)\n"
+ " -P <dir>: Set directory for output files\n"
" --user=<user> HTTP authentication username\n"
" --password=<password> HTTP authentication password\n"
" --user-agent|-U <str> Set HTTP user agent\n"
signal(SIGPIPE, SIG_IGN);
init_ustream_ssl();
- while ((ch = getopt_long(argc, argv, "cO:qsU:Y:", longopts, &longopt_idx)) != -1) {
+ while ((ch = getopt_long(argc, argv, "cO:P:qsU:Y:", longopts, &longopt_idx)) != -1) {
switch(ch) {
case 0:
switch (longopt_idx) {
case 'O':
output_file = optarg;
break;
+ case 'P':
+ if (chdir(optarg)) {
+ if (!quiet)
+ perror("Change output directory");
+ exit(1);
+ }
+ break;
case 'q':
quiet = true;
break;