This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix .gitignore: only ignore 'perl' in root of repo, not U/perl subdir
[metaconfig.git] / U / perl / d_printfed.U
CommitLineData
e252c656
DD
1?RCS: $Id$
2?RCS:
3?RCS: Copyright (c) 2000 Jarkko Hietaniemi
4?RCS:
5?RCS: You may distribute under the terms of either the GNU General Public
6?RCS: License or the Artistic License, as specified in the README file.
7?RCS:
0f00356b 8?MAKE:d_printf_exp_digits: Compile cat rm run
e252c656
DD
9?MAKE: -pick add $@ %<
10?S:d_printf_exp_digits:
11?S: This symbol's value is either 2 or 3, corresponding to the
12?S: number of exponent digits produced by the system's sprintf %[FGfg]
13?S: formats when the modulus of the exponent is 99 or less.
14?S:.
15?C:PRINTF_EXP_DIGITS:
16?C: This symbol's value is either 2 or 3, corresponding to the
17?C: number of exponent digits produced by the system's sprintf %[FGfg]
18?C: formats when the modulus of the exponent is 99 or less.
19?C:.
20?H:#define PRINTF_EXP_DIGITS $d_printf_exp_digits
21?H:.
0065f4af 22?F:!try
d7a2632b 23: Check sprintf exponent digits
e252c656
DD
24echo " "
25echo "Checking how many exponent digits your sprintf formats use..."
26$cat >try.c <<'EOSC'
0065f4af 27#include <stdio.h>
e252c656
DD
28int main() {
29 char b[10];
30 exit(sprintf(b, "%0.1e", 1.2) - 5);
31}
32EOSC
33set try
34if eval $compile; then
0f00356b 35 $run ./try
e252c656
DD
36 case "$?" in
37 2|3) d_printf_exp_digits=$? ;;
38 esac
39fi
40case "$d_printf_exp_digits" in
412|3) echo "Your sprintf seems to use $d_printf_exp_digits exponent digits."
42 ;;
43*) cat <<EOM >&4
44I do not understand what your sprintf is saying.
45I'm guessing it uses at least 2 exponent digits.
46EOM
47 d_printf_exp_digits=2
48 ;;
49esac
50$rm -f try try.*
51