home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / comm / tcp / AmIRCFetch.lha / Fetch.amirx < prev   
Encoding:
Text File  |  1997-02-13  |  4.2 KB  |  137 lines

  1. /* Fetch script for use with AmIRC 1.x */ Version='1.05'/*
  2. // Written by Deryk Robosson 11.19.96
  3. //
  4. // 11.24.96 - added .readme fetching support
  5. // 16.1.97 - added support for result codes
  6. // 4.2.97 - added path variable for ftpget and updated
  7. //          the docs
  8. //          added support for not obtaining the .readmes
  9. //          added multi site support - Requested by TheBarron
  10. // 13.2.97 - added .readme viewing support - Suggested by Gallant
  11. //           optimised the source - Suggestions made by Gallant
  12. //
  13. // newlook@ameritech.net newlook on #amiga IRC (EfNet)
  14. */
  15. bold=d2c(2)
  16.  
  17. /* this is the default site list, edit for any changes */
  18. site0 = "wuarchive.wustl.edu"
  19. site1 = "ftp.netnet.net"
  20. site2 = "ftp.uni-paderborn.de"
  21. site3 = "ftp.doc.ic.ac.uk"
  22. site4 = "ftp.ninemoons.com"
  23.  
  24. /* change this to 0 if you don't want readme files, 1 otherwise */
  25. readmes=1
  26.  
  27. /* change this to 0 if you don't want the readme files displayed after download , 1 otherwise */
  28. displayreadme=1
  29.  
  30. /* Change this to your favorite site */
  31. defaultsite=site0 /*'wuarchive.wustl.edu'*/
  32.  
  33. /* Change this to your default incoming directory */
  34. incomingdir="in:"
  35.  
  36. /* Change this to reflect the path of ftpget */
  37. path="amitcp:bin/ftpget"
  38.  
  39. /* Change this to your favorite text viewer */
  40. textviewer="sys:utilities/multiview"
  41.  
  42. /* Change this to your email address */
  43. pass="newlook@ameritech.net"
  44.  
  45. options results
  46. parse arg file" "param
  47.  
  48. if file="" then do
  49.     Call Version()
  50.     Exit
  51. end
  52. if upper(file)="VER" then do
  53.     Call Version()
  54.     Exit
  55. end
  56. if upper(file)="HELP" then do
  57.     Call Help()
  58.     Exit
  59. end
  60.  
  61. if upper(file)="SITELIST" then do
  62.     Call ListSites()
  63.     Exit
  64. end
  65.  
  66. if param~="" then do
  67.     select
  68.         when param=0 then defaultsite=site0
  69.         when param=1 then defaultsite=site1
  70.         when param=2 then defaultsite=site2
  71.         when param=3 then defaultsite=site3
  72.         when param=4 then defaultsite=site4
  73.         otherwise
  74.             defaultsite=site0
  75.     end
  76. end
  77.  
  78. /* prepare for the main file */
  79. remote="REMOTE /pub/aminet/"file
  80.  
  81. /* prepare for the readme file */
  82. if readmes=1 then do
  83.     file1=left(file,length(file)-3)     /* truncate the filename */
  84.     file2=file1||'readme'               /* append the readme */
  85.     remote=remote" /pub/aminet/"file2   /* append readme to remote */
  86. end
  87.  
  88. /* setup the commandline parameters */
  89. getit=path||" "||defaultsite||" "||remote||" LOCAL "||incomingdir||" USER anonymous PASS "||pass||" QUIET"
  90. ADDRESS COMMAND getit                  /* grab the file */
  91.  
  92. select      /* inform the user as to the status of the command */
  93.     when rc=0 then "echo File retrieval finished."
  94.     when rc=21 then "echo Invalid arguments"
  95.     when rc=22 then "echo Cannot locate the given file list."
  96.     when rc=23 then "echo Couldn't open bsdsocket.library."
  97.     when rc=24 then "echo Cannot allocate enough memory for the buffer."
  98.     when rc=25 then "echo Invalid password argument."
  99.     when rc=26 then "echo Remote site doesn't exist."
  100.     when rc=27 then "echo Remote server not responding/unavailable."
  101.     when rc=28 then "echo User name not accepted at remote site."
  102.     when rc=29 then "echo Password not accepted at remote site."
  103.     when rc=30 then "echo Account not accepted at remote site."
  104.     when rc=31 then "echo Cannot obtain the remote file/permission denied."
  105.     when rc=32 then "echo Cannot create the local file."
  106.     when rc=33 then "echo Transfer aborted or Transfer error."
  107.     otherwise
  108.         "echo An unknown error has occured."
  109. end
  110.  
  111. if readmes=1 then if displayreadme=1 then address COMMAND textviewer||" "incomingdir||substr(file2,lastpos('/',file2)+1,length(file2))
  112. EXIT
  113.  
  114. Version:
  115. "echo "BOLD"Fetch.AMIRX"BOLD" Version "BOLD||VERSION||BOLD
  116. "echo ""Read the top of Fetch.AMIRX script for history."
  117. "echo "BOLD"©1996"BOLD" Deryk Robososn "BOLD"(newlook)"BOLD" - [newlook@ameritech.net]"
  118. "echo "BOLD"HELP:"BOLD" /<alias> help"
  119. return
  120.  
  121. Help:
  122. "echo "BOLD"Fetch.AMIRX"BOLD" Help"
  123. "echo /<alias> comm/tcp/AmIRCFetch.lha 2 to get file from site #2"
  124. "echo "BOLD"SITELIST - "BOLD"displays current aminet site list"
  125. "echo "BOLD"VER - "BOLD"displays script version"
  126. "echo "BOLD"HELP - "BOLD"displays this file"
  127. return
  128.  
  129. ListSites:
  130. "echo "BOLD"SiteList"BOLD
  131. "echo 0 - wuarchive.wustl.edu"
  132. "echo 1 - ftp.netnet.net"
  133. "echo 2 - ftp.uni-paderborn.de"
  134. "echo 3 - ftp.doc.ic.ac.uk"
  135. "echo 4 - ftp.ninemoons.com"
  136. return
  137.