uucp — Format of UUCP working files

Description

UUCP uses three kinds of working files when handling UUCP requests, command, data, and execute.

All three files are stored in a subdirectory for each specific site, named after the site's name. For example, because the UUCP spool directory is /usr/spool/uucp, then the directory /usr/spool/uucp/south is used for all the command, data, and execute files associated with the remote site south.

Command Files

Command files are created by the mail routing agents uucp and uux. On UUCP sites, command files have names such as C.targetA28B9, where target is the name of the destination site, A is the job grade (as set by the –g option to uucp, and 28B9 is the sequence number or job identification number. (You can use the –j option on uucp and uux, as well as uustat to find the job identification number.)

In a command file, each line records one file transfer request. The fields are defined as follows:
type
The type field can be one of the following:
R
Receive a file from remote to local site.
S
Send a file from local to remote site.
source
The name of the source file.
destination
The name of the file after the transfer completes, whether to the remote site (S request) or the local site (R request).

Special characters such as the tilde (~) are still present, because they are expanded on the destination site.

sender
The login name of the user who issued the command. This is normally your login name, though some programs (such as mail programs) use a different login name for their requests.
options
The command options, which correspond to options of the uucp and uux commands.
C
Use the data file name as the source for the copy; this can only be used with the S request.
c
Use the source file name as the source for the copy.
d
Create intermediate target directories as required. This is the default.
m
Send mail to the user when the transfer is complete.
n
Send mail to the user specified by the notification name when the transfer is complete.
datafile
The temporary file to be used if the source file was copied into the spool directory; it is only used with the S request. If C is one of the options, the data file is the name of the copy in the destination site's data spool directory. Otherwise, the placeholder name D.0 is used.
file mode
The UNIX-style permission mode of the source file. It is only used with the S request. All files sent have mode 0666, plus whatever execute permissions the original file had. (For an explanation of the modes, see chmod.)
notification
The login name of the person to be notified after the job request completes. It is used only with the S request if n is one of the options.

Examples

  1. The command
    uucp –m /memos.001 /memos.002 south!~/
    copies the files /memos.001 and /memos.002 root directory to the public UUCP directory on south. Assuming your user name is eve, a command file containing these lines is created in the UUCP spool directory /usr/spool/uucp/south:
    S /memos.001 ~/memos.001 eve –mcd D.0 0777
    S /memos.002 ~/memos.002 eve –mcd D.0 0777
  2. The command
    uucp south!~/index ~/
    generates a command file on your site in the UUCP spool directory /usr/spool/uucp/south containing this line:
    R ~ /index ~/index eve –cd

Data files

Data files contain data to be transferred to the remote site. They are created by uucp if the –C option is used, and by uux and mail programs.

On UUCP sites, data files have names like D.source9B73001, where source is the name of the site that the data file originated from (the local site for an S request, or the remote site for an R request), 98B3 is the sequence number, and 001 is the subsequence number, used when a request generates more than one data file.

Data files created by uucp contain files to be copied. Data files created by uux which contain commands for the remote site become execute files at their destination.

Mail sites typically create two data files, one containing the message and the other containing the command to run the mail routing agent on the remote site.

Examples

UUCP data files contain data to be copied. The contents of uux data files and commands that generate remote commands are execute files intended for other sites. For example, a mail message to north generates two data files in the UUCP spool directory /usr/spool/uucp/north
D.north000A001
X.northX000A002
These working files are created:

D.north000A001   Text of mail message
X.northX000A002  Execute file

The execute file contains the uux request for the mail routing program to be run on north.

Execute files

Execute files are data files containing commands that are created on other sites and copied to your site. The files are treated as execute files when they arrive at your site, where the commands are run by uuxqt.

On UUCP sites, execute files are named as:
X.remotX28A3003
where remot is the first five characters of the destination site's name, X is the job grade (execute files always have the grade X), and 28A3 is the sequence number.
Each execute file contains one command, and the necessary information to run the command. The type of information on each line is identified by the first character in the line. Not all lines are used in all files, and not all UUCP implementations support all of these lines. The first line in an execute file must be a U line, and the last line must be a C line.
#
Indicates a comment. Comments and unrecognized commands are ignored.
C command
Requests that command be run. command is a string that includes the program and arguments. This line must be present and must be the last line in the execute file.
E
Processes the command with execve(). If the E line is present, uuxqt runs a fork()/ecec() sequence, unless the command contains a shell metacharacter. In that case, uuxqt invokes a shell to run the command.
e
Processes the command by the POSIX shell. It is intended to handle commands that require special processing. If the e line is present, uuxqt invokes the defined shell to run the command.
F filename [ xqtname ]
Names filename, a file required for the command to be run. This is usually a file that is transferred from the site that uux was executed from, but it can also be a file from the local site or some other site. If filename is not from the local site, then it is usually a file in the spool directory. Multiple F lines are allowed. Any file other than the standard input file requires the xqtname argument and is copied to the execution directory as xqtname. If the standard input file is not from the local site, it appears in both an F command and an I command.
I stdin
Names the file that supplies standard input to the command. If the standard input file is not from the site running the command, the file is also in an F command. If there is no standard input file, behavior depends on the site implementation. uuxqt rejects the command; some UNIX implementations use /dev/null as the standard input. Only one I line can be present in an execute file; the corresponding F line must precede the file.
N
No mail message should be sent, even if the command failed.
n
Requests a mail message be sent if the command succeeded. Normally a message is sent only if the command failed.
O stdout [ site ]
Names the standard output file. The optional second argument names the site to which the file should be sent. If there is no second argument, the file should be created on the executing site. Only one O line can be present in an execute file; the corresponding F line must precede the O line.
U user site
Names the user who requested the command and the site that the request came from. This line must be present and must be the first line in the execute file.
Z
Specifies that a mail message should be sent if the command failed. This is the default for uuxqt.

Not all these commands may be implemented at your site. For a list of the commands not supported by uuxqt, see uuxqt.

Although most execute files are generated on other sites, complex uux commands that retrieve files from multiple sites can generate execute commands in the local spool directory, where local is the name of your site.

Examples

The following is an example of an execute file to run rmail on the site south. The data file containing the mail message is D.south49Z3. This is an execute file that might be created by the mailx command:
U eve north
F D.south49Z3
I D.south49Z3
C rmail bob

This command originated with user eve on north. It requests that rmail be run with the argument bob on the target site. The file D.south49Z3 is required to run the command and is used as standard input for the command.

Portability

X/Open Portability Guide.

Related information

uucico, uucp, uux, uuxqt