home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / TEXT / UTILITY / CC21.ZIP / CC.DOC < prev    next >
Encoding:
Text File  |  1990-08-02  |  9.2 KB  |  233 lines

  1.  
  2.  
  3.                                   CC, v2.1
  4.                                 -------------
  5.                                 from TifaWARE
  6.  
  7.  
  8.  
  9.  
  10. What's New
  11. ----------
  12.  
  13.      Although CC is a pretty simple program, earlier versions do appear to
  14. suffer from one problem. When used to redirect output to a HP LaserJet
  15. printer CC sometimes appears to lose formfeed characters. Actually, this
  16. is not a problem with CC but occurs because the printer ignores formfeeds
  17. found anywhere other than at the start of a line. To avoid this aberrant
  18. behaviour then, formfeeds are now preceded by a single carriage return
  19. starting with version 2.1.
  20.  
  21.      Many of the principal functions in CC have been completely rewritten
  22. for version 2.0. Additionally, AT&T's getopt() function is now used for a
  23. consistent method of processing commandline options. Since it did not get
  24. much use, the tab-expansion option will no longer be included in CC.
  25.  
  26.      Version 1.2 of CC does not represent much of an improvement over the
  27. preceding version, at least from the user's viewpoint. Some of the code
  28. for displaying the on-line help message was improved, and error messages
  29. are formated in a slightly different fashion. 
  30.  
  31.  
  32.  
  33.  
  34. Introduction
  35. ------------
  36.  
  37.  
  38.      In my work on an IBM mainframe I frequently come across files with
  39. carriage controls in the first column of each line.  Printing such files on
  40. the mainframe's printer is no problem, but more often than not I'd rather
  41. download them to my PC and print them at my convenience.  The problem,
  42. though, has been that PC printers don't understand carriage controls, just
  43. characters named <form feed>, <carriage return>, <linefeed>, etc, ... 
  44.  
  45.      The algorithm to replace those carriage controls with characters PCs
  46. understand is simple enough.  Yet calling up an editor and making the
  47. changes for each file is a hassle I'd rather avoid.  Hence I've devised
  48. this little text filter.  It's called, appropriately enough, CC.  And it's
  49. sole purpose is to process files with carriage controls.
  50.  
  51.      Characters are read one at a time from the input file(s).  Most are
  52. simply output with no changes; however, the first character in each line is
  53. interpreted as an ASA carriage control in the following fashion:
  54.  
  55.      Carriage Control    Interpretation
  56.      ----------------    --------------
  57.      space               Advance 1 line before printing
  58.      0                   Advance 2 lines before printing
  59.      -                   Advance 3 lines before printing
  60.      +                   Surpress line advance before printing
  61.      1                   Advance to new page
  62.  
  63. With one exception, invalid carriage controls cause CC to print a <carriage
  64. return>, the rest of the line, and then a <linefeed>.  [The sole exception
  65. concerns empty lines, which are treated the same as lines composed of just
  66. one space.] Should you ever see a bunch of lines missing letters at the
  67. start, you probably filtered a file through CC which didn't contain
  68. carriage controls. 
  69.  
  70.  
  71.  
  72.  
  73. Usage
  74. -----
  75.  
  76.  
  77.      Running this program is quite simple.  Assuming you've placed CC.COM
  78. on your system where DOS can find it, type CC -? to display a brief help
  79. message similar to the following:
  80.  
  81.      TifaWARE CC, v2.1a, Aug 02 1990 - processes ASA carriage control 
  82.      characters.
  83.      Usage:  cc [-options] [file(s)]
  84.      
  85.      Options:
  86.        -? = provide this help message
  87.      
  88.      Stdin is used if no files are specified. Wildcards are not allowed.
  89.  
  90. [If you don't remember anything else from reading the documentation, at
  91. least remember how to display this help message.] Files names must be
  92. unique; that is, wildcards are _not_ supported. 
  93.  
  94.      CC sequentially processes each file named on the command line, or
  95. standard input if none are specified.  Trouble opening a file (because,
  96. say, the name was misspelled), simply causes CC to skip to the next file. 
  97. A read or write error during processing will, however, cause the program to
  98. abort. 
  99.  
  100.      CC's output is written to a device called stdout, which is normally
  101. your computer's screen.  Using the DOS redirection characters '>' and '|',
  102. you could send this output to a disk file, printer, or even use it as input
  103. into another program.  [Refer to your DOS manual for more information on
  104. output redirection.] The flexibility of this approach should be clear. 
  105.  
  106.  
  107.  
  108.  
  109. If You Have Any Trouble
  110. -----------------------
  111.  
  112.  
  113.      CC will attempt to let you know of any problems that arise.  Here are
  114. the messages you might see and how you should deal with them:
  115.  
  116.      cc: illegal option -- x.
  117.           - Type "CC -?" for a list of valid options. If your
  118.             file's name starts with a '-', you can avoid having
  119.             CC treat the name as a set of options by preceding it
  120.             with another name. For instance, typing "CC DB88Q4.LST
  121.             -ODDNAME.LOG" would process both files as desired.
  122.             Another solution is to prefix the name with path
  123.             information; e.g., CC .\-ODDNAME.LOG.
  124.  
  125.      cc: can't open BADFILE.
  126.           - CC was unable to open for input the file BADFILE.
  127.             Check the spelling and make sure the file actually 
  128.             exists.
  129.  
  130.      cc: can't read from SOMEFILE; processing halted at line 117.
  131.           - CC ran into trouble while attempting to read from
  132.             SOMEFILE. The line number reported by CC refers to
  133.             the last line processed from the *input* file. This
  134.             error indicates a serious problem exists with your
  135.             file. You should examine the file using a program
  136.             such as Norton Utilities or make another copy of
  137.             the file for CC to use.
  138.  
  139.      cc: can't write to stdout; processing halted at line 92 of SOMEFILE.
  140.           - The reason for this error depends on the particular type
  141.             of output redirection (if any) you're using. Perhaps the
  142.             disk to which you're sending output has become full;
  143.             perhaps the printer has become jammed or lost power, ...
  144.             however, you should never see this one if you're just
  145.             sending output to the screen. Once again, the line number
  146.             reported by CC refers to the input file.
  147.  
  148. These error messages are written to the standard error device.  In this
  149. way, they won't disappear down a pipe or into a file should you try to
  150. redirect CC's output. 
  151.  
  152.      Additionally, CC uses a return code to convey information about the
  153. success or failure of its operation.  Possible return values are:
  154.  
  155.      Code      Meaning
  156.      ----      -------
  157.      0         All files were processed successfully
  158.      1         Help message was displayed
  159.      10        At least 1 file was not opened for processing
  160.      15        Trouble was encountered reading from a file
  161.      20        Trouble was encountered writing to stdout
  162.  
  163. You can test for these codes using the ERRORLEVEL variable in a batch file. 
  164.  
  165.  
  166.  
  167.  
  168. Requirements
  169. ------------
  170.  
  171.  
  172.      TifaWARE CC runs on machines operating under MS-DOS v2.xx or later,
  173. and requires about 10K of memory.  It does not use BIOS calls, make direct
  174. writes to video RAM, or otherwise require machines to be "PC-compatible". 
  175. In fact, CC even runs properly on a DEC Rainbow!
  176.  
  177.  
  178.  
  179.  
  180. Who Owns It?
  181. ---------------
  182.  
  183.  
  184.      I am releasing this implementation of CC into the public domain. 
  185. Since my involvement with MS-DOS began in 1984, I've been a heavy user of
  186. public domain software (especially Kermit and a host of utilities for the
  187. DEC Rainbow).  Public domain software is a terrific idea.  For the most
  188. part, programs are useful and the source code instructive, all at no cost!
  189. With this small contribution to the public domain I hope to pay back, in
  190. some sense, my gratitude to those other programmers who have made my
  191. computing so much easier. 
  192.  
  193.      As a public domain program, CC carries no obligation on my part to
  194. support users or provide future upgrades.  I have tried to write clean code
  195. and believe it to be "bug-free".  Nevertheless, you must use this program
  196. ***AT YOUR OWN RISK***.  I strongly urge you to scan the source code
  197. yourself, make any desired changes, and recompile the program, if this is
  198. possible.  If you make this standard practice with newly acquired public
  199. domain software, you'll not only protect your system from worms and viruses
  200. but also get a better feel for exactly how each program works!
  201.  
  202.      As author of CC, I ask of you two things: First, if you distribute
  203. this program, please keep together my original source code, documentation,
  204. and executable.  This just makes it easier for others to use the software. 
  205. Second, let me hear what you think of CC.  You don't have to send any
  206. money, just comments and suggestions. 
  207.  
  208.  
  209.  
  210.  
  211. Kudos
  212. -----
  213.  
  214.  
  215.      Borland deserves a great deal of credit for its latest (v2.0) version
  216. of TURBO C as well as its stand-alone debugger.  Together, these products
  217. make C programming a joy. 
  218.  
  219.  
  220.  
  221.  
  222.  
  223.                           George A. Theall
  224.  
  225.                              TifaWARE
  226.                        506 South 41st St., #3M
  227.                       Philadelphia, PA.  19104
  228.                               U.S.A.
  229.  
  230.                          +1 215 662 0558
  231.  
  232.               GTHEALL@PENNDRLS.UPENN.EDU (ARPA Internet)
  233.