Merlin ANSITAPE(1) NNNNAAAAMMMMEEEE ansitape - ANSI-standard magtape label program SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS _a_n_s_i_t_a_p_e txrc[vqfaei3] [mt=_d_e_v_i_c_e] [vo=_v_o_l_u_m_e-_n_a_m_e] [rs=[ r | _r_e_c_o_r_d_s_i_z_e ]] [bs=_b_l_o_c_k_s_i_z_e] [rf=[ v | f ]] [cc=[ i | f | e ]] _f_i_l_e_n_a_m_e_1 _f_i_l_e_n_a_m_e_2 . . . DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN _A_n_s_i_t_a_p_e reads, writes, and creates magtapes conforming to the ANSI standard for magtape labelling. Primarily, this is useful to exchange tapes with VAX/VMS, which makes this kind of tape by default. _A_n_s_i_t_a_p_e is controlled by a function key letter ((((tttt,,,, xxxx,,,, cccc,,,, oooorrrr rrrr)))). Various options modify the format of the output tape. WWWWrrrriiiittttiiiinnnngggg AAAANNNNSSSSIIII TTTTaaaappppeeeessss The list of files on the command line is written to the tape. A full Unix pathname may be specified, however, only the last pathname component (everything after the last /) is used as the filename on the tape. Normally, regular text files are to be exchanged. _a_n_s_i_t_a_p_e reads the files one line at a time and transfers them to the tape. The newline character at the end of each line is removed, and the file is written in a variable-length record format. Variable-format files have the length of the longest record specified in a file header. Therefore, _a_n_s_i_t_a_p_e will read each input file from disk before it goes on to tape, to determine the maximum record size. The read is skipped if the file is more than 100,000 bytes long. The default car- riage control (implied) instructs the other host to restore the newline character before printing the record. If _a_n_s_i_t_a_p_e thinks that the input file is a Unix text file (Fortran or implied carriage control), it will automatically strip the the Unix newline from the end of each record. No strip is done with embedded carriage control files, or with any file using a fixed-length record format. For binary files, fixed-length records should be used. VAX/VMS normally uses a record length of 512 bytes for things like directories and executable files, but data files may have any record length. Binary files should be flagged for embedded (_r_f=_e) carriage control. RRRReeeeaaaaddddiiiinnnngggg AAAANNNNSSSSIIII TTTTaaaappppeeeessss When reading, the input file list is presumed to be the names of files to be extracted from the tape. The shell AICenter Last change: 23 June 1986 1 Merlin ANSITAPE(1) wildcard characters asterisk (*) and question-mark (?) may be used. Of course, they must be quoted to prevent the shell from interpreting them before _a_n_s_i_t_a_p_e sees them. None of the options for record format or carriage control need be specified when reading files. _A_n_s_i_t_a_p_e will automatically pick up this information from the header records on the tape, and do the right thing. If you can't get just what you want from _a_n_s_i_t_a_p_e, the resulting files may be run through _d_d(_1). FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN LLLLEEEETTTTTTTTEEEERRRRSSSS These function letters describe the overall operation desired. One of them must be specified in the first argu- ment to _a_n_s_i_t_a_p_e. For lexically rigorous Unix fans, a minus sign (-) is allowed, but optional, to introduce the first keyword option set. _r Write the named files on the end of the tape. This requires that the tape have been previously initial- ized with an ANSI volume header. _c Create a new magtape. The tape is initialized with a new ANSI volume header. All files previously on the tape are destroyed. This option implies _r. _x Extract all files from the tape. Files are placed in the current directory. Protection is r/w to everyone, modified by the current _u_m_a_s_k(_2). _t List all of the names on the tape. MMMMOOOODDDDIIIIFFFFIIIIEEEERRRR KKKKEEEEYYYY LLLLEEEETTTTTTTTEEEERRRRSSSS These key letters are part of the first argument to _a_n_s_i_- _t_a_p_e. _v Normally _a_n_s_i_t_a_p_e does its work silently; the _v (ver- bose) option displays the name of each file _a_n_s_i_t_a_p_e treats, preceded by the function letter. It also displays the volume name of each tape as it is mounted. When used with the _t option, _a_n_s_i_t_a_p_e displays the number of tape blocks used by each file, the record format, and the carriage control option. _q Query before writing anything. On write (c or r options), this causes _a_n_s_i_t_a_p_e to ask before writing to the tape. On extract operations, _a_n_s_i_t_a_p_e displays the Unix pathname, and asks if it should extract the file. Any response starting with a 'y' or 'Y' means yes, any other response (including an empty line) AICenter Last change: 23 June 1986 2 Merlin ANSITAPE(1) means no. _f File I/O is done to standard i/o instead. For exam- ple, when writing a tape file that is to contain a lint listing, we could specify lint xyz.c | ansitape rf xyz.lint instead of lint xyz.c > /tmp/xyz.lint ansitape r /tmp/xyz.lint rm /tmp/xyz.lint When reading, this option causes the extracted files to be sent to stdout instead of a disk file. _a The tape should be read or written with the ASCII character set. This is the default. _e The tape should be written with the EBCDIC character set. The mapping is the same one used by the _d_d(_1) program with _c_o_n_v=_e_b_c_d_i_c. This option is automati- cally enabled if IBM-format labels are selected. _i Use IBM-format tape labels. The IBM format is very similar, but not identical, to the ANSI standard. The major difference is that the tape will contain no HDR3 or HDR4 records, thus restricting the name of the files on the tape to 17 characters. This option automatically selects the EBCDIC character set for output. To make an IBM-format label on a tape using the ASCII character set (why?), use the option sequence _i_a. _3 Do not write HDR3 or HDR4 labels. The HDR3 label is reserved for the use of the operating system that created the file. HDR4 is for overflow of filenames that are longer than the 17 characters allocated in the HDR1 label. Not all systems process these labels correctly, or even ignore them correctly. This switch suppresses the HDR3 and HDR4 labels when the tape is to be transfered to a system that would choke on them. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN MMMMOOOODDDDIIIIFFFFIIIIEEEERRRRSSSS Each of these options should be given as a separate argument to _a_n_s_i_t_a_p_e. Multiple options may be specified. They must appear as after the key-letter options above, and before any filename arguments. _m_t=device Select an alternate drive on which the tape is AICenter Last change: 23 June 1986 3 Merlin ANSITAPE(1) mounted. The default is /_d_e_v/_r_m_t_8. _v_o=volume-name Specify the name of the output volume. Normally, this defaults to the first six characters of your login name. The string 'UNIX' is used as the default if _a_n_s_i_t_a_p_e cannot determine your login name. _r_s=recordsize Specify the output recordsize in bytes. This is the maximum size in the case of variable-format files. This option also turns on the fixed-record-format option. Thus, if you want to have variable record sizes with a smaller maximum, you must specify _r_s=recordsize _r_f=_v When the recordsize is manually given, _a_n_s_i_t_a_p_e does not read disk files to determine the maximum record length. _r_s=_r This is a variant of the _r_s= option. This causes _a_n_s_i_t_a_p_e to read all disk files for recordsize, regardless of their size. Normally, files larger than 100K bytes are not scanned for recordsize. Using this option also implies variable-length records. _b_s=blocksize Specify the output blocksize, in bytes. As many records as will fit are crammed into each physical tape block. ANSI standards limit this to 2048 bytes (the default), but you may specify more or less. Be advised that specifying more may prevent some systems from reading the tape. _r_f=_v Record format is variable-length. In other words, they are text files. This is the default, and should be left alone unless you really know what you're doing. _r_f=_f Record format is fixed-length. This is usually a bad choice, and should be reserved for binary files. This also turns off the newline strip usually done for Unix text files. _c_c=_i Carriage control implied (default). Unlike Unix text files, where records are delimited by a newline char- acter, ANSI files do not normally include the newline as part of the record. Instead, a newline is automat- ically added to the record whenever it is sent to a printing device. AICenter Last change: 23 June 1986 4 Merlin ANSITAPE(1) _c_c=_f Carriage control Fortran. Each line is expected to start with a Fortran carriage-control character. _A_n_s_i_t_a_p_e does not insert these characters automati- cally, it merely marks the file as having them. This is of limited usefulness. (Good opportunity for another ambitious hacker.) _c_c=_e Carriage control is embedded. Carriage control char- acters (if any) are a part of the data records. This is usually used in the case of binary data files. /dev/rmt? half-inch magnetic tape interface /dev/rar? quarter-inch magnetic tape interface /dev/rst? SCSI tape interface SSSSEEEEEEEE AAAALLLLSSSSOOOO dd(1), umask(2), mtio(4), tp(5) AAAAUUUUTTTTHHHHOOOORRRR David S. Hayes, Site Manager, US Army Artificial Intelli- gence Center. Originally developed June 1986. Revised August 1986. This software is in the public domain. BBBBUUUUGGGGSSSS The _r (write) option cannot be used with quarter-inch archive tapes, since these tape drives cannot backspace. There is no way to ask for the _n-th occurrence of a file. Tape errors are handled ungracefully. Files with names longer than 80 characters have the name truncated. This is a limitation of the ANSI labelling stan- dard. If the tape is made without HDR3 and HDR4 labels (_3 or _i switch), the name is limited to 17 characters. Multi-volume tape sets cannot yet be generated. _a_n_s_i_t_a_p_e will read them just fine, but it won't write them. Unix provides no device-independent way to detect a physical end-of-tape. It was decided that a 2400-foot limitation was preferrable to device-dependence. Note to Systems Programmers: _a_n_s_i_t_a_p_e uses a boolean function (_e_o_t) to determine when the tape drive has hit the end of file. It is called every time a block of data is written to the tape. If this function ever returns TRUE (a defined constant), an automatic volume switch occurs. The pertinent device registers are obtained by a MTIOCGET ioctl system call. The registers are described in /_s_y_s/_s_u_n_d_e_v/_t_m_r_e_g._h (Sun system with TapeMaster con- troller). If you have a VAX, the filename will be AICenter Last change: 23 June 1986 5 Merlin ANSITAPE(1) slightly different. Sun Microsystems supplies this file even with binary-only distributions. AICenter Last change: 23 June 1986 6