home *** CD-ROM | disk | FTP | other *** search
/ Acorn User 1 / AU_CD1.iso / internet / starterpak / !TCPIP / TCPIP_Doc / Notes / FTPClient < prev    next >
Text File  |  1995-02-05  |  16KB  |  475 lines

  1. New facilities in FTP Client
  2. ============================
  3.  
  4. The FTP client in !TCPIP has undergone the first stage of improvements
  5. aimed at sorted out UNIX -> RISC OS path convertion problems, and making
  6. it a bit more automated.
  7.  
  8. These include:
  9.  
  10.   The addition of a highly configurable path name processor.
  11.   The addition of a batch ftp facilty.
  12.   The addition of an "mget" command.
  13.   The addition of a "reget" command.
  14.   The addition of a "quote" command.
  15.   The addition of {ftp_data} and {ftp_list} variables.
  16.  
  17.  
  18. Pathname Processor
  19. ------------------
  20.  
  21. The path handling is the main area of improvement, and now allows UNIX
  22. style paths to be parsed for file type extraction from one or more file
  23. name extensions and is able to work out appropriate processing based
  24. upon the extensions present or elements in the basic file name.
  25.  
  26. On the basis of the file name and/or extensions, the ftp client can now
  27. work out what file type to give the file, which directory to store it in
  28. and whether to keep unconverted extensions, whether to keep directory
  29. elements from the original remote path etc.
  30.  
  31. When there is more than one extension, it is able to sensible use one
  32. extension to determine the file's type and another extension, or the
  33. file's name, to determine in which directory the file should be placed.
  34.  
  35. These conversions are done according to a set of rules given in a new
  36. !TCPIP resource file. (!TCPIPUser.PathEnt).
  37.  
  38. When downloading groups of files, for example, the entired contents of a
  39. directory and subdirectories containing C source files, there are often
  40. files which might end up being placed in a different directory to the
  41. rest as a consequence of name/extension base placing. As this can be
  42. undesirable, it is posible to switch off the fully automatic processing,
  43. and force preset processing according to the type of download your are
  44. doing. This is most useful when using the new batch facility.
  45.  
  46. Finally, just in case there are any problems that I have missed, the old
  47. original path name handling is still available in a rather more useable
  48. and improved form.
  49.  
  50. Whatever path processing options are in use, directories are
  51. automatically created. The lack of this was one of the most annoying
  52. problems with previous versions of the FTP client. Also filenames are no
  53. longer actively truncated, allowing advantage to be taken of such
  54. utilities as !LongFiles. With appropriate Risc OS configuration, overly
  55. long filenames will still be truncated, but by Risc OS rather than the
  56. FTP client.
  57.  
  58.  
  59. PathEnt file
  60. ------------
  61.  
  62. The !TCPIPUser.PathEnt consist of a series of either options lines, or
  63. name matching lines. When trying to match a name or extensions, three
  64. types of matching are carried out. These are:
  65.  
  66.   1.  Match the file name to determine where to put the file.
  67.   2.  Match an extension to determine where to put the file.
  68.   3.  Match an extension to determine a file type.
  69.  
  70. The first match in each of the above categories is the one used. How
  71. this effects the layout of the PathEnt file will become clear.
  72.  
  73. Each options line starts with a "$" character and is followed by
  74. required options on the same line, each separated by a space.
  75.  
  76. There are three types of options line as follows:
  77.  
  78. $root <pathname>
  79. "$root <FTP$Dir>"
  80.  
  81. This must be present, once only. The given pathname set the root
  82. directory in which files are to be placed. Normally, this is set to
  83. "<FTP$Dir>" which in turn is set to "!TCPIPUser.Downloads".
  84.  
  85. $default [<option>...]
  86. Example: "$default nocase nfsext truncdir keepext in Misc type &fff"
  87.  
  88. This line must be present, once only. It sets the default path
  89. processing options this are modified by options given later, or applied
  90. directly to any paths that are not otherwise matched.
  91.  
  92. $ [<option>...]
  93. Example: "$ rev1ext in Source"
  94.  
  95. This line contains options that are to be applied to subsequent
  96. extension/filename decoding lines. Any options given are applied in
  97. addition to those given in the default options line.
  98.  
  99. Lines starting with a "#" character, or blank lines are ignored.
  100.  
  101. Lines starting with a "." describe extensions matching. Other lines
  102. describe filename matching.
  103.  
  104. Extension and file name matching lines are as follows:
  105.  
  106. <name>/.<ext>[|<name>/.<ext>...] <file type> [<options>]
  107. Examples: ".c|.cpp|.c++|.h|.[1-8]|.s|.y|.l &fff"
  108.           "rfc* &fff in RFCs"
  109.  
  110. "/" in the above is used to represent "or" in the syntax rather than the
  111. usual "|" as "|" is literally used to separate extensions in a list.
  112. There must be no spaces in the extensions part.
  113.  
  114. The use of wildcards is allowed in the name and extension as follows:
  115.  
  116.   "*"     matches any string of 0 or more characters.
  117.   "?"     matches any single character.
  118.   "[...]" matches a range of characters, for eg, [0-9] matches 0, 1, 2,
  119.           3 ... 9.
  120.  
  121. The file type is a valid RISC OS file type, for example, "Text" "fff",
  122. "&fff" etc.
  123.  
  124. Addition extension specific options may also be given by including the
  125. option after the file type.
  126.  
  127.  
  128. Options:
  129.  
  130.   nocase    Treat upper and lower case alike in matching
  131.  
  132.   keepext    Keep extensions as file/ext1/ext2 etc
  133.  
  134.   noext        Remove all extensions
  135.  
  136.   revext    Reverse extensions so that dir/file.a.b becomes
  137.         dir.b.a.file
  138.  
  139.   rev1ext    Reverse 1st extension only, so that app/file.c.gz
  140.         becomes app.c.file/gz
  141.  
  142.   nopath    Strip path prefix for remote name so.
  143.  
  144.   in <dir>      Places file in directory <dir>. Unless <dir> is a full
  145.                 path name, <dir> is assumed to be a sub-directory of the
  146.                 specified root directory.
  147.  
  148.   type <type>   Set the default type to be applied in the absence of any
  149.                 other information.
  150.  
  151.   nfsext        Enables the handling of Acorn NFS style ,xxx hex extensions.
  152.  
  153.  
  154. Any option prefixed with "!" is switched off rather than on.
  155.  
  156. When a type is matched, the corresponding extension is allways removed.
  157.  
  158.  
  159. An Example File
  160.  
  161.  
  162. # Set the location of the downloads directory.
  163.  
  164. $root <FTP$Dir>
  165.  
  166.  
  167. # Set default options as follows:
  168. # case-insensitive matching, handling of NFS extensions, keep
  169. # extensions as file/ext/ext unless told not to,
  170. # place unmatched file in "<FTP$Dir>.Misc"
  171. # set their type to Text (&fff)
  172.  
  173. $default nocase nfsext keepext in Misc type &fff
  174.  
  175.  
  176. # These option are applied to the following type matches until
  177. # another options lines is encountered. These options are applied in
  178. # addition to those given on the defaults line above.
  179. #
  180. # Ensure directory elements in original remote path name are stripped.
  181. # Ensure extensions are stripped, leaving just the filename.
  182. # Place matched files in directory "<FTP$Dir>.Docs"
  183. $ nopath noext in Docs
  184. .txt         &fff
  185. .doc         &fff
  186. .asc         &fff
  187. .ps          &ff5
  188.  
  189.  
  190. # A new set of options to be applied. This completely replaces those
  191. # given in the previous options line, and is applied to the following
  192. # match lines.
  193. #
  194. # Basically as above, but put files in "<FTP$Dir>.Archives"
  195.  
  196. $ nopath noext in Archives
  197. .arc         &ddc
  198. .archive     &ddc
  199. .spark       &ddc
  200. .spk         &ddc
  201. .tar.gz      &ddc
  202. .tar.z       &ddc
  203. .tar         &ddc
  204. .gz          &ddc
  205. .z           &ddc
  206. .zip         &ddc
  207.  
  208.  
  209. # A new set of options for Image files
  210. # The files end of in "<FTP$Dir>.Archives"
  211.  
  212. $ nopath noext in Images
  213. .jpeg|.jpg   &c85
  214. .gif         &695
  215. .tiff|.tif   &ff0
  216.  
  217.  
  218. # A more complicate extensions set for dealing with source file downloads.
  219. #
  220. # this matches .c, .c++, .cpp, .h, .1, .2, .3, .4, .5, .6, .7, .8,
  221. # .s, .y, and .l.
  222. #
  223. # The first extension and file name are swapped round so that you
  224. # get c.*, h.* files.
  225. #
  226. # Also, as these options *replace* previous ones, directory elements in
  227. # the original path name are retained. So applic/source.c becomes
  228. # applic.c.source.
  229.  
  230. $ rev1ext in Source
  231. .c|.cpp|.c++|.h|.[1-8]|.s|.y|.l &fff
  232.  
  233.  
  234. # Any files with "rfc" at the start of the name are placed in
  235. # "<FTP$Dir>.RFCs". Any files with "draft-" at the start of the name are
  236. # placed in "<FTP$Dir>.IENs". Also path elements and extension are
  237. # stripped.
  238. #
  239. # Note, that the following two match lines don't have a "." prefix, so
  240. # they match the name rather than the extension. Also note the use of
  241. # options in the match lines.
  242.  
  243. $ nopath noext
  244. rfc*         &fff in RFCs
  245. draft-*      &fff in IENs
  246.  
  247.  
  248. Hopefully this commented example will now enable you to create you own
  249. additional entries to suite your exact needs.
  250.  
  251.  
  252. Path Command
  253. ------------
  254.  
  255. Syntax: path off | auto | type | <option> [<option>...]
  256.  
  257. "path" on its own tells you what state the path processor is in.
  258. Separate state is maintained for each active FTP client session.
  259.  
  260. "path off"  switches the path processor off, result in the use of the old
  261. path handling.
  262.  
  263. "path auto" switches the path processor on and causes it to use
  264. information given in the "PathEnt" file as described above.
  265.  
  266. "path type" switches the type decoding only on and causes it to use
  267. information given in the "PathEnt" file as described above.
  268.  
  269. "path ros"  causes the path processor to precisely mirror the name
  270. conversions applied by the unix mode in !TCPIP's FTP server. This mode
  271. is most useful when connected to a !TCPIP v2.02 FTP server and want to
  272. use "mget" to transfer complete directory hierarchies intact.
  273.  
  274. "path <option> [<option>...]" presets a set of options independantly of
  275. the PathEnt file to be applied to subsequence "get" operations.
  276.  
  277. The option given are exactly as per a PathEnt file options line, but you
  278. dont need to prefix with the "$" and in fact you must not.
  279.  
  280. Example as used when fetching a the entire contents of a C sourrce
  281. directory:
  282.  
  283. path nocase rev1ext in <FTP$Dir>.Source type Text
  284.  
  285. (See "batch" command for a real in-context example)
  286.  
  287. Notes:
  288.  
  289. The "in <dir>" option has a full name specified as the given directory
  290. in this case is not treated as a subdirectory of a specified root
  291. directory.
  292.  
  293. The path processor, when active, will allways be able to decode RISC OS
  294. filetype name extensions as appended by !TCPIP's FTP server in unix
  295. mode. 
  296.  
  297. However, in order to ensure paths are kept exactly as on the server, use
  298. the "path ros" command.
  299.  
  300.  
  301.  
  302. Batch FTP
  303. ---------
  304.  
  305. * Note to demon users: this is not to be confused with the Batch FTP
  306. service that demon offer. This is something rather different, though the
  307. batch ftp facility as provided by this client can be *very* usefully
  308. used for fetching files from your private batch directory on demon.
  309.  
  310. Batch FTP is a very simple facility to allow an unlimited length list of
  311. any FTP session commands (exept of course the batch command) to be place
  312. in a file which is read with each command being executed upon completion
  313. of the previous one.
  314.  
  315. In !TCPIP v2.0f onwards, dialogue scripts appended to an ftp or terminal
  316. command could be used to partially achieve the effect of batch ftp, but
  317. creating such scripts was rather fiddly for such a common operation.
  318.  
  319. Now that batch ftp is available properly, you can usefully use dialogues
  320. appende to ftp commands to start off a batch operation. (See end for
  321. details.)
  322.  
  323. Synyax: source <filename>
  324.  
  325. Either a full pathname may be given, (for eg, adfs::4.$...) or a
  326. filename may be given. In the case of a filename, various places are
  327. searched when looking for the specified file as follows:
  328.  
  329. !TCPIPUser.Scripts
  330. !TCPIPUser
  331. !TCPIPUser.^
  332. $ on current drive
  333. @ (the cirrect directory)
  334.  
  335. If it cant be found, then obviously an error is given.
  336.  
  337. A batch is simply a file containing a sequence of valid in-session FTP
  338. commands, on per line, exept of course the "batch" command itself. Upon
  339. completion of each command, the next command is read and executed until
  340. the end of the file.
  341.  
  342. You will notice that the commands appear in the FTP session window in
  343. the bold atrribute colour as they are being executed. Also the FTP
  344. prompt changes to "batch> " while a batch file is being processed.
  345.  
  346. A batch file can be aborted in the same manner as a get command, by
  347. entering "abort". This will terminate the tranfer in progress and close
  348. the batch file.
  349.  
  350. An example:
  351.  
  352. # Set required path options
  353. path nocase rev1ext in <FTP$Dir>.Source type Text
  354.  
  355. # Set required remote directory
  356. cd /pub/NetBSD/NetBSD-current/src/gnu
  357.  
  358. # get each file, letting the path processor take care of the
  359. # details.
  360. get tar/Makefile
  361. get tar/Makefile.gnu
  362. get tar/README
  363. get tar/buffer.c
  364. get tar/create.c
  365. get tar/diffarch.c
  366. get tar/extract.c
  367. get tar/fnmatch.c
  368. get tar/fnmatch.h
  369. get tar/getdate.y
  370. get tar/getoldopt.c
  371. get tar/getopt.c
  372. get tar/getopt.h
  373.  
  374.  
  375. To get the best out of batch ftp, it is advisable to get directory
  376. listings of directories of interest from FTP sites of interest using the
  377. "dir . <local file name>" command, and then to edit this listing using
  378. the macro facilities in !Zap to create a list batch file containing the
  379. required path, cd and get commands off-line. Next time you connect, FTP
  380. to the site(s) and enter the batch command.
  381.  
  382. Also is possible to get the FTP session and batch request fully
  383. automated by using a ftp connect dialogue similar to the following:
  384.  
  385. ftp ftp.{domain} \ @DemonFTP YE100 YV24 \ 
  386. "name: " "anonymous\r\n" "assword: " "{ftpuser}@{host}\r\n" 
  387. "ftp> " "bin\r\n" "ftp> " "hash 1\r\n"
  388. "ftp> " "source batchfile\r\n" "ftp> " "quit\r\n"
  389.  
  390. (Line is artificially broken for legibility)
  391.  
  392. and including this command at the end of the auto exec for a completly
  393. un-attended ftp session.
  394.  
  395. Naturally, a number of similar commands can be included for multiple
  396. similtaneous automatated ftp seesions.
  397.  
  398. Note that the "quit" comman is placed in the dialoque rather than the
  399. batch file so that if the batch file fails for any reason, the quit
  400. command will still get executed, allowing the tcp hangup timer to
  401. continue to trigger a shutdown and exit.
  402.  
  403.  
  404. MGET command
  405. ------------
  406.  
  407. This, like "get" is used for retreive files from an FTP server. Unlike
  408. "get", "mget" can be given a short list of wildcarded names that are
  409. each expanded into a file list, with each file in the resulting list
  410. being fetched via "get".
  411.  
  412. Syxtax: mget <listspec> [<listspec>...]
  413.  
  414. Its operation is equivelent to entering ls <listspec> for each
  415. <listspec>, and then doing an "get <file>" for each filename returned,
  416. and in fact this is exactly what it does on your behalf, as you will see
  417. from the information display during an mget operation.
  418.  
  419. For example, to fetch the entire contents of two directories on a server
  420. "dira" and "dirb", you could use "mget dira dirb". To fetch the contents
  421. of current directory, and immediate subdirectories, use "mget *".
  422.  
  423. Another way of using "mget" is to type ls at the "ftp> " prompt, and
  424. then select some files from the resulting listing (upto around 50 or so)
  425. and then apply the preset macro menu "Get file(s)".
  426.  
  427. Before using "mget", it is worth ensuring that suitable path processing
  428. options are setup with the "path" command.
  429.  
  430.  
  431. QUOTE command
  432. -------------
  433.  
  434. This allows a command to be sent directly to an FTP server, bypassing
  435. the normal client pre-processing of commands.
  436.  
  437. Syntax: quote <command> [<local file for listing>]
  438.  
  439. This is most useful for things like server secific variations of "ls"
  440. that are handled like the unix "ls" command, for example:
  441.  
  442. quote "ls -C" listfile
  443.  
  444. sends "ls -C" to the server, and directs output to the local file
  445. "listfile".
  446.  
  447. Note: as the command to be sent to the server will often need to contain
  448. spaces, your will often have to enclose the command in quotes as above.
  449.  
  450. <listfile> should only be specified in situtations where output is
  451. expected via a data connection.
  452.  
  453.  
  454. REGET command
  455. -------------
  456.  
  457. This command allows a get operation to be continued after a previous get
  458. operation that was terminated early for some reason, for eg because your
  459. internet connection was broken.
  460.  
  461. Syntax: reget <remote file> [<local file>]
  462.  
  463.  
  464. WINOPEN and WINCLOSE
  465. --------------------
  466.  
  467. These enable the FTP session windows to be opened and closed.
  468.  
  469. Syntax: winopen
  470.         winclose
  471.  
  472. The main use of this is in FTP command files that may be triggered by an
  473. automated FTP session initiated from another wimp application, in
  474. particular, a FTP fetcher for WWW would use this.
  475.