Input and Output Files

NFT Output (Log) Files

Using LOG and CLOG

NFT allows you to begin at any time recording in a log file all your input to and output messages from the program as it runs. To start a log file, use the NFT command

log pathname

where pathname is usually just the name of a file (e.g., nftlog) that you want NFT to create in the current working directory (where NFT was started) on the machine where you are running the NFT client. If you supply an absolute path name (such as ~/projects/nftlog or /usr/tmp/testdir5/log5) then NFT creates the log file in the other directory that you specify.

Logging of all NFT input and output continues until you issue the CLOG (close log) command or until you QUIT your current NFT session, whichever comes first.

Issuing a second LOG command with a different path name will: (1) create a second, independent log file, (2) stop recording messages in the first log file, and (3) start recording (subsequent) messages in the second log file.

Issuing a second LOG command with the same path name will insert an updated time stamp (comment) in the open log file and then simply append all new messages to the old ones. If a file named pathname already exists when you first issue a LOG command, NFT opens it, appends a current time stamp, and places all your new messages at the end of that file. Thus, you can jump between multiple log files during an NFT session, channeling messages to one and then another, just by using LOG with each file's name whenever you want to change files.

NFT Logging Techniques and Examples

NFT does not collect a large buffer of messages before logging them; instead, messages are flushed to the log file after every carriage return. Logging starts immediately, and the first line recorded in your log file (after a comment-line date stamp) will be the LOG pathname command that requested the file. CLOG will be the last line recorded. As long as you do not change the (default) TERM mode setting with a NOTERM command, all your input and output will continue to display at your terminal while logging occurs.

Every line in an NFT log file is annotated by a prefix that indicates its origin (for easy analysis later). These log-file prefixes are:


indicates a comment (usually the date-time stamp at the start).


indicates input from you at the terminal, for example,

usr) get test3


indicates input from a command file that you had NFT process by issuing the SOURCE command. For example,

src) get test3

came from a command file, not the keyboard.


indicates output from NFT, such as a prompt or response to a command. For example,

) 48.0 95 bytes received in 1.8 seconds (0.1 Kbyte/s) test3

would be a typical logged response to the GET command shown above.

A sample of a short but typical NFT log file looks like this:

# NFT log --- Fri Dec 19 13:42:49 2006
usr) log nftlog2
)    nft>
usr) cd atlas:/usr/tmp
)    remote host atlas: wd is /usr/tmp
)    nft>
usr) cp :t1 atlas:t2
)    1.0. 95 bytes received in 0.1 seconds
)    (0.7 Kbytes/s) from /g/g0/jfk/t1 to /usr/tmp/t2
)    1 entry copied /g/g0/jfk/t1
)    nft>
usr) get t6
)    2.0. 95 bytes received in 1.8 seconds
)    (0.1 Kbytes/s) from ~/t6 to /g/g0/jfk/t6
)    1 entry copied from ~/t6
)    nft>
usr) clog

NFT Input Files

File Input by Redirection

NFT accepts input from a command file on its execute line if you use the standard UNIX input redirection symbol (<), as shown here:

nft < commandfile

Here commandfile can be a simple name of a file in the current directory (e.g., infile3), a path name relative to that directory (such as projects/infile3), or an absolute path name (e.g., /usr/tmp/projects/infile3).

The command file should contain just the same NFT commands (and arguments) that you might type at your terminal, one per line. Running NFT with a redirected input file alters its usual interactive behavior. NFT executes the commands in the file silently, without echoing them. After all commands have started, NFT automatically ends and you get the usual operating-system prompt. It passes status messages ("remote wd is xxx") to your terminal at once, but any job-numbered transaction messages (about files sent or received) that happen to arrive after the NFT client ends are lost (this could be all of them).

Superficially similar to file input by redirection on NFT's execute line is placing a quoted string of (semicolon-delimited) commands on NFT's execute line, as shown here:

nft "clobber;time;pwd;put test4"

This actually behaves more like file input using SOURCE (next section); however, the quoted commands are not echoed, but the normal status and job-numbered transaction messages are echoed, and afterward NFT does not end but simply prompts for more input (unless the last quoted command is QUIT).

File Input Using SOURCE

NFT also accepts input from a command file during any interactive session if you use the SOURCE command in response to its nft> prompt:

source commandfile

With SOURCE, as with file redirection, commandfile can be an absolute path name such as /usr/tmp/projects/ infile3, as well as a relative path name or a local file's name. And again (as with file redirection) with SOURCE, status messages continue to appear at your terminal while the commands in the file execute, but you will see no command echoes and only those job-numbered transaction reports (about files sent or received) that happen to arrive before your NFT client ends (and it could end quickly if the last command in your file is QUIT).

Usually the commands in a SOURCE command file are just what you might type at your terminal, one per line. But you can construct condensed and annotated command files by using # as a comment sentinel, semicolon as a command separator, and backslash (\) as a line-continuation flag. Thus, the following two examples are equivalent command files for use with SOURCE.

put test4
get test6

#shows special characters
clobber;put test4;get tes\

Logging Jointly with Input Files

You can log NFT output with the LOG and CLOG commands while also providing input from a command file, but the captured results will be different than if you log a normal terminal session.

If, while logging NFT output, you use SOURCE to issue commands from a file, both the SOURCEd commands and the system's status messages will be included in the log file, even though the commands would never appear at your terminal. Each is prefixed by src) in the log, but job-numbered transaction reports will only appear in the log file if they would have arrived at the terminal while your NFT client was still running (so often they are missing).

If you use input redirection on the NFT execute line, you can include LOG and CLOG among the commands in the input file to record what happens. However, while your input commands (e.g., PUT test3) and status messages will appear in the log file, only those job-numbered transaction reports that happen to arrive before your client ends are captured in the log. If the redirected command file also contains a SOURCE command within it (to include yet another command file), then each SOURCEd input line will appear prefixed by src) in the log file.