home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / utility / wc.zoo / README < prev    next >
Text File  |  1991-03-07  |  3KB  |  71 lines

  1. WC.TTP:        Count characters, words and lines in (a) file(s)
  2.  
  3. by David Megginson, 1991
  4. Released into the Public Domain
  5.  
  6. Usage:    wc [-cwl] [files...]
  7.  
  8. INTRODUCTION
  9.  
  10. Here is my version of wc(1) for the Atari ST. I have tested this
  11. version against the one which comes with Dave Beckemeyer's MT C-Shell,
  12. and the results seem to be identical (if there are bugs, we share
  13. them), although my output format is slightly different. wc takes three
  14. options:
  15.  
  16. -c    Count characters
  17. -w    Count words
  18. -l    Count lines
  19.  
  20. If no options are given, wc will count all three. If there are no
  21. arguments after the options, wc will read from stdin; otherwise, it
  22. will read from each of the files supplied on the command line, where
  23. "-" stands for stdin.
  24.  
  25. SPEED
  26.  
  27. For the sake of speed, I bypass the high-level i/o functions and read
  28. in large chunks of a file at once (this is portable to Unix and MSDOS,
  29. by the way). The default buffer size is 50000 bytes, but you can change
  30. it in the Makefile by adding -DBUFFER_SIZE=<whatever>. The bigger the
  31. buffer, the faster wc, but also the more memory wasted (remember, the
  32. ST is a MULTITASKING machine now, so we can't use Malloc(-1L) to grab
  33. all available memory any more without risking flames). This buffering
  34. system makes my wc about 5-6 times faster than D.B.'s: in the test I
  35. ran (10 1,000-line text files), my wc took 28 seconds, while D.B.'s
  36. took 163 seconds. This version should work with MT C-Shell, which is
  37. still a very nice package (I ran the test on the old release; the new
  38. wc might be faster).
  39.  
  40. THOSE PESKY CARRIAGE RETURNS
  41.  
  42. For some brain-damaged reason (MSDOS,CP/M compatibility, I imagine),
  43. the ST uses "\r\n" to mark the end of a line instead of "\n" like in
  44. Unix. Many of us have recompiled programs to avoid this, but the problem
  45. of compatibility still remains. Use the -DSKIP_CR flag in the Makefile
  46. to handle '\r' correctly (I have done this for the distribution binary).
  47.  
  48. WHAT DOES THIS COST?
  49.  
  50. Nothing, of course. After Eric Smith created MiNT and made it free to
  51. the public, how could I live with myself if I tried to make this
  52. shareware? Besides, I spent only an hour or two on it. Do feel free
  53. to post glowing messages about me to the net, though... :-)
  54.  
  55. REVISION NUMBER
  56.  
  57. You can check the revision number of your wc.ttp binaries using the
  58. RCS ident(1) command. If you don't have A. Pratt's excellent port of
  59. RCS for the Atari ST, GET IT!
  60.  
  61. USING THE SOURCE
  62.  
  63. This program is in the Public Domain, _not_ under the Gnu licensing
  64. agreement. As a result, you may incorporate it (re-compiled) into
  65. commercial packages without charge, although I would like a little
  66. credit somewhere in the documentation. The source is (I hope) good
  67. ANSI, and you will need an ANSI compiler and ANSI header files to
  68. recompile it (I use the Gnu C compiler and Eric Smith's MiNT library
  69. for GCC on the Atari ST).
  70.  
  71.