This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Backport #30919; remove \n; add $run
[metaconfig.git] / U / compline / d_vprintf.U
CommitLineData
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:
1273bb5e 15?MAKE:d_vprintf d_charvspr: Compile Guess cat Csym Setvar run rm i_stdlib
959f3c4c
JH
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
44echo " "
45if set vprintf val -f d_vprintf; eval $csym; $val; then
46 echo 'vprintf() found.' >&4
47 val="$define"
1273bb5e 48 $cat >try.c <<EOF
959f3c4c 49#include <varargs.h>
1273bb5e
JH
50#$i_stdlib I_STDLIB
51#ifdef I_STDLIB
52#include <stdlib.h>
53#endif
959f3c4c
JH
54
55int main() { xxx("foo"); }
56
57xxx(va_alist)
58va_dcl
59{
60 va_list args;
61 char buf[10];
62
63 va_start(args);
64 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
65}
66EOF
0f00356b
JH
67 set try
68 if eval $compile && $run ./try; then
959f3c4c
JH
69 echo "Your vsprintf() returns (int)." >&4
70 val2="$undef"
71 else
72 echo "Your vsprintf() returns (char*)." >&4
73 val2="$define"
74 fi
75else
76 echo 'vprintf() NOT found.' >&4
77 val="$undef"
78 val2="$undef"
79fi
0f00356b 80$rm -f try try.*
959f3c4c
JH
81set d_vprintf
82eval $setvar
83val=$val2
84set d_charvspr
85eval $setvar
86