diff --git a/COPYING b/COPYING index d60c31a97..d159169d1 100644 --- a/COPYING +++ b/COPYING @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - - GNU GENERAL PUBLIC LICENSE + + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions: License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -225,7 +225,7 @@ impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -303,17 +303,16 @@ the "copyright" line and a pointer to where the full notice is found. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names: This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General +library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. diff --git a/README b/README index f2aca1eea..24667967a 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ necessary. The man page "doc/rtorrent.1" must be generated with "docbook2man rtorrent.1.xml" if it is missing. Note that rtorrent follows the development of libtorrent closely, and -thus the versions must be in sync. This should not be nessesary in the +thus the versions must be in sync. This should not be necessary in the future, when the library API stabilizes. USAGE diff --git a/doc/faq.xml b/doc/faq.xml index aed0c8c4f..369dcedb0 100644 --- a/doc/faq.xml +++ b/doc/faq.xml @@ -93,7 +93,7 @@ When I try downloading a torrent the client aborts (SIGABRT), what should I do? - Make sure you arn't using "-fomit-frame-pointer" when + Make sure you aren't using "-fomit-frame-pointer" when compiling libtorrent and rtorrent, this is known to produce bad code for C++ exception handling. If this doesn't help, run the client in gdb and use "bt -20" to get a backtrace. Send diff --git a/doc/log_stats.plot b/doc/log_stats.plot index 1e02bde14..84ce4af7a 100755 --- a/doc/log_stats.plot +++ b/doc/log_stats.plot @@ -1,4 +1,4 @@ -#/bin/bash +#!/bin/bash gnuplot << EOF # 1) system.time_seconds= # diff --git a/doc/manual/logging.md b/doc/manual/logging.md index 19441a8d1..4875b0383 100644 --- a/doc/manual/logging.md +++ b/doc/manual/logging.md @@ -31,7 +31,7 @@ Each log handle can be added to multiple different logging events. "debug" The above events receive logging events from all the sub-groups -displayed below, and each event also reciving events from the event +displayed below, and each event also receiving events from the event above in importance. Thus some high-volume sub-group events such as “tracker\_debug” are not diff --git a/doc/manual/logging.tex b/doc/manual/logging.tex index 67aa294ea..68531d1f8 100644 --- a/doc/manual/logging.tex +++ b/doc/manual/logging.tex @@ -39,7 +39,7 @@ \subsection{Logging events} \end{verbatim} The above events receive logging events from all the sub-groups -displayed below, and each event also reciving events from the event +displayed below, and each event also receiving events from the event above in importance. Thus some high-volume sub-group events such as ``tracker\_debug'' are diff --git a/doc/plot/instrumentation_mincore.sh b/doc/plot/instrumentation_mincore.sh index 37971a93f..c6deeb6c8 100755 --- a/doc/plot/instrumentation_mincore.sh +++ b/doc/plot/instrumentation_mincore.sh @@ -1,4 +1,4 @@ -#/bin/bash +#!/bin/bash gnuplot << EOF set terminal png size 1024 * 1, 768 enhanced diff --git a/doc/plot/instrumentation_transfers.sh b/doc/plot/instrumentation_transfers.sh index 297d8b90e..f8b2a4015 100755 --- a/doc/plot/instrumentation_transfers.sh +++ b/doc/plot/instrumentation_transfers.sh @@ -1,4 +1,4 @@ -#/bin/bash +#!/bin/bash gnuplot << EOF set terminal png size 1024,768 enhanced diff --git a/doc/rtorrent_fast_resume.pl b/doc/rtorrent_fast_resume.pl index ea9daa8fe..286507a8a 100755 --- a/doc/rtorrent_fast_resume.pl +++ b/doc/rtorrent_fast_resume.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Perl script to add rTorrent fast resume data to torrent files. # diff --git a/doc/scripts/init/rtorrentInitScreen.bash b/doc/scripts/init/rtorrentInitScreen.bash index 6edb1d4d3..707fbde14 100755 --- a/doc/scripts/init/rtorrentInitScreen.bash +++ b/doc/scripts/init/rtorrentInitScreen.bash @@ -4,10 +4,10 @@ ############# # This script depends on screen. # For the stop function to work, you must set an -# explicit session directory using absolute paths (no, ~ is not absolute) in your rtorrent.rc. +# explicit session directory using ABSOLUTE paths (no, ~ is not absolute) in your rtorrent.rc. # If you typically just start rtorrent with just "rtorrent" on the # command line, all you need to change is the "user" option. -# Attach to the screen session as your user with +# Attach to the screen session as your user with # "screen -dr rtorrent". Change "rtorrent" with srnname option. # Licensed under the GPLv2 by lostnihilist: lostnihilist _at_ gmail _dot_ com ############## @@ -17,19 +17,18 @@ ####################### ##Start Configuration## ####################### -# You can specify your configuration in a different file +# You can specify your configuration in a different file # (so that it is saved with upgrades, saved in your home directory, # or whatever reason you want to) # by commenting out/deleting the configuration lines and placing them # in a text file (say /home/user/.rtorrent.init.conf) exactly as you would # have written them here (you can leave the comments if you desire -# and then uncommenting the following line correcting the path/filename +# and then uncommenting the following line correcting the path/filename # for the one you used. note the space after the ".". # . /etc/rtorrent.init.conf - #Do not put a space on either side of the equal signs e.g. -# user = user +# user = user # will not work # system user to run as (can only use one) user="user" @@ -89,15 +88,15 @@ checkcnfg() { echo "cannot find $NAME binary in PATH: $PATH" | tee -a "$logfile" >&2 exit 3 fi - for (( i=0 ; i < ${#config[@]} ; i++ )) ; do + for (( i=0 ; i < ${#config[@]} ; i++ )) ; do if ! [ -r "${config[i]}" ] ; then - echo "cannot find readable config ${config[i]}. check that it is there and permissions are appropriate" | tee -a "$logfile" >&2 - exit 3 + echo "cannot find readable config ${config[i]}. check that it is there and permissions are appropriate" | tee -a "$logfile" >&2 + exit 3 fi session=$(getsession "${config[i]}") if ! [ -d "${session}" ] ; then - echo "cannot find readable session directory ${session} from config ${config[i]}. check permissions" | tee -a "$logfile" >&2 - exit 3 + echo "cannot find readable session directory ${session} from config ${config[i]}. check permissions" | tee -a "$logfile" >&2 + exit 3 fi done } @@ -109,7 +108,7 @@ d_start() { # this works for the screen command, but starting rtorrent below adopts screen session gid # even if it is not the screen session we started (e.g. running under an undesirable gid #su -c "screen -ls | grep -sq "\.${srnname}[[:space:]]" " ${user} || su -c "sg \"$group\" -c \"screen -fn -dm -S ${srnname} 2>&1 1>/dev/null\"" ${user} | tee -a "$logfile" >&2 - for (( i=0 ; i < ${#options[@]} ; i++ )) ; do + for (( i=0 ; i < ${#options[@]} ; i++ )) ; do sleep 3 su -c "screen -S "${srnname}" -X screen rtorrent ${options[i]} 2>&1 1>/dev/null" ${user} | tee -a "$logfile" >&2 done @@ -119,20 +118,20 @@ d_stop() { for (( i=0 ; i < ${#config[@]} ; i++ )) ; do session=$(getsession "${config[i]}") if ! [ -s ${session}/rtorrent.lock ] ; then - return + return fi pid=$(cat ${session}/rtorrent.lock | awk -F: '{print($2)}' | sed "s/[^0-9]//g") # make sure the pid doesn't belong to another process if ps -A | grep -sq ${pid}.*rtorrent ; then - kill -s INT ${pid} + kill -s INT ${pid} fi done } -getsession() { - session=$(cat "$1" | grep "^[[:space:]]*session.path.set[[:space:]]*=" | sed "s/^[[:space:]]*session.path.set[[:space:]]*=[[:space:]]*//" ) - #session=${session/#~/`getent passwd ${user}|cut -d: -f6`} - echo $session +getsession() { + session=$(cat "$1" | grep "^[[:space:]]*session.path.set[[:space:]]*=" | sed "s/^[[:space:]]*session.path.set[[:space:]]*=[[:space:]]*//" ) + #session=${session/#~/`getent passwd ${user}|cut -d: -f6`} + echo $session } checkcnfg diff --git a/doc/scripts/init/rtorrentInitScreen.sh b/doc/scripts/init/rtorrentInitScreen.sh index 7615dd03e..0fec14f48 100755 --- a/doc/scripts/init/rtorrentInitScreen.sh +++ b/doc/scripts/init/rtorrentInitScreen.sh @@ -7,7 +7,7 @@ # explicit session directory using ABSOLUTE paths (no, ~ is not absolute) in your rtorrent.rc. # If you typically just start rtorrent with just "rtorrent" on the # command line, all you need to change is the "user" option. -# Attach to the screen session as your user with +# Attach to the screen session as your user with # "screen -dr rtorrent". Change "rtorrent" with srnname option. # Licensed under the GPLv2 by lostnihilist: lostnihilist _at_ gmail _dot_ com ############## @@ -17,18 +17,18 @@ ####################### ##Start Configuration## ####################### -# You can specify your configuration in a different file +# You can specify your configuration in a different file # (so that it is saved with upgrades, saved in your home directory, -# or whateve reason you want to) +# or whatever reason you want to) # by commenting out/deleting the configuration lines and placing them # in a text file (say /home/user/.rtorrent.init.conf) exactly as you would # have written them here (you can leave the comments if you desire -# and then uncommenting the following line correcting the path/filename +# and then uncommenting the following line correcting the path/filename # for the one you used. note the space after the ".". # . /etc/rtorrent.init.conf #Do not put a space on either side of the equal signs e.g. -# user = user +# user = user # will not work # system user to run as user="user" @@ -53,6 +53,7 @@ logfile="/var/log/rtorrentInit.log" ####################### ###END CONFIGURATION### ####################### + PATH=/usr/bin:/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin DESC="rtorrent" NAME=rtorrent @@ -60,26 +61,26 @@ DAEMON=$NAME SCRIPTNAME=/etc/init.d/$NAME checkcnfg() { - exists=0 - for i in `echo "$PATH" | tr ':' '\n'` ; do - if [ -f $i/$NAME ] ; then - exists=1 - break - fi - done - if [ $exists -eq 0 ] ; then - echo "cannot find rtorrent binary in PATH $PATH" | tee -a "$logfile" >&2 - exit 3 - fi - if ! [ -r "${config}" ] ; then - echo "cannot find readable config ${config}. check that it is there and permissions are appropriate" | tee -a "$logfile" >&2 - exit 3 - fi - session=`getsession "$config"` - if ! [ -d "${session}" ] ; then - echo "cannot find readable session directory ${session} from config ${config}. check permissions" | tee -a "$logfile" >&2 - exit 3 + exists=0 + for i in `echo "$PATH" | tr ':' '\n'` ; do + if [ -f $i/$NAME ] ; then + exists=1 + break fi + done + if [ $exists -eq 0 ] ; then + echo "cannot find rtorrent binary in PATH: $PATH" | tee -a "$logfile" >&2 + exit 3 + fi + if ! [ -r "${config}" ] ; then + echo "cannot find readable config ${config}. check that it is there and permissions are appropriate" | tee -a "$logfile" >&2 + exit 3 + fi + session=`getsession "$config"` + if ! [ -d "${session}" ] ; then + echo "cannot find readable session directory ${session} from config ${config}. check permissions" | tee -a "$logfile" >&2 + exit 3 + fi } d_start() { @@ -93,19 +94,19 @@ d_start() { } d_stop() { - session=`getsession "$config"` - if ! [ -s ${session}/rtorrent.lock ] ; then - return - fi - pid=`cat ${session}/rtorrent.lock | awk -F: '{print($2)}' | sed "s/[^0-9]//g"` - if ps -A | grep -sq ${pid}.*rtorrent ; then # make sure the pid doesn't belong to another process - kill -s INT ${pid} - fi + session=`getsession "$config"` + if ! [ -s ${session}/rtorrent.lock ] ; then + return + fi + pid=`cat ${session}/rtorrent.lock | awk -F: '{print($2)}' | sed "s/[^0-9]//g"` + if ps -A | grep -sq ${pid}.*rtorrent ; then # make sure the pid doesn't belong to another process + kill -s INT ${pid} + fi } -getsession() { - session=`cat "$1" | grep "^[[:space:]]*session.path.set[[:space:]]*=" | sed "s/^[[:space:]]*session.path.set[[:space:]]*=[[:space:]]*//" ` - echo $session +getsession() { + session=`cat "$1" | grep "^[[:space:]]*session.path.set[[:space:]]*=" | sed "s/^[[:space:]]*session.path.set[[:space:]]*=[[:space:]]*//" ` + echo $session } checkcnfg diff --git a/doc/scripts/init/rtorrentInitTmux.bash b/doc/scripts/init/rtorrentInitTmux.bash index 1b93cc79a..6847e64a4 100755 --- a/doc/scripts/init/rtorrentInitTmux.bash +++ b/doc/scripts/init/rtorrentInitTmux.bash @@ -35,16 +35,19 @@ ####################### ##Start Configuration## ####################### -# You can specify your configuration in a different file. +# You can specify your configuration in a different file # (so that it is saved with upgrades, saved in your home directory, # or whatever reason you want to) # by commenting out/deleting the configuration lines and placing them # in a text file (say /home/user/.rtorrent.init.conf) exactly as you would # have written them here (you can leave the comments if you desire -# and then uncommenting the following line correcting the path/filename. +# and then uncommenting the following line correcting the path/filename # for the one you used. note the space after the ".". # . /etc/rtorrent.init.conf +#Do not put a space on either side of the equal signs e.g. +# user = user +# will not work # system user to run as user="username" @@ -69,98 +72,95 @@ tmuxwindowname="rT" ####################### ###END CONFIGURATION### ####################### + PATH=/usr/bin:/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin NAME=rtorrent DAEMON=$NAME SCRIPTNAME=/etc/init.d/$NAME RTXMLRPCBIN="$base/bin/rtxmlrpc" - checkcnfg() { - if [ -z "$(which $DAEMON)" ] ; then - echo "Cannot find $DAEMON binary in PATH: $PATH" - exit 3 - fi - if ! [ -r "$config" ] ; then - echo "Cannot find readable config $config. Check that it is there and permissions are appropriate" - exit 3 - fi - if ! [ -d "$sessiondir" ] ; then - echo "Cannot find readable session directory $sessiondir from config $config. Check permissions" - exit 3 - fi + if ! command -v "$DAEMON" >/dev/null ; then + echo "Cannot find $DAEMON binary in PATH: $PATH" + exit 3 + fi + if ! [ -r "$config" ] ; then + echo "Cannot find readable config $config. Check that it is there and permissions are appropriate" + exit 3 + fi + if ! [ -d "$sessiondir" ] ; then + echo "Cannot find readable session directory $sessiondir from config $config. Check permissions" + exit 3 + fi } status() { - if [ -e "${sessiondir}/rtorrent.lock" ] ; then - pid=`cat ${sessiondir}/rtorrent.lock | awk -F: '{print($2)}' | sed "s/[^0-9]//g"` - # make sure the pid isn't empty and doesn't belong to another process : this will match lines containing rtorrent, which grep '[r]torrent' does not! - # if there is no process as the 'pid' suggests then delete the stuck "rtorrent.lock" file (to be able to start rtorrent) - [[ -n "$pid" ]] && ps aux | grep -sq ${pid}.*[r]torrent && echo -e ${pid} || rm -f "${sessiondir}/rtorrent.lock" - fi + if [ -e "${sessiondir}/rtorrent.lock" ] ; then + pid=`cat ${sessiondir}/rtorrent.lock | awk -F: '{print($2)}' | sed "s/[^0-9]//g"` + # make sure the pid isn't empty and doesn't belong to another process : this will match lines containing rtorrent, which grep '[r]torrent' does not! + # if there is no process as the 'pid' suggests then delete the stuck "rtorrent.lock" file (to be able to start rtorrent) + [[ -n "$pid" ]] && ps aux | grep -sq ${pid}.*[r]torrent && echo -e ${pid} || rm -f "${sessiondir}/rtorrent.lock" + fi } - d_start() { - [ -d "$base" ] && cd "$base" - # if STDIN is a terminal (we are using interactive mode) - [ -t 0 ] && stty stop undef && stty start undef - # start the default 2 tmux window (bash and mc) if there isn't tmux session called "tmuxname" option (rtorrent) - if ! su -c "tmux ls | grep -sq ${tmuxname}: " $user ; then - # 1st window (0): split it into 3 panes, display 'date' in the last one - su -c "tmux -2u new-session -d -s ${tmuxname} -n 'shell1'" $user - su -c "tmux -2u split-window -v -t ${tmuxname}:0 'bash'" $user - su -c "tmux -2u split-window -h -t ${tmuxname}:0 'date; bash'" $user - # 2nd window (1): start 'mc' if it exists - su -c "tmux -2u new-window -t ${tmuxname}:1 -n 'mc1' 'command which mc && mc ~/; bash'" $user - fi - # start rtorrent always in the 3rd tmux window (2) if it's not running and leave shell behind to be able to see reason of a crash - if [ "$(status)" == "" ]; then - su -c "tmux -2u list-panes -t ${tmuxname}:2 &>/dev/null && tmux -2u respawn-pane -t ${tmuxname}:2 -k \"${DAEMON} ${options}; bash\" || tmux -2u new-window -t ${tmuxname}:2 -n ${tmuxwindowname} \"${DAEMON} ${options}; bash\"" $user - fi + [ -d "${base}" ] && cd "${base}" + # if STDIN is a terminal (we are using interactive mode) + [ -t 0 ] && stty stop undef && stty start undef + # start the default 2 tmux window (bash and mc) if there isn't tmux session called "tmuxname" option (rtorrent) + if ! su -c "tmux ls | grep -sq ${tmuxname}: " $user ; then + # 1st window (0): split it into 3 panes, display 'date' in the last one + su -c "tmux -2u new-session -d -s ${tmuxname} -n 'shell1'" $user + su -c "tmux -2u split-window -v -t ${tmuxname}:0 'bash'" $user + su -c "tmux -2u split-window -h -t ${tmuxname}:0 'date; bash'" $user + # 2nd window (1): start 'mc' if it exists + su -c "tmux -2u new-window -t ${tmuxname}:1 -n 'mc1' 'command which mc && mc ~/; bash'" $user + fi + # start rtorrent always in the 3rd tmux window (2) if it's not running and leave shell behind to be able to see reason of a crash + if [ "$(status)" == "" ]; then + su -c "tmux -2u list-panes -t ${tmuxname}:2 &>/dev/null && tmux -2u respawn-pane -t ${tmuxname}:2 -k \"${DAEMON} ${options}; bash\" || tmux -2u new-window -t ${tmuxname}:2 -n ${tmuxwindowname} \"${DAEMON} ${options}; bash\"" $user + fi } - d_stop() { - pid=$(status) - if [ "$pid" != "" ]; then - # save session before stopping explicitly (just in case) if rtxmlrpc util exists then wait for 5 seconds to be able to complete it - [ -L "$RTXMLRPCBIN" ] && "$RTXMLRPCBIN" session.save &>/dev/null && sleep 5 - # INT (2, Interrupt from keyboard): normal shutdown - kill -s INT $pid - fi + pid=$(status) + if [ "$pid" != "" ]; then + # save session before stopping explicitly (just in case) if rtxmlrpc util exists then wait for 5 seconds to be able to complete it + [ -L "$RTXMLRPCBIN" ] && "$RTXMLRPCBIN" session.save &>/dev/null && sleep 5 + # INT (2, Interrupt from keyboard): normal shutdown + kill -s INT $pid + fi } checkcnfg - case "$1" in - start) - echo -n "Starting $tmuxwindowname: $NAME" - d_start - echo "." - ;; - stop) - echo -n "Stopping $tmuxwindowname: $NAME" - d_stop - echo "." - ;; - restart|force-reload) - echo -n "Restarting $tmuxwindowname: $NAME" - d_stop - sleep 1 - d_start - echo "." - ;; - status) + start) + echo -n "Starting $tmuxwindowname: $NAME" + d_start + echo "." + ;; + stop) + echo -n "Stopping $tmuxwindowname: $NAME" + d_stop + echo "." + ;; + restart|force-reload) + echo -n "Restarting $tmuxwindowname: $NAME" + d_stop + sleep 1 + d_start + echo "." + ;; + status) status ;; - *) - echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2 - exit 1 - ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2 + exit 1 + ;; esac exit 0 diff --git a/doc/scripts/print_option_string.sh b/doc/scripts/print_option_string.sh index 76abe0028..464ccf533 100755 --- a/doc/scripts/print_option_string.sh +++ b/doc/scripts/print_option_string.sh @@ -8,16 +8,16 @@ echo echo "Introduction" echo "------------" echo -echo "Client version: " `xmlrpc2scgi.py -p scgi://127.0.0.1:${PORT_NUMBER} system.client_version` +echo "Client version: $(xmlrpc2scgi.py -p "scgi://127.0.0.1:${PORT_NUMBER}" system.client_version)" echo -echo "Generated by 'rtorrent/doc/scripts/print_option_string.sh' on `date -u`." +echo "Generated by 'rtorrent/doc/scripts/print_option_string.sh' on $(date -u)." for i in strings.choke_heuristics strings.choke_heuristics.upload strings.choke_heuristics.download strings.connection_type strings.encryption strings.ip_filter strings.ip_tos strings.log_group strings.tracker_event strings.tracker_mode; do echo - echo $i - echo `echo $i | tr 'a-z_.' '-'` + echo "$i" + echo "$i" | tr 'a-z_.' '-' echo echo '```' - xmlrpc2scgi.py -p scgi://127.0.0.1:${PORT_NUMBER} $i | tr , '\n' | tr '[' ' ' | tr ']' ' ' + xmlrpc2scgi.py -p "scgi://127.0.0.1:${PORT_NUMBER}" "$i" | tr , '\n' | tr '[' ' ' | tr ']' ' ' echo '```' done diff --git a/doc/torrent_data b/doc/torrent_data index 9207ae870..df5542c22 100755 --- a/doc/torrent_data +++ b/doc/torrent_data @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl # Perl script to read torrent data diff --git a/rak/algorithm.h b/rak/algorithm.h index 986138201..0af290258 100644 --- a/rak/algorithm.h +++ b/rak/algorithm.h @@ -177,7 +177,7 @@ inline int popcount_wrapper(T t) { } // Get the median of an unordered set of numbers of arbitrary -// type by modifing the underlying dataset +// type by modifying the underlying dataset template T median(_InputIter __first, _InputIter __last) { T __med; diff --git a/rak/functional.h b/rak/functional.h index ac77b2dac..995bd789c 100644 --- a/rak/functional.h +++ b/rak/functional.h @@ -456,7 +456,7 @@ bind2nd(const Operation& op, const Type& val) { // Lightweight callback function including pointer to object. Should // be replaced by TR1 stuff later. Requires an object to bind, instead -// of using a seperate functor for that. +// of using a separate functor for that. template class ptr_fun0 { diff --git a/rak/partial_queue.h b/rak/partial_queue.h index 1abfdddf2..193eedc42 100644 --- a/rak/partial_queue.h +++ b/rak/partial_queue.h @@ -70,7 +70,7 @@ class partial_queue { // check how full we are in the lower parts so the caller knows when // he can stop searching. // - // Though propably not needed, as we must continue til the first + // Though probably not needed, as we must continue til the first // layer is full. size_type max_size() const { return m_maxLayerSize * num_layers; } diff --git a/rak/socket_address.h b/rak/socket_address.h index 8eb601168..654cb8908 100644 --- a/rak/socket_address.h +++ b/rak/socket_address.h @@ -100,7 +100,7 @@ class socket_address { std::string pretty_address_str() const; - // Attemts to set it as an inet, then an inet6 address. It will + // Attempts to set it as an inet, then an inet6 address. It will // never set anything but net addresses, no local/unix. bool set_address_str(const std::string& a) { return set_address_c_str(a.c_str()); } bool set_address_c_str(const char* a); @@ -123,7 +123,7 @@ class socket_address { const sockaddr_in6* c_sockaddr_inet6() const { return &m_sockaddrInet6; } // Copy a socket address which has the length 'length. Zero out any - // extranous bytes and ensure it does not go beyond the size of this + // extraneous bytes and ensure it does not go beyond the size of this // struct. void copy(const socket_address& src, size_t length); void copy_sockaddr(const sockaddr* src); diff --git a/rak/string_manip.h b/rak/string_manip.h index 1a09c3775..54d435f39 100644 --- a/rak/string_manip.h +++ b/rak/string_manip.h @@ -113,7 +113,7 @@ Sequence trim_classic(const Sequence& seq) { return trim_begin_classic(trim_end_classic(seq)); } -// Consider rewritting such that m_seq is replaced by first/last. +// Consider rewriting such that m_seq is replaced by first/last. template class split_iterator_t { public: diff --git a/src/command_ui.cc b/src/command_ui.cc index 1399cfe73..21e6d87b9 100644 --- a/src/command_ui.cc +++ b/src/command_ui.cc @@ -862,7 +862,7 @@ initialize_command_ui() { CMD2_ANY("or", &apply_or); // A temporary command for handling stuff until we get proper - // support for seperation of commands and literals. + // support for separation of commands and literals. CMD2_ANY("branch", std::bind(&apply_if, std::placeholders::_1, std::placeholders::_2, 1)); CMD2_ANY_LIST("less", &apply_less); diff --git a/src/core/download_list.cc b/src/core/download_list.cc index 680810d2b..ff2e52500 100644 --- a/src/core/download_list.cc +++ b/src/core/download_list.cc @@ -315,7 +315,7 @@ DownloadList::close_throw(Download* download) { // Save the torrent on close, this covers shutdown and if a torrent // is manually closed which would clear the progress data. For - // better crash protection, save regulary in addition to this. + // better crash protection, save regularly in addition to this. // // Used to be in pause, but this was wrong for rehashing etc. // @@ -512,7 +512,7 @@ DownloadList::hash_done(Download* download) { // downloaded to ensure something was transferred, thus we didn't // just hash an already completed torrent with lacking session data? // - // Perhaps we should use a seperate variable or state, and check + // Perhaps we should use a separate variable or state, and check // that. Thus we can bork the download if the hash check doesn't // confirm all the data, avoiding large BW usage on f.ex. the // ReiserFS bug with >4GB files. @@ -675,7 +675,7 @@ DownloadList::confirm_finished(Download* download) { // See #1292. // // Just reset the value for the moment. If a torrent finishes while - // others are hashing, or some other situtation that causes resume + // others are hashing, or some other situation that causes resume // flag to change could cause the state to be invalid. // // TODO: Add a check when setting the flags to see if the torrent is diff --git a/src/core/manager.cc b/src/core/manager.cc index 686edd83a..4b7345a3d 100644 --- a/src/core/manager.cc +++ b/src/core/manager.cc @@ -392,7 +392,7 @@ Manager::try_create_download_from_meta_download(torrent::Object* bencode, const f->set_print_log(meta.get_key_value("print_log")); f->slot_finished(std::bind(&rak::call_delete_func, f)); - // Bit of a waste to create the bencode repesentation here + // Bit of a waste to create the bencode representation here // only to have the DownloadFactory decode it. std::stringstream s; s.imbue(std::locale::classic()); @@ -482,7 +482,7 @@ Manager::try_create_download_expand(const std::string& uri, int flags, command_l // DownloadList's hashing related functions don't actually start the // hashing, it only reacts to events. This functions checks the -// hashing view and starts hashing if nessesary. +// hashing view and starts hashing if necessary. void Manager::receive_hashing_changed() { bool foundHashing = std::find_if(m_hashingView->begin_visible(), m_hashingView->end_visible(), diff --git a/src/core/view.cc b/src/core/view.cc index 272cd87c1..22d442436 100644 --- a/src/core/view.cc +++ b/src/core/view.cc @@ -266,7 +266,7 @@ View::filter() { if (m_name == "started" || m_name == "stopped") return; - // Parition the list in two steps so we know which elements changed. + // Partition the list in two steps so we know which elements changed. iterator splitVisible = std::stable_partition(begin_visible(), end_visible(), view_downloads_filter(m_filter, m_temp_filter)); iterator splitFiltered = std::stable_partition(begin_filtered(), end_filtered(), view_downloads_filter(m_filter, m_temp_filter)); diff --git a/src/core/view.h b/src/core/view.h index c6e3d0859..c9cf7a88d 100644 --- a/src/core/view.h +++ b/src/core/view.h @@ -119,7 +119,7 @@ class View : private std::vector { void set_sort_new(const torrent::Object& s) { m_sortNew = s; } void set_sort_current(const torrent::Object& s) { m_sortCurrent = s; } - // Need to explicity trigger filtering. + // Need to explicitly trigger filtering. void filter(); void filter_by(const torrent::Object& condition, base_type& result); void filter_download(core::Download* download); @@ -146,7 +146,7 @@ class View : private std::vector { rak::timer last_changed() const { return m_lastChanged; } void set_last_changed(const rak::timer& t = ::cachedTime) { m_lastChanged = t; } - // Don't connect any slots until after initialize else it get's + // Don't connect any slots until after initialize else it gets // triggered when adding the Download's in DownloadList. signal_void& signal_changed() { return m_signal_changed; } diff --git a/src/core/view_manager.cc b/src/core/view_manager.cc index 7f711c372..e5fa7c305 100644 --- a/src/core/view_manager.cc +++ b/src/core/view_manager.cc @@ -96,7 +96,7 @@ ViewManager::sort(const std::string& name, uint32_t timeout) { if ((*viewItr)->last_changed() + rak::timer::from_seconds(timeout) > cachedTime) return; - // Should we rename sort, or add a seperate function? + // Should we rename sort, or add a separate function? (*viewItr)->filter(); (*viewItr)->sort(); } diff --git a/src/display/canvas.h b/src/display/canvas.h index b324d81a2..e6cfa0742 100644 --- a/src/display/canvas.h +++ b/src/display/canvas.h @@ -82,7 +82,7 @@ class Canvas { chtype bl, chtype br) { if (!m_isDaemon) { wborder(m_window, ls, rs, ts, bs, tl, tr, bl, br); } } // The format string is non-const, but that will not be a problem - // since the string shall always be a C string choosen at + // since the string shall always be a C string chosen at // compiletime. Might cause extra copying of the string? void print(const char* str, ...); diff --git a/src/display/window.h b/src/display/window.h index 8e310aba9..b0053edbf 100644 --- a/src/display/window.h +++ b/src/display/window.h @@ -89,7 +89,7 @@ class Window { bool is_width_dynamic() const { return m_maxWidth > m_minWidth; } bool is_height_dynamic() const { return m_maxHeight > m_minHeight; } - // Do not call mark_dirty() from withing redraw() as it may cause + // Do not call mark_dirty() from within redraw() as it may cause // infinite looping in the display scheduler. bool is_dirty() { return m_taskUpdate.is_queued(); } void mark_dirty() { if (!is_active()) return; m_slotSchedule(this, cachedTime); } diff --git a/src/display/window_file_list.cc b/src/display/window_file_list.cc index b55049086..9be134aaf 100644 --- a/src/display/window_file_list.cc +++ b/src/display/window_file_list.cc @@ -51,7 +51,7 @@ namespace display { // Don't really like the direction of the element dependency, but -// don't really feel like making a seperate class for containing the +// don't really feel like making a separate class for containing the // necessary information. WindowFileList::WindowFileList(const ui::ElementFileList* element) : Window(new Canvas, 0, 0, 0, extent_full, extent_full), diff --git a/src/input/path_input.cc b/src/input/path_input.cc index caf1e17b4..65b386bf3 100644 --- a/src/input/path_input.cc +++ b/src/input/path_input.cc @@ -108,8 +108,8 @@ PathInput::receive_do_complete() { std::string base = rak::make_base(r.first, r.second, rak::const_mem_ref(&utils::directory_entry::d_name)); // Clear the path after the cursor to make this code cleaner. It's - // not really nessesary to add the complexity just because someone - // might start tab-completeing in the middle of a path. + // not really necessary to add the complexity just because someone + // might start tab-completing in the middle of a path. str().resize(dirEnd); str().insert(dirEnd, base); diff --git a/src/main.cc b/src/main.cc index 67a10d4a0..36c7d44f0 100644 --- a/src/main.cc +++ b/src/main.cc @@ -595,7 +595,7 @@ handle_sigbus(int signum, siginfo_t* sa, void* ptr) { void do_panic(int signum) { - // Use the default signal handler in the future to avoid infinit + // Use the default signal handler in the future to avoid infinite // loops. SignalHandler::set_default(signum); display::Canvas::cleanup(); diff --git a/src/rpc/command_scheduler_item.cc b/src/rpc/command_scheduler_item.cc index 42a6ef434..8ce5af9ce 100644 --- a/src/rpc/command_scheduler_item.cc +++ b/src/rpc/command_scheduler_item.cc @@ -56,7 +56,7 @@ CommandSchedulerItem::enable(rak::timer t) { // If 'first' is zero then we execute the task // immediately. ''interval()'' will not return zero so we never end - // up in an infinit loop. + // up in an infinite loop. m_timeScheduled = t; priority_queue_insert(&taskScheduler, &m_task, t); } diff --git a/src/rpc/exec_file.cc b/src/rpc/exec_file.cc index 189914398..ac0ba29f6 100644 --- a/src/rpc/exec_file.cc +++ b/src/rpc/exec_file.cc @@ -62,7 +62,7 @@ const int ExecFile::flag_background; int ExecFile::execute(const char* file, char* const* argv, int flags) { - // Write the execued command and its parameters to the log fd. + // Write the executed command and its parameters to the log fd. int __UNUSED result; if (m_logFd != -1) { diff --git a/src/rpc/parse.cc b/src/rpc/parse.cc index 63a6d046d..cd7be0239 100644 --- a/src/rpc/parse.cc +++ b/src/rpc/parse.cc @@ -192,7 +192,7 @@ parse_object(const char* first, const char* last, torrent::Object* dest, bool (* } if (depth > 3) - throw torrent::input_error("Max 3 parantheses per object allowed."); + throw torrent::input_error("Max 3 parentheses per object allowed."); *dest = torrent::Object::create_dict_key(); dest->set_flags(torrent::Object::flag_function << (depth - 1)); @@ -216,7 +216,7 @@ parse_object(const char* first, const char* last, torrent::Object* dest, bool (* } if (depth != 0) - throw torrent::input_error("Parantheses mismatch."); + throw torrent::input_error("Parentheses mismatch."); return first; diff --git a/src/rpc/xmlrpc.cc b/src/rpc/xmlrpc.cc index 8bacd882e..74febd3af 100644 --- a/src/rpc/xmlrpc.cc +++ b/src/rpc/xmlrpc.cc @@ -553,7 +553,7 @@ XmlRpc::insert_command(const char* name, const char* parm, const char* doc) { &xmlrpc_call_command, const_cast(name), parm, doc); if (localEnv.fault_occurred) - throw torrent::internal_error("Fault occured while inserting xmlrpc call."); + throw torrent::internal_error("Fault occurred while inserting xmlrpc call."); xmlrpc_env_clean(&localEnv); } diff --git a/src/thread_base.cc b/src/thread_base.cc index 081791d4c..f64b04de9 100644 --- a/src/thread_base.cc +++ b/src/thread_base.cc @@ -53,7 +53,7 @@ #include "control.h" #include "core/manager.h" -// Temporarly injected into config.h. +// Temporarily injected into config.h. /* temp hack */ //#define lt_cacheline_aligned __attribute__((__aligned__(128))) diff --git a/src/utils/list_focus.h b/src/utils/list_focus.h index c80d0f7d0..764a5e81a 100644 --- a/src/utils/list_focus.h +++ b/src/utils/list_focus.h @@ -59,7 +59,7 @@ class ListFocus { ListFocus(base_type* b = NULL) : m_base(b) { if (b) m_focus = b->end(); } - // Convinience functions, would have added more through using, but + // Convenience functions, would have added more through using, but // can't. iterator begin() { return m_base->begin(); } iterator end() { return m_base->end(); }