print CLI PRINT command Version 1.2 Copyright (c) 1988 by John F. Zacharias, All rights reserved Permission is granted for use by a non-profit, non-commercial user provided this READ_ME file accompanies the program and the above copyright notice and these restrictions are included with any copy. Any for-profit use or use by a commercial enterprise is strictly forbidden unless proper arrangements are made with the author. NOTE: this product is shareware. Registered shareware users will receive notices of any updates to this product (several are planned - see below). The minimum shareware donation for receiving update information is $10. Register your copy by sending $10 to: John F. Zacharias 10004 Vanguard Drive Sacramento, CA 95827 Phone: (916) 363-9153 "print" is a PRINT command for printing out Amiga files and directories in a formatted display. Features of the command are: * A heading showing the full path name (including the actual name of the disk - not DFx) and a page number are printed on each page. * Top and bottom margins are standard. Position your paper on the perforation and your heading will print on the fourth line down. The body of the print-out will start 2 lines after the heading. * Page length and the left and right margins are taken from your current Preferences values. * The first page of the printout will show inportant information about the file (or directory) including: - The date and time the file or directory was last updated. - The file size in both bytes and blocks. For directories the number of blocks on the the disk and the size of each block is shown instead. - For directories only, the number of blocks currently in use and their percentage of the total available are shown. - The file protection status (files only - Workbench 1.3 format). - Any file comments (files only). - The date and time the file or directory was printed. * A directory printout is provided automatically if the file name specified in the command line is a directory and not a file. If a directory is chosen, all sub-directories within that directory will also be printed. The directory listing that is printed is similar to the LIST command and contains the following information: - A level indicator that indicates in what level a sub-directory and it's files are placed in relation to the current directory (the directory specified by the command). The current directory is shown as level 0 and each succeeding level is incremented by one. - The file or sub-directory name, number of bytes and blocks in the file, the protection status (Workbench 1.3 format), and the file creation (or update) date are shown following the level indicator. - File and directory names are shown in alphabetical order (case ignored) with all files at a particular level shown before the directories at that level. All files and sub-directories within a directory are shown immediately following the line listing that directory. The level number is used to indicate the relative position of the file or sub-directory within the directory hierarchy. - The format options listed below for files have no effect on the directory printout. * Four formats are provided for printing out files: - Each line is printed in ASCII text without line numbers. Except for line feeds, tabs, backspaces, and form feeds, control sequences (ESC, CTL pressed with a letter) and binary zeros are stripped from the printout. If a line feed ($0A), tab character ($09), backspace ($08), or form feed ($0C) is encountered, the appropriate action will be taken (start new line, space over to the next modulo 8, backspace over the previous character, or start new page). Normally carriage returns ($0D) are ignored unless they are not accompanied by a line feed. In this case, a carriage return by itself will be treated as a line feed. Before printing, all characters are converted to true 7-bit ASCII (the high order bit is stripped). If the right margin is reached before a line feed is encountered, the line will be continued on the next line of the printout. - Each line is printed in ASCII text with line numbers. Control sequences are handled as indicated above. If the right margin is reached before a line feed is encountered, the line will be continued on the next line of the printout without a line number. - The file is printed in ASCII text with all control characters shown. Control sequences are printed with a ^ followed by the appropriate letter. An ESC is printed as ^[. Except for line feeds (not shown as a control sequence) all other control sequences will NOT have their appropriate action performed (i.e., tab characters will not space over, backspace characters will not backspace over the previous character, etc.). - The file is printed in hexadecimal format. The hex format differs from that used by the AmigaDOS TYPE command in the following manner: + The file position is 6 hex characters rather than 4. + Text is grouped by 68000 word size (2 bytes) rather than long word size (4 bytes). + In the printed text display on the right of the line, bytes with a $80 zone (2-7 bit on) have the zone stripped so that the are printed as ASCII characters. This allows you to see characters that use the 2-7 zone as a special indicator. + The line feed character ($0A) is printed as a '>' in the text display on the right. This allows you to quickly distinguish end of lines if you are printing out a text file in hex. All other control characters are printed as '.'. NOTE: "print" is not intended for printing out pre-formatted text files with their own headings and page numbers embedded in the text unless you want to see the formatting options used in the file. If such a file is printed using OPT S of "print", all of the pre-formatting options will be printed as control sequences (^ followed by a letter) and you will not get the formatting that was intended. Without the OPT S, the file will be printed with the pre-formatting options stripped. To print such a file and get the intended formatting options it is best to use: copy filename to PRT: SPECIAL ENHANCEMENTS ADDED TO V 1.2 OF PRINT: - The SHOW (S) option was added and the normal printout no longer shows control sequences (see description of formats above). - You can restart a printout at any page number. This is useful if you need to terminate a printout before it is complete. You can then restart the printout at the page number you stopped the previous printout on. - You can force the printer to be re-initialized with the options specified in the preferences menu. This is useful if, for any reason, you have to turn your printer off. Normally this will cause the printer to loose any hardware options which your AMIGA loaded to the printer when you booted the system. (Options that were provided in your permanent Preferences settings.) - A bug was corrected that caused "print" to GURU if a file was printed following a directory. You can now combine any number of directories and/or file listings in any order without worrying about a GURU (I hope!). - The CONTROL C BREAK option has been enhanced and improved. To use "print": 1. First copy "print" to your "C" directory. 2. "print" is intended to run ONLY under CLI. The CLI command line syntax is as follows: print {-i} file-name {rp=n} {...file-name} {OPT H|N|S} The -i parameter is used to force the printer to be re-loaded with the preferences options before printing starts. Either OPT H, OPT N, or OPT S may be specified. OPT H indicates that the file should be printed in hex, OPT N indicates that the file should be printed with line numbers, and OPT S indicates that all control sequences should be printed. No OPT is used if you want to print the file as ASCII text without line numbers. The OPT statement has no effect if the file-name is a directory. More than one file-name (or directory name) can be specified and more than one OPT argument can be given. Any one OPT argument will apply to all files that preceed that option operand. As an example: print file-1 opt h file-2 opt n file-3 will print file-1 in hex, file-2 with sequence numbers, and file-3 without sequence numbers. PLEASE NOTE that all files that you want printed as ASCII text lines without sequence numbers must follow the last OPT argument. The rp=n parameter may be used to re-start a printout at some page number after the first page. n is the page number that you want restarted on. The rp= parameter applies ONLY to the filename preceding the parameter. Both files and directories may be restarted. 3. You may terminate a print-out at any time by pressing CONTROL-C (or CONTROL-D). When you press CONTROL-C a requestor will appear which will ask if you want to "Abort Current Print-Out?" If you wish to continue with the print-out simply click on "NO". If you click on "YES" and you are printing more than one file, another requestor will appear which will ask if you want to "Go on to next File?". If you click on "Yes", the first file will stop printing, the printer will page change, and you will start printing the second file. If you click on "No", the first file will terminate printing, the printer will page change, and the "print" command will terminate. SPECIAL CONSIDERATION: Many printers provide a built in buffer that allows a number of lines to be sent to the printer ahead of their actual printing. For this reason, if you abort a printout you may still have several pages (depending on the size of the buffer) of printing to complete. You may restart a printout that you previously terminated and any page other than the first page by using the rp= parameter (see above). NOTE: The file or directory information section is always printed regardless of when you hit CONTROL-C. A line is also printed which says you have terminated the print-out. Known problems with "print": * No length check is performed on the path name printed in the header. If the path name is too long, the header line will wrap around to the next line. The maximum size path name that will print on one line is your line size minus 15 for files and line size minus 20 for directories. * No length check is performed on any of the lines printed in the file or directory information section on the first page. If the lines are two big they will wrap around to the next line. This may cause the first page of the printout to exceed the allowable lines for that page. With the exception of the file comment line, 70 characters are required for the longest line printed in the file information section. Since the file comment can be up to 80 characters, it will exceed the printout line if it is larger than the line size minus 19. Not all file comments, of course, are that large. For directories, up to 75 characters are required in the information section. A future release will correctly compensate for this problem with proper word-wrap. * If this product is used with Workbench 1.3, it cannot be installed as a "resident" command. When "print" was initially designed, it was not designed as a re-entrant module. DISCLAIMER: While every attempt has been made to test "print" using a variety of options combined with multiple files and directories, my desire to get the product in the hands of the user community as rapidly as possible precludes the type of testing that will guarantee that NO errors exist in this program. In fact, it is through extensive distribution and use of this product that many bugs will be detected. If you discover a bug, I would appreciate being informed of said bug. It would also be helpful if the user could describe the circumstances under which the bug occurred, and, if possible, send me a copy of the file/directory on which the bug was discovered. I will send a replacement diskette for any media so submitted. The source provided with this distribution was compiled using Version 4.01 of Lattice C. Future enhancements to "print" which are planned include: * The ability to use wild cards within file names to allow you to print multiple files with duplicate characters in their names. * An option will allow you to print all files contained within a directory along with an index of the files. With this option page numbers will not return to zero with the beginning of each file. * An optional "with" argument will allow you to specify a file that contains a "file list" of files you want printed. With this file list you will also be able specify whether you want an index and whether file page number should be reset between files. If you have any suggestions for any other future enhancements or improvements in the product, please direct them to me at the address given at the beginning of this document. - John