home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / internet / tcpip204 / TCPIP_Doc / Notes / FTPClient < prev    next >
Encoding:
Text File  |  1995-03-03  |  20.5 KB  |  632 lines

  1. New facilities in FTP Client (v2.04)
  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 the addition of:
  9.  
  10.   A highly configurable path name processor.
  11.   A batch ftp facilty (source command).
  12.   An "mget" command.
  13.   A "reget" command.
  14.   "quote" and "site" commands.
  15.   {ftp_data} and {ftp_list} variables.
  16.  
  17. v2.04 also adds:
  18.   Preset options, set from main command window, or Config file.
  19.   Fully automatic login based on data in an FTP server accounts file.
  20.   Automatic execution of command files.
  21.   Selectable prompt types, showing current directory.
  22.   Selectable information level.
  23.   A new ftp command "aftp" that allow instant logins, and optional
  24.   command file selection.
  25.  
  26.  
  27. Pathname Processor
  28. ~~~~~~~~~~~~~~~~~~
  29. The path handling is the main area of improvement, and now allows UNIX
  30. style paths to be parsed for file type extraction from one or more file
  31. name extensions and is able to work out appropriate processing based
  32. upon the extensions present or elements in the basic file name.
  33.  
  34. On the basis of the file name and/or extensions, the ftp client can now
  35. work out what file type to give the file, which directory to store it in
  36. and whether to keep unconverted extensions, whether to keep directory
  37. elements from the original remote path etc.
  38.  
  39. When there is more than one extension, it is able to sensible use one
  40. extension to determine the file's type and another extension, or the
  41. file's name, to determine in which directory the file should be placed.
  42.  
  43. These conversions are done according to a set of rules given in a new
  44. !TCPIP resource file. (!TCPIPUser.PathEnt).
  45.  
  46. When downloading groups of files, for example, the entired contents of a
  47. directory and subdirectories containing C source files, there are often
  48. files which might end up being placed in a different directory to the
  49. rest as a consequence of name/extension base placing. As this can be
  50. undesirable, it is posible to switch off the fully automatic processing,
  51. and force preset processing according to the type of download your are
  52. doing. This is most useful when using the new batch facility.
  53.  
  54. Finally, just in case there are any problems that I have missed, the old
  55. original path name handling is still available in a rather more useable
  56. and improved form.
  57.  
  58. Whatever path processing options are in use, directories are
  59. automatically created. The lack of this was one of the most annoying
  60. problems with previous versions of the FTP client. Also filenames are no
  61. longer actively truncated, allowing advantage to be taken of such
  62. utilities as !LongFiles. With appropriate Risc OS configuration, overly
  63. long filenames will still be truncated, but by Risc OS rather than the
  64. FTP client.
  65.  
  66.  
  67. PathEnt file
  68. ~~~~~~~~~~~~
  69. The !TCPIPUser.PathEnt consist of a series of either options lines, or
  70. name matching lines. When trying to match a name or extensions, three
  71. types of matching are carried out. These are:
  72.  
  73.   1.  Match the file name to determine where to put the file.
  74.   2.  Match an extension to determine where to put the file.
  75.   3.  Match an extension to determine a file type.
  76.  
  77. The first match in each of the above categories is the one used. How
  78. this effects the layout of the PathEnt file will become clear.
  79.  
  80. Each options line starts with a "$" character and is followed by
  81. required options on the same line, each separated by a space.
  82.  
  83. There are three types of options line as follows:
  84.  
  85. $root <pathname>
  86. "$root <FTP$Dir>"
  87.  
  88. This must be present, once only. The given pathname set the root
  89. directory in which files are to be placed. Normally, this is set to
  90. "<FTP$Dir>" which in turn is set to "!TCPIPUser.Downloads".
  91.  
  92. $default [<option>...]
  93. Example: "$default nocase nfsext truncdir keepext in Misc type &fff"
  94.  
  95. This line must be present, once only. It sets the default path
  96. processing options this are modified by options given later, or applied
  97. directly to any paths that are not otherwise matched.
  98.  
  99. $ [<option>...]
  100. Example: "$ rev1ext in Source"
  101.  
  102. This line contains options that are to be applied to subsequent
  103. extension/filename decoding lines. Any options given are applied in
  104. addition to those given in the default options line.
  105.  
  106. Lines starting with a "#" character, or blank lines are ignored.
  107.  
  108. Lines starting with a "." describe extensions matching. Other lines
  109. describe filename matching.
  110.  
  111. Extension and file name matching lines are as follows:
  112.  
  113. <name>/.<ext>[|<name>/.<ext>...] <file type> [<options>]
  114. Examples: ".c|.cpp|.c++|.h|.[1-8]|.s|.y|.l &fff"
  115.           "rfc* &fff in RFCs"
  116.  
  117. "/" in the above is used to represent "or" in the syntax rather than the
  118. usual "|" as "|" is literally used to separate extensions in a list.
  119. There must be no spaces in the extensions part.
  120.  
  121. The use of wildcards is allowed in the name and extension as follows:
  122.  
  123.   "*"     matches any string of 0 or more characters.
  124.   "?"     matches any single character.
  125.   "[...]" matches a range of characters, for eg, [0-9] matches 0, 1, 2,
  126.           3 ... 9.
  127.  
  128. The file type is a valid RISC OS file type, for example, "Text" "fff",
  129. "&fff" etc.
  130.  
  131. Addition extension specific options may also be given by including the
  132. option after the file type.
  133.  
  134.  
  135. Options:
  136.  
  137.   nocase    Treat upper and lower case alike in matching
  138.  
  139.   keepext    Keep extensions as file/ext1/ext2 etc
  140.  
  141.   noext        Remove all extensions
  142.  
  143.   revext    Reverse extensions so that dir/file.a.b becomes
  144.         dir.b.a.file
  145.  
  146.   rev1ext    Reverse 1st extension only, so that app/file.c.gz
  147.         becomes app.c.file/gz
  148.  
  149.   nopath    Strip path prefix for remote name so.
  150.  
  151.   in <dir>      Places file in directory <dir>. Unless <dir> is a full
  152.                 path name, <dir> is assumed to be a sub-directory of the
  153.                 specified root directory.
  154.  
  155.   type <type>   Set the default type to be applied in the absence of any
  156.                 other information.
  157.  
  158.   nfsext        Enables the handling of Acorn NFS style ,xxx hex extensions.
  159.  
  160.  
  161. Any option prefixed with "!" is switched off rather than on.
  162.  
  163. When a type is matched, the corresponding extension is allways removed.
  164.  
  165.  
  166. An Example File
  167.  
  168.  
  169. # Set the location of the downloads directory.
  170.  
  171. $root <FTP$Dir>
  172.  
  173.  
  174. # Set default options as follows:
  175. # case-insensitive matching, handling of NFS extensions, keep
  176. # extensions as file/ext/ext unless told not to,
  177. # place unmatched file in "<FTP$Dir>.Misc"
  178. # set their type to Text (&fff)
  179.  
  180. $default nocase nfsext keepext in Misc type &fff
  181.  
  182.  
  183. # These option are applied to the following type matches until
  184. # another options lines is encountered. These options are applied in
  185. # addition to those given on the defaults line above.
  186. #
  187. # Ensure directory elements in original remote path name are stripped.
  188. # Ensure extensions are stripped, leaving just the filename.
  189. # Place matched files in directory "<FTP$Dir>.Docs"
  190. $ nopath noext in Docs
  191. .txt         &fff
  192. .doc         &fff
  193. .asc         &fff
  194. .ps          &ff5
  195.  
  196.  
  197. # A new set of options to be applied. This completely replaces those
  198. # given in the previous options line, and is applied to the following
  199. # match lines.
  200. #
  201. # Basically as above, but put files in "<FTP$Dir>.Archives"
  202.  
  203. $ nopath noext in Archives
  204. .arc         &ddc
  205. .archive     &ddc
  206. .spark       &ddc
  207. .spk         &ddc
  208. .tar.gz      &ddc
  209. .tar.z       &ddc
  210. .tar         &ddc
  211. .gz          &ddc
  212. .z           &ddc
  213. .zip         &ddc
  214.  
  215.  
  216. # A new set of options for Image files
  217. # The files end of in "<FTP$Dir>.Archives"
  218.  
  219. $ nopath noext in Images
  220. .jpeg|.jpg   &c85
  221. .gif         &695
  222. .tiff|.tif   &ff0
  223.  
  224.  
  225. # A more complicate extensions set for dealing with source file downloads.
  226. #
  227. # this matches .c, .c++, .cpp, .h, .1, .2, .3, .4, .5, .6, .7, .8,
  228. # .s, .y, and .l.
  229. #
  230. # The first extension and file name are swapped round so that you
  231. # get c.*, h.* files.
  232. #
  233. # Also, as these options *replace* previous ones, directory elements in
  234. # the original path name are retained. So applic/source.c becomes
  235. # applic.c.source.
  236.  
  237. $ rev1ext in Source
  238. .c|.cpp|.c++|.h|.[1-8]|.s|.y|.l &fff
  239.  
  240.  
  241. # Any files with "rfc" at the start of the name are placed in
  242. # "<FTP$Dir>.RFCs". Any files with "draft-" at the start of the name are
  243. # placed in "<FTP$Dir>.IENs". Also path elements and extension are
  244. # stripped.
  245. #
  246. # Note, that the following two match lines don't have a "." prefix, so
  247. # they match the name rather than the extension. Also note the use of
  248. # options in the match lines.
  249.  
  250. $ nopath noext
  251. rfc*         &fff in RFCs
  252. draft-*      &fff in IENs
  253.  
  254.  
  255. Hopefully this commented example will now enable you to create you own
  256. additional entries to suite your exact needs.
  257.  
  258.  
  259. Path Command
  260. ~~~~~~~~~~~~
  261. Syntax: path off | auto | type | <option> [<option>...]
  262.  
  263. "path" on its own tells you what state the path processor is in.
  264. Separate state is maintained for each active FTP client session.
  265.  
  266. "path off"  switches the path processor off, result in the use of the old
  267. path handling.
  268.  
  269. "path auto" switches the path processor on and causes it to use
  270. information given in the "PathEnt" file as described above.
  271.  
  272. "path type" switches the type decoding only on and causes it to use
  273. information given in the "PathEnt" file as described above.
  274.  
  275. "path <option> [<option>...]" presets a set of options independantly of
  276. the PathEnt file to be applied to subsequence "get" operations.
  277.  
  278. The option given are exactly as per a PathEnt file options line, but you
  279. dont need to prefix with the "$" and in fact you must not.
  280.  
  281. Example as used when fetching a the entire contents of a C sourrce
  282. directory:
  283.  
  284. path nocase rev1ext in <FTP$Dir>.Source type Text
  285.  
  286. (See "batch" command for a real in-context example)
  287.  
  288. Notes:
  289.  
  290. The "in <dir>" option has a full name specified as the given directory
  291. in this case is not treated as a subdirectory of a specified root
  292. directory.
  293.  
  294. The path processor, when active, will allways be able to decode RISC OS
  295. filetype name extensions as appended by !TCPIP's FTP server in unix
  296. mode. 
  297.  
  298. However, in order to ensure paths are kept exactly as on the server, use
  299. the "path ros" command.
  300.  
  301.  
  302. SOURCE command
  303. ~~~~~~~~~~~~~~
  304. This causes command to be taken from a pre-prepared file rather than
  305. from user input. Any command that can be entered manually, may be placed
  306. in an FTP command file, except the source command itself.
  307.  
  308. Syntax: source <filename>
  309.  
  310. Various directories are searched for a file matching the name given. In
  311. order these are:
  312.  
  313.   !TCPIPUser.Scripts
  314.   !TCPIPUser
  315.   !TCPIPUser.^
  316.   $ on current drive
  317.   @ (the current directory)
  318.  
  319. If it cant be found, then obviously an error is given.
  320.  
  321. Note: only one command file may be active. The command file may not
  322.       currently conatin another source command.
  323.  
  324.  
  325. MGET command
  326. ~~~~~~~~~~~~
  327. This, like "get" is used for retreive files from an FTP server. Unlike
  328. "get", "mget" can be given a short list of wildcarded names that are
  329. each expanded into a file list, with each file in the resulting list
  330. being fetched via "get".
  331.  
  332. Syxtax: mget <listspec> [<listspec>...]
  333.  
  334. Its operation is equivelent to entering ls <listspec> for each
  335. <listspec>, and then doing an "get <file>" for each filename returned,
  336. and in fact this is exactly what it does on your behalf, as you will see
  337. from the information display during an mget operation.
  338.  
  339. For example, to fetch the entire contents of two directories on a server
  340. "dira" and "dirb", you could use "mget dira dirb". To fetch the contents
  341. of current directory, and immediate subdirectories, use "mget *".
  342.  
  343. Another way of using "mget" is to type ls at the "ftp> " prompt, and
  344. then select some files from the resulting listing (upto around 50 or so)
  345. and then apply the preset macro menu "Get file(s)".
  346.  
  347. Before using "mget", it is worth ensuring that suitable path processing
  348. options are setup with the "path" command.
  349.  
  350.  
  351. SITE command
  352. ~~~~~~~~~~~~
  353. This command allows a the normal FTP client command interpreter to be
  354. bypassed, ensuring that an entered command is passed directly to the FTP
  355. server for execution.
  356.  
  357. Syntax: site <command>
  358.  
  359.  
  360.  
  361. QUOTE command
  362. ~~~~~~~~~~~~~
  363.  
  364. This allows a command to be sent directly to an FTP server, bypassing
  365. the normal client pre-processing of commands, just like the site
  366. command. The difference between quote and site is that quote sets up the
  367. FTP data channel, and so must be used when the underlying command is
  368. expected to return data via the data channel.
  369.  
  370. Syntax: quote <command> [<local file for listing>]
  371.  
  372. Note: as the command to be sent to the server will often need to contain
  373. spaces, you will often have to enclose the command in quotes as above.
  374.  
  375. <listfile> should only be specified in situtations where output is
  376. expected via a data connection.
  377.  
  378.  
  379. REGET command
  380. ~~~~~~~~~~~~~
  381. This command allows a get operation to be continued after a previous get
  382. operation that was terminated early for some reason, for eg because your
  383. internet connection was broken.
  384.  
  385. Syntax: reget <remote file> [<local file>]
  386.  
  387.  
  388. WINOPEN and WINCLOSE
  389. ~~~~~~~~~~~~~~~~~~~~
  390. These open and close the FTP session windows.
  391.  
  392. Syntax: winopen
  393.         winclose
  394.  
  395. The main use of this is in FTP command files that may be triggered by an
  396. automated FTP session initiated from another wimp application, in
  397. particular, a FTP fetcher for WWW would use this.
  398.  
  399. When a session window is close, and the quit command is executed, the
  400. window will be silently discarded after the session closes without
  401. further user intervention.
  402.  
  403. Normally, upon completion of an FTP session, the user is required to
  404. close the window manually.
  405.  
  406.  
  407. TRACE command
  408. ~~~~~~~~~~~~~
  409. This command switches on full display of server replies. Normally, since
  410. v2.04, most replies are filtered so that you only see those that might
  411. be of interest. Setting the trace level to 1 ensures that you see the
  412. full information returned from the server.
  413.  
  414. Syntax trace [<level>]
  415.  
  416.   Level = 0 strips command codes so you only see the informatiom content
  417.           of relevent returned messages, and dont see any messages during
  418.           data channel usage.
  419.  
  420.   Level = 1 causes all reply messages to be displayed in full.
  421.  
  422.   trace on its own displays the current setting.
  423.  
  424.  
  425. PROMPT command
  426. ~~~~~~~~~~~~~~
  427. With version 2.04, you can one of three differnt type of prompt,
  428. standard, short directory and long directory.
  429.  
  430. Syntax: prompt [nodir|short|long]
  431.  
  432.   nodir selects the standard "ftp> " prompt to be used.
  433.   short selects the leaf name of the current directory path to be used.
  434.   long  selects the full directory path. If the full directory path is
  435.         longer than 16 characters, as it often is, then it is diplayed
  436.         on a line on its own, followed by "> " on the next line.
  437.  
  438.  
  439.  
  440. Other New Features
  441. ------------------
  442.  
  443. It is now possible to present some option for the ftp client with
  444. command that may be placed in the main Config file, or entered at the
  445. "net>" prompt in the main command window. These options allow selection
  446. of terminal window size, default pathname processing, default trace
  447. level, default prompt type, default transfer progress indication (hash)
  448. and default tranfer mode.
  449.  
  450.  
  451. FTPOPT command
  452. ~~~~~~~~~~~~~~
  453. Preset various FTP options.
  454.  
  455.   Syntax ftpopt <option> <values>
  456.  
  457.  
  458. Set Default Path Processing
  459.  
  460.   Syntax: ftpopt path <path options)
  461.  
  462.   This sets the default path processing options for each new FTP session.
  463.   For a description of path options and the path command, see "FTPClient".
  464.    
  465.  
  466. Set Default Window Size
  467.  
  468.   Syntax: ftpopt winsize [<n1>] [<n2>] [<n3>] [<n4>]
  469.    
  470.   If no parameters are given, then the current size is shown.
  471.  
  472.   When one or more of <n1> to <n4> is given, they are interpreted as
  473.   follows:
  474.    
  475.     <n1>                  n1 is terminal height in rows.
  476.  
  477.     <n1> <n2>             n1 is terminal width in rows
  478.                           n2 is terminal height in columns
  479.  
  480.     <n1> <n2> <n3>        n1 is terminal width in rows
  481.                           n2 is terminal height in columns
  482.                           n3 is window height in rows
  483.  
  484.     <n1> <n2> <n3> <n4>   n1 is terminal width in rows
  485.                           n2 is terminal height in columns
  486.                           n3 is window width in columns
  487.                           n4 is window height in rows
  488.  
  489.    "terminal" in the above refers the total window work area, "window"
  490.    just refers to the visible part of the window.
  491.  
  492.  
  493. Set Default Prompt
  494.  
  495.   Syntax: ftpopt prompt nodir|short|long.
  496.   
  497.   Values, exactly as per FTP prompt command.
  498.   
  499.  
  500. Set Default Progress Indicator
  501.  
  502.   Syntax: ftpopt hash 0|1|<lump size>
  503.   
  504.   Values, exactly as per FTP hash command.
  505.  
  506.     0 is no indication.
  507.     1 exact byte count.
  508.     >1 a "#" is displayed for every n bytes, where n is the value
  509.     specified. Suitable values of n are 512, 1024 (1Kbyte), 2048 etc.
  510.   
  511.  
  512. Set Default Trace Level
  513.  
  514.   Syntax: ftpopt trace <level>
  515.   
  516.   Levels exactly as per FTP trace command.
  517.   
  518.   
  519. Set Default Tranfer Mode
  520.  
  521.   Syntax: ftpopt type image|binary|ascii
  522.   
  523.   image and binary are the same. This is the mode that you should use
  524.   for all file transfers unless you are sure that the file content is
  525.   text, even then, it is worth using binary mode as it is optimsed for
  526.   low overhead, and so is faster than ascii mode.
  527.   
  528.   ascii mode cause end of line characters to be matches for the local
  529.   system. ie CRs are stripped for files.
  530.   
  531.  
  532.  
  533. AFTP and Accounts file format
  534. -----------------------------
  535.  
  536. AFTP
  537. ~~~~
  538. "aftp" is a new alternative command to ftp <site name>. The current ftp
  539. command accept a collection of terminal switches, that with the new
  540. preset, are not really needed. Also the new command file facility in FTP
  541. means that dialogues are not really needed, though are still useful.
  542.  
  543. "aftp" is much simpler for everyday use, and the effect of many auto-login
  544. dialogues appended to the ftp command can be very much more simply be
  545. acheived using aftp and a suitably setup ftp accounts file. While very
  546. much simpler, it is actually rather more useful, as it exploits the
  547. newly added facilties.
  548.  
  549.   Syntax: aftp <hostname>|<alias> [<command file>]
  550.   
  551. <hostname> is of course a normal internet hostname, or IP address.
  552. <alias> is the name of an entry in the FTP accounts file. This file is
  553. searched for a matching record that contains the full hostname of the
  554. host, the login name, password, name of menu to attach to the session
  555. window, an optional command file to execute and the name of the
  556. directory you want to be in.
  557.  
  558. Distinguishing between hostnames and aliases is very simple. An alias
  559. has entry in the accounts file, a hostname does not, instead, it gets
  560. its login information from a "default" entry in the accounts file.
  561.  
  562. This means that if the name entered is not found, then the default
  563. record controls the login.
  564.  
  565. <command file> is the name of an optional command file you wish to have
  566. executed upon login. If a command file is specified in the accounts file
  567. for this alias, the file name given in the aftp command is executed
  568. after the preset command file.
  569.  
  570.  
  571. Accounts File
  572. ~~~~~~~~~~~~~
  573. This file is found in !TCPIPUser.FTP, and has a very simply record
  574. structure as follows:
  575.  
  576. <alias>:
  577.   host <hostname>
  578.   login <username>
  579.   password <password>
  580.   menu <menu file>
  581.   directory <directory name>
  582.   source <command file name>
  583.   
  584. <alias>:
  585.   ...
  586.  
  587. The start of a record is identified by a line with text and NO preceding
  588. spaces, followed by a colon. Fields within each record have a field name
  589. and field value. Fields must have at least one preceding space or tab
  590. character.
  591.  
  592. Valid fields are:
  593.  
  594.   host <hostname>
  595.     <hostname> is the full nameof an internet host, for eg
  596.     "ftp.demon.co.uk". You may put an IP address here if you wish.
  597.     
  598.   login <username>
  599.     <username> is just that, your user name, for example "anonymous".
  600.     
  601.   password <password>
  602.     This is the login password, for example, for anonymous ftp, you would
  603.     use your email address. Note, that you may use !TCPIP internal
  604.     variables in thif file, so variabe such as {ftpuser} and {host} that
  605.     have been setup for macro menus may also be used here. For anonymous
  606.     login passwords, I use the entry {ftpuser}@{host}.
  607.     
  608.   menu <file name>
  609.     This is the name of a macro menu file. !TCPIP expect to find this
  610.     file in !TCPIPUser.Menus.
  611.  
  612.   directory <directory name>
  613.     This is the name of the directory you want to be placed in, as would
  614.     be entered with a "cd" command to that specific host.
  615.     
  616.   source <command file.
  617.     This is the name of a preset command file. This useful for actions
  618.     that you will allways want to have done everytime time you connect
  619.     to this host.
  620.     
  621. You can alse set of a record with the name "default:". Values specified
  622. in this record are applied when the hostname given in the "aftp" command
  623. does not match any given in the file. You should not include a "host"
  624. field in this record as it will obviously prevent you accessing the host
  625. specified in the aftp command.
  626.  
  627. Any field may be ommitted. In particular, you may wish to omit the
  628. password field for reasons of security. If no user name or password is
  629. given, then you will be prompted for these when they are required as
  630. normal.
  631.  
  632.