Guest User

Untitled

a guest
Aug 24th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. diff -u a/buzz b/buzz
  2. --- a/buzz 2010-12-19 16:15:43.083335660 +0100
  3. +++ b/buzz 2010-12-19 16:19:48.763335696 +0100
  4. @@ -4,10 +4,37 @@
  5. USER=""
  6. PASSWORD=""
  7.  
  8. +usage ()
  9. +{
  10. + echo "usage: `basename $0` [mode=auto|manual] [speed=42k|1m]"
  11. + echo " mode=auto downloads files in your basket"
  12. + echo " mode=manual fire up an editor to specify the list of files to downlaod"
  13. + echo " speed= limit download rate"
  14. +}
  15. +
  16. +for arg in $@; do
  17. + case $arg in
  18. + mode=*)
  19. + case ${arg:5} in
  20. + auto) MODE="auto";;
  21. + manual) MODE="manual";;
  22. + *) usage; exit 1;;
  23. + esac
  24. + ;;
  25. + speed=*)
  26. + SPEED_CAP=${arg:6}
  27. + ;;
  28. + *)
  29. + usage
  30. + exit 1
  31. + ;;
  32. + esac
  33. +done
  34. +
  35. WGET=`which wget` # to use curl instead of wget just replace with empty string ''
  36. CURL=`which curl`
  37.  
  38. -EDITOR='mate -w' # $EDITOR (nano, emacs) or mate -w for good people
  39. +EDITOR="${EDITOR:-'mate -w'}" # $EDITOR (nano, emacs) or mate -w for good people
  40. MODE="auto" # auto (using buzz's basket system) or manual (editing a url file)
  41. URL_BASKET=""
  42. FILE_LIST="list.txt"
  43. @@ -19,13 +46,13 @@
  44. # env vars completion
  45. if [ "$USER" = "" ]
  46. then
  47. - echo "Username: \c"
  48. + echo -n "Username: "
  49. read USER
  50. fi
  51.  
  52. if [ "$PASSWORD" = "" ]
  53. then
  54. - echo "Password: \c"
  55. + echo -n "Password: "
  56. stty -echo
  57. read PASSWORD
  58. stty echo
  59. @@ -35,26 +62,6 @@
  60. WGET_ARGS="${WGET_ARGS} --http-user=${USER} --http-password=${PASSWORD}"
  61. CURL_ARGS="${CURL_ARGS} -u ${USER}:${PASSWORD}"
  62.  
  63. -for arg in $@; do
  64. - if [ $arg = "auto" ]
  65. - then
  66. - MODE="auto"
  67. - continue
  68. - fi
  69. - if [ $arg = "manual" ]
  70. - then
  71. - MODE="manual"
  72. - continue
  73. - fi
  74. - if [ $arg = "help" ]
  75. - then
  76. - echo "./buzz [auto|manual] [42k|1m]"
  77. - exit 0
  78. - fi
  79. - SPEED_CAP="$arg"
  80. -done
  81. -
  82. -
  83. # speed limit
  84. if [ "$SPEED_CAP" != "none" ]
  85. then
Add Comment
Please, Sign In to add comment