Commit | Line | Data |
---|---|---|
959f3c4c JH |
1 | ?RCS: $Id: d_vprintf.U,v 3.0 1993/08/18 12:07:59 ram Exp $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1991-1993, Raphael Manfredi | |
4 | ?RCS: | |
5 | ?RCS: You may redistribute only under the terms of the Artistic Licence, | |
6 | ?RCS: as specified in the README file that comes with the distribution. | |
7 | ?RCS: You may reuse parts of this distribution only within the terms of | |
8 | ?RCS: that same Artistic Licence; a copy of which may be found at the root | |
9 | ?RCS: of the source tree for dist 3.0. | |
10 | ?RCS: | |
11 | ?RCS: $Log: d_vprintf.U,v $ | |
12 | ?RCS: Revision 3.0 1993/08/18 12:07:59 ram | |
13 | ?RCS: Baseline for dist 3.0 netwide release. | |
14 | ?RCS: | |
15 | ?MAKE:d_vprintf d_charvspr: Compile Guess cat Csym Setvar | |
16 | ?MAKE: -pick add $@ %< | |
17 | ?S:d_vprintf: | |
18 | ?S: This variable conditionally defines the HAS_VPRINTF symbol, which | |
19 | ?S: indicates to the C program that the vprintf() routine is available | |
20 | ?S: to printf with a pointer to an argument list. | |
21 | ?S:. | |
22 | ?S:d_charvspr: | |
23 | ?S: This variable conditionally defines CHARVSPRINTF if this system | |
24 | ?S: has vsprintf returning type (char*). The trend seems to be to | |
25 | ?S: declare it as "int vsprintf()". | |
26 | ?S:. | |
27 | ?C:HAS_VPRINTF (VPRINTF): | |
28 | ?C: This symbol, if defined, indicates that the vprintf routine is available | |
29 | ?C: to printf with a pointer to an argument list. If unavailable, you | |
30 | ?C: may need to write your own, probably in terms of _doprnt(). | |
31 | ?C:. | |
32 | ?C:USE_CHAR_VSPRINTF (CHARVSPRINTF): | |
33 | ?C: This symbol is defined if this system has vsprintf() returning type | |
34 | ?C: (char*). The trend seems to be to declare it as "int vsprintf()". It | |
35 | ?C: is up to the package author to declare vsprintf correctly based on the | |
36 | ?C: symbol. | |
37 | ?C:. | |
38 | ?H:#$d_vprintf HAS_VPRINTF /**/ | |
39 | ?H:#$d_charvspr USE_CHAR_VSPRINTF /**/ | |
40 | ?H:. | |
41 | ?T:val2 | |
42 | ?LINT:set d_vprintf d_charvspr | |
43 | : see if vprintf exists | |
44 | echo " " | |
45 | if set vprintf val -f d_vprintf; eval $csym; $val; then | |
46 | echo 'vprintf() found.' >&4 | |
47 | val="$define" | |
48 | $cat >vprintf.c <<'EOF' | |
49 | #include <varargs.h> | |
50 | ||
51 | int main() { xxx("foo"); } | |
52 | ||
53 | xxx(va_alist) | |
54 | va_dcl | |
55 | { | |
56 | va_list args; | |
57 | char buf[10]; | |
58 | ||
59 | va_start(args); | |
60 | exit((unsigned long)vsprintf(buf,"%s",args) > 10L); | |
61 | } | |
62 | EOF | |
63 | set vprintf | |
64 | if eval $compile && ./vprintf; then | |
65 | echo "Your vsprintf() returns (int)." >&4 | |
66 | val2="$undef" | |
67 | else | |
68 | echo "Your vsprintf() returns (char*)." >&4 | |
69 | val2="$define" | |
70 | fi | |
71 | else | |
72 | echo 'vprintf() NOT found.' >&4 | |
73 | val="$undef" | |
74 | val2="$undef" | |
75 | fi | |
76 | set d_vprintf | |
77 | eval $setvar | |
78 | val=$val2 | |
79 | set d_charvspr | |
80 | eval $setvar | |
81 |