home *** CD-ROM | disk | FTP | other *** search
-
-
- CC, v2.1
- -------------
- from TifaWARE
-
-
-
-
- What's New
- ----------
-
- Although CC is a pretty simple program, earlier versions do appear to
- suffer from one problem. When used to redirect output to a HP LaserJet
- printer CC sometimes appears to lose formfeed characters. Actually, this
- is not a problem with CC but occurs because the printer ignores formfeeds
- found anywhere other than at the start of a line. To avoid this aberrant
- behaviour then, formfeeds are now preceded by a single carriage return
- starting with version 2.1.
-
- Many of the principal functions in CC have been completely rewritten
- for version 2.0. Additionally, AT&T's getopt() function is now used for a
- consistent method of processing commandline options. Since it did not get
- much use, the tab-expansion option will no longer be included in CC.
-
- Version 1.2 of CC does not represent much of an improvement over the
- preceding version, at least from the user's viewpoint. Some of the code
- for displaying the on-line help message was improved, and error messages
- are formated in a slightly different fashion.
-
-
-
-
- Introduction
- ------------
-
-
- In my work on an IBM mainframe I frequently come across files with
- carriage controls in the first column of each line. Printing such files on
- the mainframe's printer is no problem, but more often than not I'd rather
- download them to my PC and print them at my convenience. The problem,
- though, has been that PC printers don't understand carriage controls, just
- characters named <form feed>, <carriage return>, <linefeed>, etc, ...
-
- The algorithm to replace those carriage controls with characters PCs
- understand is simple enough. Yet calling up an editor and making the
- changes for each file is a hassle I'd rather avoid. Hence I've devised
- this little text filter. It's called, appropriately enough, CC. And it's
- sole purpose is to process files with carriage controls.
-
- Characters are read one at a time from the input file(s). Most are
- simply output with no changes; however, the first character in each line is
- interpreted as an ASA carriage control in the following fashion:
-
- Carriage Control Interpretation
- ---------------- --------------
- space Advance 1 line before printing
- 0 Advance 2 lines before printing
- - Advance 3 lines before printing
- + Surpress line advance before printing
- 1 Advance to new page
-
- With one exception, invalid carriage controls cause CC to print a <carriage
- return>, the rest of the line, and then a <linefeed>. [The sole exception
- concerns empty lines, which are treated the same as lines composed of just
- one space.] Should you ever see a bunch of lines missing letters at the
- start, you probably filtered a file through CC which didn't contain
- carriage controls.
-
-
-
-
- Usage
- -----
-
-
- Running this program is quite simple. Assuming you've placed CC.COM
- on your system where DOS can find it, type CC -? to display a brief help
- message similar to the following:
-
- TifaWARE CC, v2.1a, Aug 02 1990 - processes ASA carriage control
- characters.
- Usage: cc [-options] [file(s)]
-
- Options:
- -? = provide this help message
-
- Stdin is used if no files are specified. Wildcards are not allowed.
-
- [If you don't remember anything else from reading the documentation, at
- least remember how to display this help message.] Files names must be
- unique; that is, wildcards are _not_ supported.
-
- CC sequentially processes each file named on the command line, or
- standard input if none are specified. Trouble opening a file (because,
- say, the name was misspelled), simply causes CC to skip to the next file.
- A read or write error during processing will, however, cause the program to
- abort.
-
- CC's output is written to a device called stdout, which is normally
- your computer's screen. Using the DOS redirection characters '>' and '|',
- you could send this output to a disk file, printer, or even use it as input
- into another program. [Refer to your DOS manual for more information on
- output redirection.] The flexibility of this approach should be clear.
-
-
-
-
- If You Have Any Trouble
- -----------------------
-
-
- CC will attempt to let you know of any problems that arise. Here are
- the messages you might see and how you should deal with them:
-
- cc: illegal option -- x.
- - Type "CC -?" for a list of valid options. If your
- file's name starts with a '-', you can avoid having
- CC treat the name as a set of options by preceding it
- with another name. For instance, typing "CC DB88Q4.LST
- -ODDNAME.LOG" would process both files as desired.
- Another solution is to prefix the name with path
- information; e.g., CC .\-ODDNAME.LOG.
-
- cc: can't open BADFILE.
- - CC was unable to open for input the file BADFILE.
- Check the spelling and make sure the file actually
- exists.
-
- cc: can't read from SOMEFILE; processing halted at line 117.
- - CC ran into trouble while attempting to read from
- SOMEFILE. The line number reported by CC refers to
- the last line processed from the *input* file. This
- error indicates a serious problem exists with your
- file. You should examine the file using a program
- such as Norton Utilities or make another copy of
- the file for CC to use.
-
- cc: can't write to stdout; processing halted at line 92 of SOMEFILE.
- - The reason for this error depends on the particular type
- of output redirection (if any) you're using. Perhaps the
- disk to which you're sending output has become full;
- perhaps the printer has become jammed or lost power, ...
- however, you should never see this one if you're just
- sending output to the screen. Once again, the line number
- reported by CC refers to the input file.
-
- These error messages are written to the standard error device. In this
- way, they won't disappear down a pipe or into a file should you try to
- redirect CC's output.
-
- Additionally, CC uses a return code to convey information about the
- success or failure of its operation. Possible return values are:
-
- Code Meaning
- ---- -------
- 0 All files were processed successfully
- 1 Help message was displayed
- 10 At least 1 file was not opened for processing
- 15 Trouble was encountered reading from a file
- 20 Trouble was encountered writing to stdout
-
- You can test for these codes using the ERRORLEVEL variable in a batch file.
-
-
-
-
- Requirements
- ------------
-
-
- TifaWARE CC runs on machines operating under MS-DOS v2.xx or later,
- and requires about 10K of memory. It does not use BIOS calls, make direct
- writes to video RAM, or otherwise require machines to be "PC-compatible".
- In fact, CC even runs properly on a DEC Rainbow!
-
-
-
-
- Who Owns It?
- ---------------
-
-
- I am releasing this implementation of CC into the public domain.
- Since my involvement with MS-DOS began in 1984, I've been a heavy user of
- public domain software (especially Kermit and a host of utilities for the
- DEC Rainbow). Public domain software is a terrific idea. For the most
- part, programs are useful and the source code instructive, all at no cost!
- With this small contribution to the public domain I hope to pay back, in
- some sense, my gratitude to those other programmers who have made my
- computing so much easier.
-
- As a public domain program, CC carries no obligation on my part to
- support users or provide future upgrades. I have tried to write clean code
- and believe it to be "bug-free". Nevertheless, you must use this program
- ***AT YOUR OWN RISK***. I strongly urge you to scan the source code
- yourself, make any desired changes, and recompile the program, if this is
- possible. If you make this standard practice with newly acquired public
- domain software, you'll not only protect your system from worms and viruses
- but also get a better feel for exactly how each program works!
-
- As author of CC, I ask of you two things: First, if you distribute
- this program, please keep together my original source code, documentation,
- and executable. This just makes it easier for others to use the software.
- Second, let me hear what you think of CC. You don't have to send any
- money, just comments and suggestions.
-
-
-
-
- Kudos
- -----
-
-
- Borland deserves a great deal of credit for its latest (v2.0) version
- of TURBO C as well as its stand-alone debugger. Together, these products
- make C programming a joy.
-
-
-
-
-
- George A. Theall
-
- TifaWARE
- 506 South 41st St., #3M
- Philadelphia, PA. 19104
- U.S.A.
-
- +1 215 662 0558
-
- GTHEALL@PENNDRLS.UPENN.EDU (ARPA Internet)
-