/****************************************************************************** * $Id$ * * Copyright (c) 2005-2006 Transmission authors and contributors * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. *****************************************************************************/ #include #include #include #include #include #include #include #include #include /* tr_metainfoFree */ #include #include /* tr_wait */ #include /* tr_webRun */ #define LINEWIDTH 80 #define MY_NAME "transmission-cli" static int showInfo = 0; static int showScrape = 0; static int isPrivate = 0; static int verboseLevel = 0; static int encryptionMode = TR_ENCRYPTION_PREFERRED; static int peerPort = TR_DEFAULT_PORT; static int peerSocketTOS = TR_DEFAULT_PEER_SOCKET_TOS; static int blocklistEnabled = TR_DEFAULT_BLOCKLIST_ENABLED; static int uploadLimit = 20; static int downloadLimit = -1; static int natTraversal = TR_DEFAULT_PORT_FORWARDING_ENABLED; static int verify = 0; static sig_atomic_t gotsig = 0; static sig_atomic_t manualUpdate = 0; static const char * torrentPath = NULL; static const char * downloadDir = NULL; static const char * finishCall = NULL; static const char * announce = NULL; static const char * configdir = NULL; static const char * sourceFile = NULL; static const char * comment = NULL; static const struct tr_option options[] = { { 'a', "announce", "Set the new torrent's announce URL", "a", 1, "" }, { 'b', "blocklist", "Enable peer blocklists", "b", 0, NULL }, { 'B', "no-blocklist", "Disable peer blocklists", "B", 0, NULL }, { 'c', "comment", "Set the new torrent's comment", "c", 1, "" }, { 'd', "downlimit", "Set max download speed in KB/s", "d", 1, "" }, { 'D', "no-downlimit", "Don't limit the download speed", "D", 0, NULL }, { 910, "encryption-required", "Encrypt all peer connections", "er", 0, NULL }, { 911, "encryption-preferred", "Prefer encrypted peer connections", "ep", 0, NULL }, { 912, "encryption-tolerated", "Prefer unencrypted peer connections", "et", 0, NULL }, { 'f', "finish", "Run a script when the torrent finishes", "f", 1, "