[comp.sources.d] v17i064: Zoo archive program, Part01/10

matthew@sunpix.UUCP ( Sun NCAA) (02/09/89)

     After unpacking, compiling and studying the compiler "warning" messages
I've got Zoo - version 2.01 up and running on Sun 3's, 4's and 386i's running 
SunOS 3.4, 3.5 and 4.0. 

     Executing the 'mkbsd' script worked perfectly under SunOS 3.4 and 3.5, 
but the compiler complained of

                 warning: illegal pointer combination

under 4.0. The problem simply turned out to be, that the value returned from
signal() under pre-4.0 was a pointer to an int. Under 4.0 it is now a pointer
to a void.  The fix is (take your choice):

1) Ignore the compiler warnings. The executable works perfectly dispite the
   warning messages (though I did get an e-mail message that his may not be 
   correct on a Sun 4).

     -- or --

2) Redefine the oldsignal declaration in comment.c, misc.c (2 declarations),
   zoodel.c, zooext.c, and zoopack.c from:

   int (*oldsignal)();

       -- to --

   void (*oldsignal)();


     Thats all folks!!


-- 
Matthew Lee Stier     (919) 469-8300|
Sun Microsystems ---  RTP, NC  27560|          "Wisconsin   Escapee"
uucp: {sun, rti}!sunpix!matthew     |

david@sun.com (live by the lawn dart, die by the lawn dart) (02/09/89)

In article <389@greens.UUCP> matthew@sunpix.UUCP ( Sun NCAA) writes:

>The problem simply turned out to be, that the value returned from signal()
>under pre-[SunOS]4.0 was a pointer to an int. Under 4.0 it is now a pointer
>to a void.  The fix is (take your choice):
>	...
>2) Redefine the oldsignal declaration in comment.c, misc.c (2 declarations),
>   zoodel.c, zooext.c, and zoopack.c from:
>
>   int (*oldsignal)();
>
>       -- to --
>
>   void (*oldsignal)();

You can easily (?) #ifdef it so it will work with either pre or post 4.0
SunOS:

#ifdef SIG_ERR
#define SIGNAL_HANDLER_TYPE void
#else
#define SIGNAL_HANDLER_TYPE int
#endif

SIGNAL_HANDLER_TYPE (*oldsignal)();

guy@auspex.UUCP (Guy Harris) (02/10/89)

>You can easily (?) #ifdef it so it will work with either pre or post 4.0
>SunOS:

Or invent a new #ifdef so it will work both on other "signal handlers
return 'int'" systems and "signal handlers return 'void'" systems (the
former being most pre-S5R3 systems:

	V7
	4.xBSD
	System III
	System V "Release 1" and Release 2
	(possibly others)

and the latter being:

	System V Release 3 and later
	SunOS 4.0 and later
	I think some version of Ultrix and later
	systems supporting ANSI C and/or POSIX compliance
	(possibly others)

).