home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1995-07-26 | 49.8 KB | 1,189 lines
NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) NNNNAAAAMMMMEEEE NcFTP - Internet file transfer program SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS nnnnccccffffttttpppp [_p_r_o_g_r_a_m _o_p_t_i_o_n_s] [[_o_p_e_n _o_p_t_i_o_n_s] _h_o_s_t_n_a_m_e[::::_p_a_t_h_n_a_m_e]] DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN _N_c_F_T_P is a user interface to the Internet standard _F_i_l_e _T_r_a_n_s_f_e_r _P_r_o_t_o_c_o_l. This program allows a user to transfer files to and from a remote network site, and offers additional features that are not found in the standard interface, _f_t_p. FFFFEEEEAAAATTTTUUUURRRREEEESSSS Program options will be explained later in this document. Let's get down to business and go over the features that make this program worthwhile. Here is the list of section headers; I have my $MANPAGER environment variable set to use ``lllleeeessssssss ----iiii'' so that I can skip to the section I want (otherwise, ////_r_e_g_e_x commands to the pager won't match the section headers because of the formatting codes; the ``----iiii'' can search through the formatting codes) Establishing the remote connection Format of the RC file The Recent-sites file Redialing a busy remote site Supplying a sitename from your shell's command line Using Colon-mode Using FTP-cat and FTP-more mode Supplying a port number with the open command Displaying and changing program variables Program variables Listing a remote directory Viewing a remote directory with your pager Redisplaying the last directory listing Fetching files from the remote host Viewing a remote file with your pager Creating a message file on the remote host Looking up site names and addresses Checking the configuration of the program Using the command shell Customizing the prompt Keeping a log of your file transfers Program options A sample RC file EEEEssssttttaaaabbbblllliiiisssshhhhiiiinnnngggg tttthhhheeee rrrreeeemmmmooootttteeee ccccoooonnnnnnnneeeeccccttttiiiioooonnnn Just opening a connection to a remote server was inconvenient enough in the stock _f_t_p program to justify Page 1 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) writing this program. Here at _N_C_E_M_R_S_o_f_t, we want to do our business as quickly and painlessly as possible. We'd rather save time and wear and tear on our metacarpals than bother typing entire site names, usernames, and email addresses masquerading as passwords, and setting binary mode. We made all connections anonymous by default, and we automatically send our email address for the password on those connections. We allowed for site names to be abbreviated. For each commonly accessed site, you can put an entry in your program preferences file (let's call it the ``ncftprc file'' or ``RC file'' for short). To open the site, from the command shell all you do is type: open wuarchive.wustl.edu or o wuarchive.wustl.edu As promised, you can abbreviate that further. Just use any abbreviation that would match only the site you had in mind. For the previous example, you could try: o wuarc o wustl o stl o wu Any of those abbreviations would open wuarchive.wustl.edu anonymously, sending your anon-password (usually set to your email address) as the password. Keep in mind that the program tries opening the first site that matches the abbreviation you supplied. So: o w might match a site named bowser.nintendo.jp if that site appeared before your entry for wuarchive.wustl.edu. Most of the time we open remote sites anonymously, but there are times where you need to specifically open a site with an actual username and password. Let's say my partner, Phil Dietz, wants to FTP something out of my account. Perhaps he wants to fetch the latest version of the source code to _N_c_F_T_P so he can optimize something or add a new feature behind my back. Since the program opens remote sites anonymously by default (actually, you can change this behavior; more on that later), he would have to specify a flag to the _o_p_e_n command so he can supply my username and Page 2 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) password. He would try: o -u sphygmomanometer.unl.edu or, more likely: o -u sph Then the program would prompt him for a username (login, whatever) and a password: Login Name (pdietz): mgleason Password: ******** If he got it right, he could raid my stuff. If not, he'd probably drop me an email asking me to quit changing my password so often. There are even times where you want to FTP from your own account, like if you are debugging an FTP client you wrote. At this prompt: Login Name (mgleason): I could just hit return to tell the program that I want ``mgleason'' as my username, then I would enter my password. FFFFoooorrrrmmmmaaaatttt ooooffff tttthhhheeee RRRRCCCC ffffiiiilllleeee This release of the program is somewhat compatible with the stock _f_t_p program's ....nnnneeeettttrrrrcccc file. However, I can promise you that in the near future the program will use a new format, so don't invest too much time in it. The RC file can be named ``nnnnccccffffttttpppprrrrcccc'', ``nnnneeeettttrrrrcccc'', or ``....nnnnccccffffttttpppprrrrcccc'', but it is usually named ``....nnnneeeettttrrrrcccc'' so it can be used with the stock _f_t_p program. _N_c_F_T_P looks in the current working directory for any of those files, and then in your home directory, and after that it gives up (which is OK, because RC files aren't mandatory). The file usually starts with #_s_e_t and #_u_n_s_e_t commands that do things to the programs variables. The reason for the ``#'' is so the stock _f_t_p program will think they are comments. You might have this appearing as the first few lines in your RC file (I'll explain later): #set debug 1 #set pager "less -EMi" #unset startup-msg After those, you put in machine entries for each of your favorite sites. Let's put in an entry for Page 3 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) wuarchive.wustl.edu. First you would put: machine wuarchive.wustl.edu Then you could put in your username, password, and account if you like: user anonymous password -mgleason@cse.unl.edu account wuarc.does.not.use.accounts Following that, you would add the startup macro that is run each time you connect to wuarchive. You must start it with this line: macdef init Then put in the commands you want to do: cd /graphics/gif ls -lt After that, you end the macro with a blank line (important!). The finished machine entry would look like the following. To make the transition to the impending new format less painful, I recommend you adhere to this format: machine wuarchive.wustl.edu user anonymous password -mgleason@cse.unl.edu account wuarc.does.not.use.accounts macdef init cd /graphics/gif ls -lt (_m_a_n_d_a_t_o_r_y _b_l_a_n_k _l_i_n_e _t_o _e_n_d _t_h_e _m_a_c_r_o) Of course, if all you want to do is open wuarchive anonymously, you needn't bother with the ``user'', ``password'', and ``account'' lines. You may want to put them in if you plan on using the stock _f_t_p program, though. Try something like this: machine wuarchive.wustl.edu macdef init cd /graphics/gif ls -lt (_m_a_n_d_a_t_o_r_y _b_l_a_n_k _l_i_n_e _t_o _e_n_d _t_h_e _m_a_c_r_o) You can tell the program to not run the startup macro if you supply ----iiii to the _o_p_e_n command. Really, you should only bother adding entries for sites that Page 4 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) you want to run startup macros upon connection. The next section explains why. TTTThhhheeee RRRReeeecccceeeennnntttt----ssssiiiitttteeeessss ffffiiiilllleeee Each time you open a site, the program saves the name of the site and the last directory you were in to the _r_e_c_e_n_t-_s_i_t_e_s _f_i_l_e which is named ....nnnnccccrrrreeeecccceeeennnntttt and placed in your home directory. The program saves a predetermined number of these sites in the file, and when it reaches the limit, it discards the oldest entry so it can add a new one. You can just go ahead and use the name of the site you want with the _o_p_e_n command if you know it is in the _r_e_c_e_n_t-_f_i_l_e (and you can abbreviate the name, just like those in the RC file). But if you cannot remember what the name of the site you want, all you do is run the _o_p_e_n command with no site parameter: open This will pop up a list of the sites in the _r_e_c_e_n_t-_f_i_l_e, and sites in your RC file. At the open prompt, just type the name (or an abbreviation of that name) or the number preceding the site name to open that site. After opening the site you wanted, the program sets the remote working directory to the same one you left in the last time you called. If you don't like the idea of having the sites you called stored on disk, you can turn this feature off using an _u_n_s_e_t command, explained later. RRRReeeeddddiiiiaaaalllliiiinnnngggg aaaa bbbbuuuussssyyyy rrrreeeemmmmooootttteeee ssssiiiitttteeee Some remote sites limit the number of leeches, er, anonymous connections at a time to reduce the load on the host computer. You can use the _o_p_e_n command's redial feature to keep attempting connections until you get on, although that is not a very polite thing to do. The simplest way to do this would be to just supply the ----rrrr option: open -r wuarc There are also options you can use to tweak redial. The ----dddd flag sets the delay between dials, and the ----gggg flag sets a limit on how many dials should be attempting before giving up. If you don't supply ----gggg the program will dial a day and forever (which my Number Theory professor, Dr. Mientka, says is longer than forever and a day) until it connects successfully, or until you get sick of waiting and hit the interrupt key (usually ^C). This example dials wuarchive every ten minutes, giving up Page 5 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) after twenty attempts. Note that the redial delay is specified in seconds: open -r -d 600 -g 20 wuarc Please be considerate when you use redialing, so you won't tax the network. Site administrators can and do get angry when they get flooded with connections. SSSSuuuuppppppppllllyyyyiiiinnnngggg aaaa ssssiiiitttteeeennnnaaaammmmeeee ffffrrrroooommmm yyyyoooouuuurrrr sssshhhheeeellllllll''''ssss ccccoooommmmmmmmaaaannnndddd lllliiiinnnneeee When you run the program: ncftp by itself does nothing and waits for you to type commands to the program's own shell. Just like the stock _f_t_p program, you can supply a site name on the command line: ncftp wuarchive.wustl.edu You can also use abbreviations as usual: ncftp wuarc This is equivalent to running the program, then issuing an _o_p_e_n command to open wuarchive. UUUUssssiiiinnnngggg CCCCoooolllloooonnnn----mmmmooooddddeeee The _o_p_e_n command is not a one-trick pony. Another option is what I call _c_o_l_o_n-_m_o_d_e. This feature is used (most of the time) from your shell's command line. In ancient times, way back during the Disco era, you could use a program called _t_f_t_p to fetch a file using the Internet standard _T_r_i_v_i_a_l _F_i_l_e _T_r_a_n_s_f_e_r _P_r_o_t_o_c_o_l. You could use that program to do something like this from within its shell: get wuarchive.wustl.edu:/graphics/gif/README and that would call wuarchive and fetch the RRRREEEEAAAADDDDMMMMEEEE file. You can use this program to do the same thing from your shell's command line: csh> ncftp wuarchive.wustl.edu:/graphics/gif/README csh> head README This tells your shell, in this case the ``c-shell'' to run _N_c_F_T_P, which would open wuarchive, fetch ////ggggrrrraaaapppphhhhiiiiccccssss////ggggiiiiffff////RRRREEEEAAAADDDDMMMMEEEE and write the file ....////RRRREEEEAAAADDDDMMMMEEEE in the current working directory, and then exits. This is nice if you don't want to browse around the remote site, and you Page 6 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) know exactly want you want. It would also come in handy in shell scripts, where you don't want to enter the command shell, and might not want the program to spew output. You can use _c_o_l_o_n-_m_o_d_e to set the starting remote working directory also: csh> ncftp wuarchive.wustl.edu:/graphics/gif This would run the program, open wuarchive, and _c_d to the gif directory, then run the program's command shell so you can browse. _C_o_l_o_n-_m_o_d_e is also available from within the program's command shell. At a prompt you can do stuff like this: ncftp> open wuarchive.wustl.edu:/graphics/gif/README ncftp> o wuarc:/graphics/gif UUUUssssiiiinnnngggg FFFFTTTTPPPP----ccccaaaatttt aaaannnndddd FFFFTTTTPPPP----mmmmoooorrrreeee mmmmooooddddeeee There are times where you might not want the program to write a _c_o_l_o_n-_m_o_d_e file in the current working directory, or perhaps you want to pipe the output of a remote file into something else. _C_o_l_o_n-_m_o_d_e has options to do this. It was inspired by the guy who wrote the _f_t_p_c_a_t perl script. The ----cccc option tells the program to write on the standard output stream. The ----mmmm option pipes the file into your pager (like _m_o_r_e) Of course this won't work if the thing you give _c_o_l_o_n-_m_o_d_e is a directory! This example just dumps a remote file to stdout: csh> ncftp -c wuarc:/graphics/gif/README ... csh> This example redirects a remote file into a different location: csh> ncftp -c wu:/README > ~pdietz/thesis.tex This one shows how to use a pipeline: csh> ncftp -c wuarc:/README | tail | wc -l 10 csh> This shows how to page a remote file: csh> ncftp -m wuarc:/graphics/gif/README ... csh> Page 7 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) SSSSuuuuppppppppllllyyyyiiiinnnngggg aaaa ppppoooorrrrtttt nnnnuuuummmmbbbbeeeerrrr wwwwiiiitttthhhh tttthhhheeee ooooppppeeeennnn ccccoooommmmmmmmaaaannnndddd This option just didn't fit anywhere else, so to finish out the open command, ----pppp lets you supply a port number if you have to _f_t_p to a site using an nonstandard port number. Personally, I have yet to use this feature, but it is there for compatibility with the stock _f_t_p program. DDDDiiiissssppppllllaaaayyyyiiiinnnngggg aaaannnndddd cccchhhhaaaannnnggggiiiinnnngggg pppprrrrooooggggrrrraaaammmm vvvvaaaarrrriiiiaaaabbbblllleeeessss Now I'll explain the commands unique to _N_c_F_T_P. The others should perform the same as they would in the stock _f_t_p program; consult the man page for it if you want those explained, or use the _h_e_l_p command for a brief blurb. The _s_h_o_w command is used to display program variables and their values. show all or show would display all the variables with their values. show _v_a_r_1 _v_a_r_2 ... _v_a_r_N would display each specified variable and its value. The _s_e_t command changes the value of a program variable. Its syntax is: set _v_a_r_n_a_m_e _v_a_l_u_e For Boolean or Integer variables, set _v_a_r_n_a_m_e would set the value of the variable _v_a_r_n_a_m_e to 1111 (ttttrrrruuuueeee). The _u_n_s_e_t command can be used to set the variable to its default value, or for Boolean and Integer variables, set the value of the variable to 0000 (ffffaaaallllsssseeee). For String variables, you can use this to set the value to an empty string. You can use any of those three commands in both the command shell, or in the RC file with a ``#'' prepended. PPPPrrrrooooggggrrrraaaammmm vvvvaaaarrrriiiiaaaabbbblllleeeessss Each variable can be one of the following types: Boolean: Can be ``oooonnnn'' or ``ooooffffffff'' (you can also use ``1111'' or Page 8 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) ``0000''). Integer: Can be any positive or negative number, or 0000. String: Is a string of characters. If the string needs to have a space in it, make sure you surround the whole string with double quotes in a _s_e_t command. Variables follow. Some variables are explained later in the relevant sections. _a_n_o_n-_o_p_e_n (Boolean) Tells whether the default login mode is anonymous if on, or if off, will prompt for a username/password. You can always override this by using either ----aaaa or ----uuuu with the _o_p_e_n command. _a_n_o_n-_p_a_s_s_w_o_r_d (String) Sends this as the password when you login anonymously. By default this is your email address. _a_n_s_i-_e_s_c_a_p_e_s (Boolean) If on, the program can use boldface, underline, and inverse text. _a_u_t_o-_b_i_n_a_r_y (Boolean) If on, sets the transfer type to binary mode immediately after connection. _d_e_b_u_g (Integer) Sets the debugging level. _g_a_t_e_w_a_y-_l_o_g_i_n (String) Tells which username to use when logging in to your firewall gateway host. _g_a_t_e_w_a_y-_h_o_s_t (String) The site which is acting as your firewall gateway, or empty if you aren't using one. _l_o_c_a_l-_d_i_r (String) The current local working directory. I like to set this from my RC file, so all my files go into my download directory. _l_o_g_f_i_l_e (String) The name of your personal transfer log, or empty if you aren't using a transfer log. _l_o_g_s_i_z_e (Integer) Page 9 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) The maximum ceiling of your log file, before the program removes old entries. _m_p_r_o_m_p_t (Boolean) If on, prompts for each remote file expanded from a wildcard globbing expression. _n_e_t_r_c (String, Read-only) Tells you the name of the RC file in use. _p_a_g_e_r (String) The pathname and flags of the program used to display output one screenful at a time. The default is the value of your $PAGER environment variable. _p_r_o_m_p_t (String) The prompt specification that expands into the prompt. _p_r_o_g_r_e_s_s-_r_e_p_o_r_t_s (Integer) Which progress meter to use, or 0000 if you don't want progress reports during file transfers. Set it to 1111 for a simple percentage meter; 2222 for a fancy bar graph indicator; 3333 to print just the number of kilobytes transferred; or 4444 to print one dot for each 10% transferred, if you want to avoid the use of backspaces. Note that the program may use a different meter depending on how cooperative the remote host is, and what you have the _a_n_s_i-_e_s_c_a_p_e_s variable set to. _r_e_c_e_n_t-_l_i_s_t (Boolean) If on, uses and updates the _r_e_c_e_n_t-_f_i_l_e. _r_e_m_o_t_e-_i_s-_u_n_i_x (Boolean) Set automatically by the program upon connection, you may need to use this in a startup macro if the program guessed that a remote site was UNIX when it really is not. _s_t_a_r_t_u_p-_m_s_g (Boolean) If on, prints the opening message and tip. _t_i_p_s (Boolean) If on, prints a tip on how to use the program better each time you run the program. _t_y_p_e (String) The name of the file transfer mode in use, such as ``bbbbiiiinnnnaaaarrrryyyy'' or ``aaaasssscccciiiiiiii''. _v_e_r_b_o_s_e (String/Integer) Controls the amount of output spewed by the program. You can supply either the first character of the name Page 10 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) of the verbosity level, or its number: _Quiet (-1) Won't print any output at all, even if an error occurs. _Errors Only (0) No output, except when errors occur. _Terse (1) Prints errors, and useful output from the remote host. _Verbose (2) Prints everything, even junk output from the remote end. LLLLiiiissssttttiiiinnnngggg aaaa rrrreeeemmmmooootttteeee ddddiiiirrrreeeeccccttttoooorrrryyyy The _l_s and _d_i_r commands perform in a similar manner to those of the stock _f_t_p program. The _l_s command sends the FTP command ``NLST'' for you. This command has been set so that it defaults to always listing files in columns (this is the ----CCCC option given to the UNIX _l_s command) and appending metacharacters to each item name (this is the ----FFFF option), so you can see which items are directories, files, links, etcetera. If you don't want your items columnized, you can try using the ----1111 option with _l_s to print one item per line. The _d_i_r command sends the FTP command ``LIST'' for you, which instead of printing just item names, it prints item sizes, owners, dates, and permissions as well. This command is equivalent to ``llllssss ----llll'' on most remote systems. The usage for both commands is the same. Here is the one for _l_s: llllssss [-_f_l_a_g_s] [_d_i_r_e_c_t_o_r_y _a_n_d _f_i_l_e _n_a_m_e_s] [_r_e_d_i_r_e_c_t_i_o_n] Note that in this program, you can supply both flags and items to list in the same command. The stock version of _f_t_p doesn't let you do this: ls -lrt /info-mac/help Another thing that the program does which the others should have done is let you supply more than one item: ls -lrt /info-mac/help /pub /info-mac/README You can also redirect the output into a file, or pipe it Page 11 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) into something. This example shows how to list the contents of the current remote directory, and save the output into a file in the current local directory: ls -t >ls.out Note that for this to work, there must be no whitespace between the ``>'' and the filename, unlike your shell command line which allows for extra whitespace. This will be (actually, is) fixed in a future version of the program. These examples show how to use a pipe: ls -t |tail dir -t "|less -CM" ls -t "|tail | wc" Like the redirection example, there must be no whitespace between the first pipe character and the rest of the stuff. The trick is that it has to appear as one argument to the commands. The second and third examples illustrate the use of double quotes to squeeze extra parameters in. The second example can be done without all that typing. See the descriptions of the _p_d_i_r and _p_l_s commands below. VVVViiiieeeewwwwiiiinnnngggg aaaa rrrreeeemmmmooootttteeee ddddiiiirrrreeeeccccttttoooorrrryyyy wwwwiiiitttthhhh yyyyoooouuuurrrr ppppaaaaggggeeeerrrr Didn't you hate it when you listed a remote directory, only to have most of the stuff scrolled off your terminal before you could read it? The _p_l_s and _p_d_i_r commands take care of this for you. As you might have guessed, they perform exactly like their regular counterparts, only you view them with your pager. The pager to use is controlled by the _p_a_g_e_r program variable. RRRReeeeddddiiiissssppppllllaaaayyyyiiiinnnngggg tttthhhheeee llllaaaasssstttt ddddiiiirrrreeeeccccttttoooorrrryyyy lllliiiissssttttiiiinnnngggg The program saves the listing into a local buffer, so if you need to see it again (probably forgot about _p_d_i_r) you can use the _r_e_d_i_r and _p_r_e_d_i_r commands for this. FFFFeeeettttcccchhhhiiiinnnngggg ffffiiiilllleeeessss ffffrrrroooommmm tttthhhheeee rrrreeeemmmmooootttteeee hhhhoooosssstttt The _g_e_t and _m_g_e_t retrieve remote files for you. The usage for _g_e_t is: get remote-file [local-file or redirection] To fetch ////ppppuuuubbbb////RRRREEEEAAAADDDDMMMMEEEE and write it as a file named ....////jjjjuuuunnnnkkkk////rrrreeeeaaaaddddmmmmeeee, try: get /pub/README ./junk/readme To fetch ////ppppuuuubbbb////RRRREEEEAAAADDDDMMMMEEEE and write it as ....////RRRREEEEAAAADDDDMMMMEEEE, just do: Page 12 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) get /pub/README This lets you fetch a file using its whole pathname, and write a copy of it in the current directory, without having to bother with typing a local filename. In the unlikely event that you have write permission to a directory called ////ppppuuuubbbb on your local machine, it would write ``RRRREEEEAAAADDDDMMMMEEEE'' in that directory. Most of the time the file you want will be in the current remote directory, so you can just do these: get README get README ./junk/readme You can also use a redirection for _g_e_t, just like you can with the _l_s, _d_i_r, and _r_e_d_i_r commands. As described earlier, you have to conform to the format below for this release of the program: get README >/dev/null get README |head get README "|head -8" get README "|less -EMi" The last example is facilitated by the _p_a_g_e command described later. The _g_e_t command can also use a wildcard expression in an attempt to match exactly one remote file. I call it ``Poor Man's File Completion.'' If you've done a remote listing, and you decide you want to download a file by the name of ``oooobbbbnnnnooooxxxxiiiioooouuuussssllllyyyylllloooonnnnggggppppaaaacccckkkkaaaaggggeeeennnnaaaammmmeeee....ttttaaaarrrr....ZZZZ'', you can use ``PMFC'' to save some keystrokes. Choose an expression that will only match that one file, then use it with _g_e_t: get obn*.Z a.tar.Z If your pattern was unique, _g_e_t will fetch that file only. If the pattern matched more than one file, the program will bitch and moan. The _m_g_e_t command is used to fetch many files at a time. The difference between _g_e_t and _m_g_e_t is that _g_e_t lets you write only one file, but you can put it in a different directory, while _m_g_e_t fetches many files, always writing them in the current local directory. This example fetches several remote files at once: mget a.file.Z b.file.Z c.tar d.tar.Z The _m_g_e_t command, and its ugly sisters, _m_p_u_t and _m_d_e_l_e_t_e let Page 13 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) you use wildcard expressions. I could have done the previous example as: mget *.Z c.tar instead. The ``m'' commands will verify each file, if you have the program variable _m_p_r_o_m_p_t set. VVVViiiieeeewwwwiiiinnnngggg aaaa rrrreeeemmmmooootttteeee ffffiiiilllleeee wwwwiiiitttthhhh yyyyoooouuuurrrr ppppaaaaggggeeeerrrr If you would like to read a file on the remote host without saving a copy of it on your machine, you can use the _p_a_g_e (or _m_o_r_e if you wish) command: page README page obn*README page README.Z The second example show that you can use ``PMFC'' like you can for _g_e_t. The third example will work also, because if the program knows how to decompress the file, it will do so before feeding it to your pager. As stated earlier, you can change the program to use to page by setting the program variable _p_a_g_e_r. CCCCrrrreeeeaaaattttiiiinnnngggg aaaa mmmmeeeessssssssaaaaggggeeee ffffiiiilllleeee oooonnnn tttthhhheeee rrrreeeemmmmooootttteeee hhhhoooosssstttt Use the _c_r_e_a_t_e an empty file on the remote site. Sometimes it is necessary to leave a note if you can't get in touch with the remote site's administrator. For example if a file is corrupted, you could try: create Foo.tar_is_corrupt in hopes that the original uploader will replace it. LLLLooooooookkkkiiiinnnngggg uuuupppp ssssiiiitttteeee nnnnaaaammmmeeeessss aaaannnndddd aaaaddddddddrrrreeeesssssssseeeessss You can use the program's builtin mini-_n_s_l_o_o_k_u_p facility. If you wanted to know the site's IP number, but only knew the name you could do: lookup cse.unl.edu This would spit out IP number for that site, in this case ``129.93.1.12''. If you needed to know what a site's name was, but only knew the IP number, try: lookup 129.93.1.12 This would spit out the name for that site, in this case ``cse.unl.edu''. CCCChhhheeeecccckkkkiiiinnnngggg tttthhhheeee ccccoooonnnnffffiiiigggguuuurrrraaaattttiiiioooonnnn ooooffff tttthhhheeee pppprrrrooooggggrrrraaaammmm Use the _v_e_r_s_i_o_n command to print version and compilation Page 14 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) information about the program. This will also tell you which optional features are compiled into the program, such as logging to the system log and which command line editor (if any) has been installed. The author's email address is listed, and if you need to report something, send the output of this command along with your message. UUUUssssiiiinnnngggg tttthhhheeee ccccoooommmmmmmmaaaannnndddd sssshhhheeeellllllll Just like the stock _f_t_p program, you type commands to it until you get bored and hit either ^D or type the _q_u_i_t command. The program supports links to popular command line editing libraries. If the person who compiled it went to the effort, you will be able to edit the command line with arrow keys and other editing commands, and also scroll up and down in the command line history, usually with the up and down arrows. You can check the _v_e_r_s_i_o_n command to see if either ``GETLINE'' or ``READLINE'' are installed. CCCCuuuussssttttoooommmmiiiizzzziiiinnnngggg tttthhhheeee pppprrrroooommmmpppptttt You can set the shell's prompt string to whatever you like. You can use several metacharacters that expand into something each prompt. The ``%%%%'' flags are passed to _s_t_r_f_t_i_m_e(3), so you can put the date or time in the prompt formatted as you like it: set prompt "%I:%M ncftp>" That would insert the current time in the prompt. The ``@@@@'' flags are expanded by the program itself. Here's the list of them. If you have an ANSI-compatible terminal, or you have the program variable _a_n_s_i-_e_s_c_a_p_e_s set, you can use @@@@BBBB, @@@@IIII, and @@@@UUUU to turn on boldface, inverse, and underline text respectively (otherwise they won't insert anything). You can also use @@@@RRRR to turn on inverse (reverse) text. @@@@PPPP sets the text back to plain text. @@@@DDDD Inserts the full path of the current remote directory. The @@@@JJJJ flag is similar except it inserts only the directory name. @@@@HHHH Inserts the name of the remote host. @@@@CCCC inserts the host and current directory path in _c_o_l_o_n-_m_o_d_e format, such as ``cse.unl.edu:/pub/mgleason'', or ``(not connected)''. The @@@@cccc flag is similar, only it will insert ``cse.unl.edu:/pub/mgleason'' and a newline if connected, Page 15 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) otherwise it prints nothing. The default prompt uses this flag to print a two line prompt when connected and a one line prompt when not connected. @@@@EEEE or @@@@!!!! inserts the event number (how many commands you've typed). @@@@MMMM inserts ``(Mail) '' if mail has arrived since running the program. @@@@NNNN inserts a newline character. KKKKeeeeeeeeppppiiiinnnngggg aaaa lllloooogggg ooooffff yyyyoooouuuurrrr ffffiiiilllleeee ttttrrrraaaannnnssssffffeeeerrrrssss You can have the program keep a personal log file. I find it is useful so I can see where I got a certain file, or what the name of that site was I called two weeks ago. To use a log, add: #set logfile ~/.ftplog (or whatever you want to name the log) to your RC file. I don't want my log growing too large and using up all my disk space, so I also have: #set logsize 10240 in my RC file. If you set the limit on the maximum log size, the program will keep the log file at or below that size, discarding old entries. Note that this is different from having SYSLOG appear in the _v_e_r_s_i_o_n command's output. When this is on, your actions are recorded to the system log, so your system administrator can make sure you aren't doing anything ``bad.'' PPPPrrrrooooggggrrrraaaammmm ooooppppttttiiiioooonnnnssss Remember that you can treat the command line like an _o_p_e_n command, so all lowercase options are passed to the _o_p_e_n command, and the uppercase options are handled by the main program. The uppercase options are described below; refer to the _o_p_e_n command for descriptions of its options. ----DDDD _x sets the debugging level to _x. ----HHHH runs the _v_e_r_s_i_o_n command and exits, so you can save the output of it to use when you need to mail me something. ----IIII toggles the mprompt variable; this is provided for compatibility with ``ffffttttpppp ----iiii''. ----NNNN disables reading of the RC file; this is provided for Page 16 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) compatibility with ``ffffttttpppp ----nnnn''. ----VVVV _x sets verbosity to level _x (----1111, 0000, 1111, 2222) or (qqqquuuuiiiieeeetttt, eeeerrrrrrrrssss, tttteeeerrrrsssseeee, vvvveeeerrrrbbbboooosssseeee). See the description of the _v_e_r_b_o_s_e program variable for more information. Here are some example command lines. Again, see the description of the _o_p_e_n command (especially _c_o_l_o_n-_m_o_d_e and _F_T_P-_c_a_t _m_o_d_e) and all its functions for more information. This just enters the _N_c_F_T_P command shell: csh> ncftp This fetches CCCCOOOONNNNTTTTEEEENNNNTTTTSSSS and then quits: csh> ncftp cse.unl.edu:/pub/mgleason/CONTENTS Some others examples, with open options and main program options mixed in: csh> ncftp -V quiet -u ftp.unl.edu csh> ncftp -c cse.unl.edu:/pub/mgleason/CONTENTS csh> ncftp -D 2 -r -d 120 -g 10 -N ftp.unl.edu AAAA ssssaaaammmmpppplllleeee RRRRCCCC ffffiiiilllleeee Here is a sample RC file: #set logfile ~/.ftplog #set progress-reports 2 #set local-dir /usr/tmp/zz #set prompt "@B@E @UNcFTP@P @B@M@D@P ->" machine sumex-aim.stanford.edu macdef init cd /info-mac get ./help/recent-files.txt "|grep -v '.abs' > sumex" !less sumex pwd # This site is in here just so I can use ``apple'' # as an abbreviation. machine ftp.apple.com # NcFTP will only ask for your password: machine cse.unl.edu login mgleason # You can supply a login and a password: machine fake.machine.unl.edu login mgleason password mypass Page 17 (printed 6/30/95) NNNNccccFFFFTTTTPPPP((((1111)))) NNNNCCCCEEEEMMMMRRRRSSSSoooofffftttt NNNNccccFFFFTTTTPPPP((((1111)))) macdef init cd ./foo/bar # If an antiquated non-UNIX machine doesn't use # the "SYST" command, you may need to unset # remote-is-unix, if the remote host complains # about ``ls -CF''. machine some.vms.unl.edu macdef init unset remote-is-unix AAAAUUUUTTTTHHHHOOOORRRRSSSS _N_c_F_T_P was written by Mike Gleason, _N_C_E_M_R_S_o_f_t (mgleason@cse.unl.edu), and based on code by the authors of the _f_t_p from the BSD 4.3 distribution. _N_c_F_T_P is copyrighted 1992, 1993 by NCEMRSoft and 1985, 1989 by the Regents of California. Ideas and some code contributed by Phil Dietz, _N_C_E_M_R_S_o_f_t (pdietz@cse.unl.edu). Testing and debugging done by Phil and Kok Hon Yin (hkok@cse.unl.edu). Extensive man page formatting work by DaviD W. Sanderson (dws@ssec.wisc.edu). BBBBUUUUGGGGSSSS Correct execution of many commands depends upon proper behavior by the remote server. The remote server may drop the connection if you take a long time to page remote files. Termcap padding is not correctly displayed. There are no such sites named _b_o_w_s_e_r._n_i_n_t_e_n_d_o._j_p or _s_p_h_y_g_m_o_m_a_n_o_m_e_t_e_r._u_n_l._e_d_u. SSSSEEEEEEEE AAAALLLLSSSSOOOO _s_t_r_f_t_i_m_e(3), _f_t_p_d(8), _f_t_p(1), _n_s_l_o_o_k_u_p(1), _c_o_m_p_r_e_s_s(1), _g_z_i_p(1), _z_c_a_t(1), _f_s_p(1), _a_r_c_h_i_e(1), _t_f_t_p(1). Page 18 (printed 6/30/95)