CCOUNT Version 1.0 Gene Pizzetta March 7, 1992 CCOUNT counts characters in text files. Both the total number of characters and counts for specified characters are reported. Alternately, CCOUNT can report the counts of all characters, including control characters, and can ignore high bits or not. Both ZCPR3 and vanilla CP/M are supported. USAGE: CCOUNT {dir:}infile {byte {...}} {/options} If no DU or DIR is given, the currently logged drive and user is assumed. Under CP/M only the drive specification is significant; the current is user is always assumed. SEARCH BYTES: Multiple search bytes may be given as ASCII characters, decimal, hexadecimal, octal, or binary numbers. If no search bytes are given, only the total number of characters in the file is reported. 'c Lower-case character. Counts occurrences of "c" as a lower-case character. Non-alphabetic characters may also be entered in this manner. "c Upper-case character. Counts occurrences of "c" as an upper-case character. Non-alphabetic characters may also be entered in this manner. ^c Control character. Counts occurrences of "c" as a control character. n Decimal ASCII value. "n" is the ASCII value of any character in decimal (0-255). nD Decimal ASCII value (same as "nn", above). nnH Hexadecimal ASCII value. "nn" is the ASCII value of any character in hexadecimal (00h-0FFh). Hexadecimal values must always begin with a digit. nnX Hexadecimal ASCII value (same as "nnH", above). nnnnnnnnB Binary ASCII value. "nnnnnnnn" is the ASCII value of any character in binary (00000000b-11111111b). nnnO Octal ASCII value. "nnn" is the ASCII value of a character in octal (000o-777o). nnnQ Octal ASCII value (same as "nnnO", above). To find out whether your WordStar document file has the same number of ^A's and ^N's, enter: CCOUNT MYFILE.DOC ^A ^N To determine how many lines a file has, for instance, count the line feeds: CCOUNT MYFILE.TXT ^J Any control character may be counted, but counting ends with the first control-Z, so only one ^Z will be counted. Still, CCOUNT MYFILE.TXT ^Z can be useful to determine whether a file ends with ^Z or not. OPTIONS: A leading slash is required. A Count all characters. Displays the counts of all characters with ASCII values from 0 to 127, with 8-bit characters folded into the counts of their 7-bit counterparts. If the H option is also in effect, 8-bit characters are counted and reported separately increasing the number of reported characters to 256 (0- 255). H High bits are significant. Normally the high bit of an 8-bit character is ignored and such a character is counted with its 7-bit counterpart. With this option, characters with their high bits set are counted and reported separatedly. To get a report on a specific 8- bit character, its value must be entered on the command line in numeric characters. P Don't page screen. By default, CCOUNT pauses after each screen-full and waits for a key to be pressed before continuing. If a space is entered, one more line is displayed. A ^C will abort the program. Any other key will display another screen-full. With this option the screen scrolls continuously, but it can be paused with ^S (and ^C is still recognized). This option is probably only important when the A option is also used. All options can be configured as defaults. In that case, the command line option letter will toggle to the non-default mode. ERRORS: If "//" or an empty command line is given, CCOUNT will display a brief usage message. All other errors will cause invocation of the error handler, if one is installed. In addition, the program error flag will be set to standard ZCPR 3.4 error codes: 2, invalid directory; 8, ambiguous or missing filename; 10, file not found; 19, invalid option or parameter; or 4, any other error. CCOUNT can be configured to also treat a user abort as an error, so an active SUB or ZEX batch job can be aborted via the error handler. The error code in that case will be 255. CONFIGURATION: CCOUNT will run fine as distributed; no configuration is necessary. If you are running CP/M and you have fewer than 24 lines on your screen, you will need to change the default. In addition, the command line options can be made defaults, if you so desire. Configuration is accomplished using ZCNFG and the configuration file, CCOUNTnn.CFG. Do not change the name of the CFG file or ZCNFG will not be able to find it automatically. HISTORY: Version 1.0 -- March 6, 1992 -- Gene Pizzetta Based on a very mimimal test program I have used for a long time (it had the search characters hard coded into it). I decided that maybe I should release it after sprucing it up and making some additions: entering search bytes on the command line, option to count all characters, screen paging, 32-bit long-word counters and display so more than 65,535 characters can be counted, help screen, etc. etc. The result is an all-new program. Please report bugs promptly, or make suggestions at your leisure. Thanks. Gene Pizzetta 481 Revere Street Revere, MA 02151 Newton Centre Z-Node: (617) 965-7259 Ladera Z-Node Central: (310) 670-9465 Voice: (617) 284-0891