NEWFILE(1) manual page Name
newfile - perform file-creation tasks for printer scriptsSynopsis
/usr/etc/appletalk/newfile [ -d ] [ -n ] [ -o ] [ -s size ] [ -f name ] [ -p ptr ] [ -r ] [ -x sfx ] [ -e env | dir ]
/usr/etc/appletalk/newfile -b file
/usr/etc/appletalk/newfile -a fileDescription
The newfile program creates a new file with the prefix name (default: out) in the directory dir, but waits until there is enough available free disk space in the directory. The folder dir can either be supplied on the command line or through the environment variable env supplied via the -e option. By default, the actual file created will have the pathname dir /name ###sfx , where ### is an optional unique three-digit decimal number; i.e. newfile will not overwrite an existing file (see the -o option below). There is no default sfx. Without a suffix, and if there are no periods in the filename, a period will be inserted before the three-digit number. If a suffix is supplied and the -r option is also supplied, any existing suffix (starting with the same first character as sfx ) in name will be deleted. The final complete pathname will be written on standard output.If the -d argument is given, newfile restricts the last component of the pathname to DOS limitations (all upper case, 8.3 characters). The ptr argument specifies a print queue the file is being made for, and newfile reads a number of options from the printcap(5) entry for the queue (see below).
Newfile waits until the filesystem containing dir has at least size bytes (default: 524288) available space. The directory dir will also be checked for the file minfree, which can contain a number of Kilobytes of additional freespace that newfile will wait for before creating the new file. If newfile has to wait to create a new file, it will report the delay to the AppleTalk log, /usr/adm/appletalk/at_log. It will also report delays, as well as success to an existing status file in the current directory. It will not create the status file.
If the -n argument is given, newfile will not actually create the file, will not attempt to check for freespace, and will not write any status messages. It will simply generate a filename based on all the parameters and write the result to standart output. In this mode, it is not necessary to supply a dir.
The -o argument forces newfile to overwrite files, just like the ``ov'' printcap key below.
The newfile program performs two additional tasks: with the -b option, it will print the size of file in bytes. With the -a option, it will print the age of file in seconds past its modification time.
The following table shows the items from ptr's printcap(5) entry that affect filename generation:
Key Type What it controls CR string If present, sets the ``Creator'' AppleShare attribute of a created file to the first 4 characters of the string. dn boolean Equivalent to the -d option ds boolean Equivalent to the -r option fd string With the -n flag, this string is a directory pathname that newfile will chdir (2) to before checking filenames ov boolean When creating a file, this option causes an existing file with the same name to be overwritten. sx string Sets the sfx string (can be overridden with -x option) TY string If present, sets the ``Type'' AppleShare attribute of a created file to the first 4 characters of the string. xn boolean Causes the unique number (in HEX) to be inserted into the filename regardless of whether it's needed.
Diagnostics
Newfile exits with status 1 when it cannot read a file, or if command-line options have the wrong syntax. It exits with status 2 if it cannot create the requested new file.
Files
- current_working_directory /status
- printer status is written here, if it exists
- /var/adm/appletalk/at_log
- delays waiting for free space are reported here.