Commit | Line | Data |
---|---|---|
c6667804 | 1 | ?RCS: $Id$ |
d8875586 MBT |
2 | ?RCS: |
3 | ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi | |
cf39bd7e | 4 | ?RCS: |
c6667804 | 5 | ?RCS: You may redistribute only under the terms of the Artistic License, |
d8875586 MBT |
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 | |
c6667804 | 8 | ?RCS: that same Artistic License; a copy of which may be found at the root |
d8875586 MBT |
9 | ?RCS: of the source tree for dist 4.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: Guess cat +cc +ccflags 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 | ?F:!vprintf !vprintf.c | |
42 | ?T:val2 | |
43 | ?LINT:set d_vprintf d_charvspr | |
44 | : see if vprintf exists | |
45 | echo " " | |
46 | if set vprintf val -f d_vprintf; eval $csym; $val; then | |
47 | echo 'vprintf() found.' >&4 | |
48 | val="$define" | |
49 | $cat >vprintf.c <<'EOF' | |
50 | #include <varargs.h> | |
51 | ||
52 | int main() { xxx("foo"); } | |
53 | ||
54 | xxx(va_alist) | |
55 | va_dcl | |
56 | { | |
57 | va_list args; | |
58 | char buf[10]; | |
59 | ||
60 | va_start(args); | |
61 | exit((unsigned long)vsprintf(buf,"%s",args) > 10L); | |
62 | } | |
63 | EOF | |
64 | if $cc $ccflags -o vprintf vprintf.c >/dev/null 2>&1 && ./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 |