summaryrefslogtreecommitdiff
path: root/mcon/U/d_vprintf.U
blob: f74422d041df347bde552f57d39e39c08fc55ca5 (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
?RCS: $Id$
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic Licence,
?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 Licence; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: $Log: d_vprintf.U,v $
?RCS: Revision 3.0  1993/08/18  12:07:59  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:d_vprintf d_charvspr: Guess cat +cc +ccflags Csym Setvar
?MAKE:	-pick add $@ %<
?S:d_vprintf:
?S:	This variable conditionally defines the HAS_VPRINTF symbol, which
?S:	indicates to the C program that the vprintf() routine is available
?S:	to printf with a pointer to an argument list.
?S:.
?S:d_charvspr:
?S:	This variable conditionally defines CHARVSPRINTF if this system
?S:	has vsprintf returning type (char*).  The trend seems to be to
?S:	declare it as "int vsprintf()".
?S:.
?C:HAS_VPRINTF (VPRINTF):
?C:	This symbol, if defined, indicates that the vprintf routine is available
?C:	to printf with a pointer to an argument list.  If unavailable, you
?C:	may need to write your own, probably in terms of _doprnt().
?C:.
?C:USE_CHAR_VSPRINTF (CHARVSPRINTF):
?C:	This symbol is defined if this system has vsprintf() returning type
?C:	(char*).  The trend seems to be to declare it as "int vsprintf()".  It
?C:	is up to the package author to declare vsprintf correctly based on the
?C:	symbol.
?C:.
?H:#$d_vprintf HAS_VPRINTF	/**/
?H:#$d_charvspr USE_CHAR_VSPRINTF 	/**/
?H:.
?F:!vprintf !vprintf.c
?T:val2
?LINT:set d_vprintf d_charvspr
: see if vprintf exists
echo " "
if set vprintf val -f d_vprintf; eval $csym; $val; then
	echo 'vprintf() found.' >&4
	val="$define"
	$cat >vprintf.c <<'EOF'
#include <varargs.h>

int main() { xxx("foo"); }

xxx(va_alist)
va_dcl
{
	va_list args;
	char buf[10];

	va_start(args);
	exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
}
EOF
	if $cc $ccflags -o vprintf vprintf.c >/dev/null 2>&1 && ./vprintf; then
		echo "Your vsprintf() returns (int)." >&4
		val2="$undef"
	else
		echo "Your vsprintf() returns (char*)." >&4
		val2="$define"
	fi
else
	echo 'vprintf() NOT found.' >&4
		val="$undef"
		val2="$undef"
fi
set d_vprintf
eval $setvar
val=$val2
set d_charvspr
eval $setvar