summaryrefslogtreecommitdiff
path: root/mcon/U/d_voidsig.U
blob: 78a503480850182778d0ff6375595a49f196a0ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
?RCS: $Id$
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: $Log: d_voidsig.U,v $
?RCS: Revision 3.0.1.3  1995/05/12  12:12:46  ram
?RCS: patch54: made cppflags dependency optional
?RCS:
?RCS: Revision 3.0.1.2  1994/08/29  16:20:35  ram
?RCS: patch32: now sets signal_t only once d_voidsig is known (WED)
?RCS:
?RCS: Revision 3.0.1.1  1994/06/20  06:59:54  ram
?RCS: patch30: now properly sets signal_t when re-using previous value
?RCS:
?RCS: Revision 3.0  1993/08/18  12:07:56  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:d_voidsig signal_t: rm contains cppstdin cppminus +cppflags test Myread \
	Oldconfig Setvar Findhdr
?MAKE:	-pick add $@ %<
?S:d_voidsig:
?S:	This variable conditionally defines VOIDSIG if this system
?S:	declares "void (*signal(...))()" in signal.h.  The old way was to
?S:	declare it as "int (*signal(...))()".
?S:.
?S:signal_t:
?S:	This variable holds the type of the signal handler (void or int).
?S:.
?C:VOIDSIG:
?C:	This symbol is defined if this system declares "void (*signal(...))()" in
?C:	signal.h.  The old way was to declare it as "int (*signal(...))()".  It
?C:	is up to the package author to declare things correctly based on the
?C:	symbol.
?C:.
?C:Signal_t (SIGNAL_T):
?C:	This symbol's value is either "void" or "int", corresponding to the
?C:	appropriate return type of a signal handler.  Thus, you can declare
?C:	a signal handler using "Signal_t (*handler)()", and define the
?C:	handler using "Signal_t handler(sig)".
?C:.
?H:#$d_voidsig VOIDSIG 	/**/
?H:#define Signal_t $signal_t	/* Signal handler's return type */
?H:.
?T:xxx
?LINT:set d_voidsig
: see if signal is declared as pointer to function returning int or void
echo " "
xxx=`./findhdr signal.h`
$test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
if $contains 'int.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
	echo "You have int (*signal())() instead of void." >&4
	val="$undef"
elif $contains 'void.*\*[ 	]*signal' $$.tmp >/dev/null 2>&1 ; then
	echo "You have void (*signal())() instead of int." >&4
	val="$define"
elif $contains 'extern[ 	]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
	echo "You have int (*signal())() instead of void." >&4
	val="$undef"
else
	case "$d_voidsig" in
	'')
	echo "I can't determine whether signal handler returns void or int..." >&4
		dflt=void
		rp="What type does your signal handler return?"
		. ./myread
		case "$ans" in
		v*) val="$define";;
		*) val="$undef";;
		esac;;
	"$define")
		echo "As you already told me, signal handler returns void." >&4;;
	*)
		echo "As you already told me, signal handler returns int." >&4;;
	esac
fi
set d_voidsig
eval $setvar
case "$d_voidsig" in
"$define") signal_t="void";;
*) signal_t="int";;
esac
$rm -f $$.tmp