[comp.sources.d] v06i067: CPR a pretty printer for lots of C sources

dmt@mtunb.ATT.COM (Dave Tutelman) (03/25/89)

Thanks to Dennis for posting CPR.  It seems to work quite nicely under
the UNIX operating system.  However, I'm not sure what "ported to MSDOS"
means.  A colleague who uses Microsoft C still hasn't found the right
combination of model and stack size, and I needed to make further changes
to port it to Turbo C.  Since the changes were minimal, I'm just showing
them in text form (not even a "patch").

Changes to work with TURBO C:

1.      Disable the warning "Possibly incorrect assignment" in the
        Common Errors window of Compiler Options.  The program has
	a bunch of deliberate tests that are also assignments,
	that show up as warnings otherwise.

2.      Turn on the defined value TURBOC, as well as MSDOS, to catch
        change #3.

3.      Make the changes below to the function "CatchSignalsPlease".
        The action function should be "void" (even for UNIX), and
        TURBO C's signal function returns "void".

================ AS POSTED =================
CatchSignalsPlease(action)
int (*action)();
{
   if( signal(SIGINT, SIG_IGN) != SIG_IGN ) signal(SIGINT, action);
#ifndef MSDOS

=============== FOR TURBO C ==================
CatchSignalsPlease(action)
void (*action)();
{
#ifndef TURBOC
   if( signal(SIGINT, SIG_IGN) != SIG_IGN ) signal(SIGINT, action);
#else   /* TURBOC */
   signal (SIGINT, action);
#endif
#ifndef MSDOS

================ END ======================

With these changes, it still works fine under UNIX, but also works
under MSDOS with Turbo C.

+---------------------------------------------------------------+
|    Dave Tutelman						|
|    Physical - AT&T Bell Labs  -  Lincroft, NJ			|
|    Logical -  ...att!mtunb!dmt				|
|    Audible -  (201) 576 2442					|
+---------------------------------------------------------------+