1 Cawf - nroff-like text formatter
3 Cawf is a C version of awf, Henry Spencer's Amazingly Workable (text)
4 Formatter. (Awf is written in awk and appears in comp.sources.unix,
5 Volume 23, Issue 27.) Cawf and awf provide a usable subset of raw nroff
6 capabilities and the styles of the man(7), me(7) and ms(7) macro sets.
7 One of cawf's virtues is that it will run on PC clones under MS-DOS. It
8 is also, like awf, totally independent of any licensed Unix source code.
10 This distribution contains complete source, make files for Unix and
11 MS-DOS, documentation (raw and formatted) and MS-DOS executables for cawf
12 and a companion output filters, bsfilt.
14 This is the fourth distribution of cawf. Changes include:
16 * Some rudimentary output device support has been added, via a device
19 * The code has been converted to use unsigned characters.
21 * An attempt has been made to make the code ANSI C compliant.
23 * The following bugs have been fixed:
25 A bug in the locating of the device file has been corrected,
26 so that the code performs as documented.
28 Null macro arguments are ignored.
30 Some unused arguments to local functions have been more
31 carefully type cast to avoid portability problems.
33 * The .fl and .rn requests are now supported.
35 * Limited support has been added for the non-break request control
36 character, the acute accent (').
38 * Argument count conditionals -- operating on \n(.$ -- may now use
39 the >= and <= operators in addition to [<=>].
41 * Macros may be terminated with "..", ".", "''" or "'".
43 * String interpolation is performed if it is specified at the start
44 of the .ds request argument.
46 * The .tr request has been enhanced to handle named characters and
49 * The SS macro is now included in man.mac.
51 * The cawf version number is now displayed in the help output.
53 * A limited -me macro set is included in me.mac.
55 Changes to cawf to run under Minix:
57 * The DOS binaries and make files have been removed.
59 * Tabs stops changed from per 5 to per 8.
61 * Bold and underline as it should be in device.cf.
63 * Added .SB and .TA to man.mac.
65 * Numerous prototypes added.
71 This Minix distribution of cawf includes:
74 *.c and *.h source files to build cawf and bsfilt (bsfilt
75 removes Backspaces from cawf output)
76 bsfilt.1 nroff source for the bsfilt manual page
77 cawf.1 nroff source for the cawf manual page
78 common initialization file for CAWFLIB library
79 device.cf output device configuration file for CAWFLIB
81 dumb.dev device description file for CAWFLIB library
82 Makefile Unix-style make file
83 man.mac man(7) macros for CAWFLIB library
84 me.mac me(7) macros for CAWFLIB library
85 ms.mac ms(7) macros for CAWFLIB library
87 #ifdef PUTTING_IT_ON_THE_NET
89 bsfilt binaries compiled under Minix-PC 1.5 using the ACK
90 ANSI C compiler using software floating point
97 To use cawf, you must select a location for the CAWFLIB library files. The
98 distributed cawf binary expects to find them in /usr/local/lib/cawf but you
99 can alter that with the CAWFLIB environment variable, or you can change the
100 CAWFLIB #define in cawf.h and rebuild cawf from the sources.
102 CAWFLIB contains a minimum of six files:
104 common common raw nroff commands to get cawf started
105 dumb.dev a set of character definitions for a plain, "dumb"
106 ASCII device - e. g., the console display, a CRT or
108 device.cf the output device configuration file
109 man.mac the man(7) macros
110 me.mac the me(7) macros
111 ms.mac the ms(7) macros
113 You may want to add your own macro files to the library. Just name them
114 "m[your-name].mac", following the usual nroff naming convention for macro
117 If you have fancy output devices with special character specifications, you
118 may want to generate new *.dev files for them. Follow the format of dumb.dev
119 in making new character specifications. To define characters for a new
120 device, select a name prefix for it and create a file in CAWFLIB with the
121 name "<prefix>.dev". To use the new file, set the TERM environment variable
122 to <prefix> - e. g., when I test cawf on Unix, I need a vt100.dev, because
123 my TERM environment variable value is usually vt100. All I do is make
124 vt100.dev a symbolic link to dumb.dev. Even that isn't even necessary,
125 because cawf will use dumb.dev if it can't find TERM.dev.
127 In addition to the character specifications possible through the *.dev files,
128 cawf provides one-time font selection and bold or italic face support for
129 output devices via its -d and -f options. Cawf can be directed to issue
130 specific device codes for bold and italic characters, and one font can be
131 specified for the entire document. Cawf has some built-in output device
132 support, and addition support is contained in the device configuration file,
133 device.cf. Additional devices may be defined in device.cf.
135 It is not necessary to generate a new *.dev file for each output device
136 definition. Only when you need special character definitions do you need to
137 create a *.dev file. The dumb.dev file is adequate for most devices you
144 The Unix make file has some definitions that help tune it to the local
147 CAWFLIB is a string that can be used in lieu of changes
148 to cawf.h's CWFLIB #define.
150 MALLOCH is a string that should be defined when a UNIX
151 environment has a <malloc.h>, unless it also has a
152 <stdlib.h> with protoypes for malloc() and its
153 relatives. In the latter case, you should define
154 STDLIB, but you don't need to define MALLOCH.
156 STDLIB indicates that standard library function prototype
157 definitions may be found in <stdlib.h>.
159 STDLIB must be defined for MS-DOS Quick C.
161 If STDLIB is not defined, the cawf sources try to
162 define their own library function return values.
164 __STR__ The definition of this string must be deleted when
165 using the xlc 1.2 compiler on the RISC/System 6000
170 in the Makefile DEFS string. This must be done
171 because the xlc 1.2 compiler does not correctly inline
172 string functions when compiling pass3.c.
174 UNIX switches the build environment to Unix. You may also
175 have to decide about MALLOCH, STDLIB, __STR__ and USG
176 when you define UNIX.
178 Do not define UNIX for MS-DOS Quick-C; do define
181 USG adjusts for System V. (UNIX must also be defined.)
183 You may also need to define USG to select the proper
184 header file for string function prototypes. If UNIX
185 and USG are defined, "proto.h" selects <string.h>;
186 if only UNIX, <strings.h>. Cawf needs the more
187 complete set of definitions, including strchr() and
188 strrchr(). If <string.h> #includes <strings.h>, as
189 is sometimes the case, define only UNIX.
191 I have built and tested cawf in the UNIX context under AIX 3.2 (see the
192 note above on __STR__), BSD4.3-Tahoe, Sequent DYNIX, ETAV (SYSV 3.0),
193 NeXTStep 3.0, SunOS 4.1.1 and Ultrix 2.2. If you build under another Unix
194 variant, you may have to adjust the source code, header files and Makefile
195 to fit. Check the Makefile first for hints.
201 Some effort has been devoted to making the cawf sources ANSI C compliant.
202 The header file proto.h contains function prototypes that enable ANSI C
203 argument checking. The state of definition of the __STDC__ symbol is used
204 to select options that depend on strict adherence to the ANSI C standard --
205 e.g., the need for the isascii() test before islower() or isupper(). If
206 your ANSI compiler doesn't define this variable when it's acting in strict
207 ANSI C mode, you may have to define it in the Makefile.
210 MS-DOS CONSIDERATIONS
211 ---------------------
213 The MS-DOS version of cawf was created to run under the KornShell of the
214 Mortis Kern Systems Toolkit. One ramification of using MKS' ksh is that it
215 supports the separate standard error and standard output streams. Hence,
216 cawf blithely distributes its error messages to the standard error file, and
217 assumes the user's shell is capable of separating them from standard output.
219 If you don't use the MKS KornShell, but do want to separate the output
220 streams, you'll have to modify the cawf source code. As a rudimentary aid,
221 cawf uses a separate stream pointer, Efs, for writing error output, but sets
222 it to stderr. You can change that process to open a separate error file and
223 set Efs to point to it.
226 COPYRIGHTS AND CREDITS
227 ----------------------
229 The sources are copyrighted, but freely distributable under usual terms -
230 retention of credit, etc.
234 AT&T for their public-domain release of getopt(3) at the 1985
237 Chet Creider, Bob Hardy and Ted Campbell for their contributions
240 Henry Spencer for awf and his regular expression package;
242 Andy Tanenbaum for his help in ANSI C compliance, including his
243 ansi.h header file from Minix.
245 Henry says about awf, "I can't believe I really wrote this." Those are
246 my sentiments exactly about cawf, but I also understand that necessity
247 sometimes forces us to do what we would prefer to avoid.
250 BUGS AND ENHANCEMENTS
251 ---------------------
253 I'll be glad to hear about bugs and needs for enhancements, but make no
254 promises about delivering fixes or upgrades in response.
256 Vic Abell <abe@cc.purdue.edu>
260 MINIX SPECIFIC TINKERING
261 ------------------------
263 Kees J. Bot <kjb@cs.vu.nl>