BSC(1) USER COMMANDS BSC(1) NAME bsc - Encode a file in the BinSCII format for transmittion to an Apple II SYNOPSIS bsc [-t type] [-a auxtype] [-m dnbiwr] [-n name] [-s num] [-o outfile] [-h] filename DESCRIPTION Bsc encodes a file in the BinSCII format, which is an ASCII-only format similar to uuencode(1), and which is suit- able for transmittion through text-only communication chan- nels such as electronic mail and brain-dead terminal servers. The BinSCII format originated on the Apple II fam- ily of microcomputers (hence the references to the Apple II ProDOS operating system below), and can be decoded by the BINSCII program on an Apple II (there is also a BinSCII decoder for UNIX called sciibin). Options -t type Sets the ProDOS filetype stored in the BinSCII header to type. The type may be specified as a standard 3- letter ProDOS file type abbreviation (in lowercase), or as a decimal, octal, or hexadecimal number in one of the following formats: ddd A decimal number (d is a decimal digit, in the range 0-9). $dd A hexadecimal number (d is a digit in the range 0-9 or a-f). Note that you will have to quote or escape the $ to protect it from the shell. 0xdd A hexadecimal number (d is a hexedecimal digit as in the previous case). 0dd An octal number (d is a digit in the range 0-7). If no -t option is present, the ProDOS file type will default to 6 (BIN). -a auxtype Sets the ProDOS auxiliary filetype in the BinSCII header to auxtype. The auxiliary type may be specified in decimal, hexadecimal, or octal, using the same syn- tax as the -t option above. If no -a option is present, the auxiliary type will default to 0. -m dnbiwr Sets the ProDOS file access mode. The mode may con- sists of one or more of the following letters: d File can be destroyed. n File can be renamed. b File needs backup. i File is invisible. w File can be opened for writing. r File can be opened for reading. If no -m option is specified, the access mode defaults to dnwr, which corresponds to an "unlocked" ProDOS file. To create a "locked" ProDOS file, specify a mode of r. - -n name Sets the ProDOS filename stored in the BinSCII header. If this option is omitted, the ProDOS filename will be the same as the UNIX filename. -s num Sets the number of BinSCII segments per output file to num. As with the -t and -a options, the number may be specified in decimal, hexadecimal, or octal. If no -s option is present, or if num is 0, then all BinSCII segments will be written to a single output file. To cause each segment to go into its own output file (like the Apple II BINSCII program), set num equal to 1. See below for an explanation of output files. -o outfile Normally, the output of bsc is stored in files whose names are derived from the name of the input file. This option makes bsc derive its output file names from the name outfile instead. -h Print a short summary of bsc's output options on the standard output. These options, if present, may appear in any order, provided that they appear before the filename. Spaces may appear between an option letter and its value, but are not neces- sary. The filename is the name of the UNIX file to be BinSCII'd. The stored ProDOS filename will be taken from the UNIX name, or from the -n option if one was supplied, with lowercase letters converted to uppercase. Additionally, characters that are not valid in ProDOS filenames will be translated into periods (unless the invalid character is the first character in the name, in which case it gets translated into an "X"). The ProDOS name will be truncated to 15 characters if necessary. The stored ProDOS creation and modification times will be taken from the UNIX input file. The output of bsc is a set of one or more files, each con- taining one or more BinSCII segments. By default, all Bin- SCII segments are written to a single output file, which has the same name as the input file with a ".0" appended to the end. If the -s option is given on the command line with a value greater than zero, then the number of segments per output file will be limited to the specified value, and if more than one output file is needed, the second file will have ".1" appended to the name, the third will have ".2" appended, and so forth. For example, if "foo" is a large UNIX file, the command "bsc -s3 foo" will create files "foo.0", "foo.1", "foo.2", etc., each containing 3 BinSCII segments. If the -o option is given on the command line, then the -o name will be used for the output files instead of the input filename. The output files will still have ".0", ".1", ".2", etc., appended to their names. Bsc will refuse to BinSCII a file larger than 16777216 bytes (16 meg), since that is the maximum size of a ProDOS file. EXAMPLE Suppose a UNIX file called "picture" contains a standard Apple IIGS super-hires screen image. The command bsc -tpic picture will create the file "picture.0" in a format suitable for downloading to an Apple II and un-BinSCIIing, or for posting to comp.binaries.apple2. When un-BinSCII'd on an Apple II, it will automatically be converted to a PIC ($C1) file. SEE ALSO uuencode(1), binscii(5) BUGS If a file with the same name as a bsc output file already exists, then the pre-existing file will be silently overwritten by the bsc output file. Before typing "bsc foo", it's a good idea to make sure you don't already have an important data file called "foo.0". If you find any bugs is bsc, send e-mail to one of the addresses below. I welcome bug reports, comments, com- plaints, and suggestions for improvement. (Please send me your bug reports - don't just sit on it and hope it will magically get better. I can't fix it if I don't know it's broken!) AUTHOR Neil Parker (nparker@cie.uoregon.edu, parker@corona.uoregon.edu) Thanks to Marcel J. E. Mol, whose sciibin program was a valuable source of technical information on BinSCII.