Commit | Line | Data |
---|---|---|
546a4462 DD |
1 | ?RCS: $Id$ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 2000, Jarkko Hietaniemi | |
0065f4af | 4 | ?RCS: |
65a32477 | 5 | ?RCS: You may redistribute only under the terms of the Artistic License, |
546a4462 DD |
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 | |
65a32477 | 8 | ?RCS: that same Artistic License; a copy of which may be found at the root |
546a4462 DD |
9 | ?RCS: of the source tree for dist 3.0. |
10 | ?RCS: | |
161a6839 | 11 | ?MAKE:need_va_copy: rm_try cat Compile run |
546a4462 DD |
12 | ?MAKE: -pick add $@ %< |
13 | ?S:need_va_copy: | |
14 | ?S: This symbol, if defined, indicates that the system stores | |
15 | ?S: the variable argument list datatype, va_list, in a format | |
16 | ?S: that cannot be copied by simple assignment, so that some | |
17 | ?S: other means must be used when copying is required. | |
18 | ?S: As such systems vary in their provision (or non-provision) | |
19 | ?S: of copying mechanisms, handy.h defines a platform- | |
20 | ?S: independent macro, Perl_va_copy(src, dst), to do the job. | |
21 | ?S:. | |
22 | ?C:NEED_VA_COPY: | |
23 | ?C: This symbol, if defined, indicates that the system stores | |
24 | ?C: the variable argument list datatype, va_list, in a format | |
25 | ?C: that cannot be copied by simple assignment, so that some | |
26 | ?C: other means must be used when copying is required. | |
27 | ?C: As such systems vary in their provision (or non-provision) | |
28 | ?C: of copying mechanisms, handy.h defines a platform- | |
29 | ?C: independent macro, Perl_va_copy(src, dst), to do the job. | |
30 | ?C:. | |
31 | ?H:#$need_va_copy NEED_VA_COPY /**/ | |
32 | ?H:. | |
33 | ?T:okay | |
0065f4af | 34 | ?F:!try |
546a4462 DD |
35 | : see if we need va_copy |
36 | echo " " | |
161a6839 | 37 | $cat >try.c <<EOCP |
546a4462 DD |
38 | #include <stdarg.h> |
39 | #include <stdio.h> | |
7ac90f39 | 40 | #include <stdlib.h> |
7ac90f39 | 41 | #include <signal.h> |
546a4462 DD |
42 | |
43 | int | |
44 | ivfprintf(FILE *f, const char *fmt, va_list *valp) | |
45 | { | |
46 | return vfprintf(f, fmt, *valp); | |
47 | } | |
2cb64bf6 MB |
48 | |
49 | int | |
546a4462 DD |
50 | myvfprintf(FILE *f, const char *fmt, va_list val) |
51 | { | |
52 | return ivfprintf(f, fmt, &val); | |
53 | } | |
2cb64bf6 | 54 | |
546a4462 | 55 | int |
2cb64bf6 | 56 | myprintf(char *fmt, ...) |
546a4462 DD |
57 | { |
58 | va_list val; | |
59 | va_start(val, fmt); | |
2cb64bf6 MB |
60 | return myvfprintf(stdout, fmt, val); |
61 | } | |
546a4462 DD |
62 | |
63 | int | |
64 | main(int ac, char **av) | |
65 | { | |
7ac90f39 JH |
66 | signal(SIGSEGV, exit); |
67 | ||
2cb64bf6 MB |
68 | myprintf("%s%cs all right, then\n", "that", '\''); |
69 | exit(0); | |
546a4462 DD |
70 | } |
71 | EOCP | |
161a6839 AC |
72 | set try |
73 | if eval $compile && $run ./try 2>&1 >/dev/null; then | |
74 | case "`$run ./try`" in | |
75 | "that's all right, then") | |
76 | okay=yes | |
546a4462 DD |
77 | ;; |
78 | esac | |
161a6839 AC |
79 | fi |
80 | case "$okay" in | |
81 | yes) echo "It seems that you don't need va_copy()." >&4 | |
7fd9ec4d | 82 | need_va_copy="$undef" |
546a4462 | 83 | ;; |
161a6839 AC |
84 | *) echo "It seems that va_copy() or similar will be needed." >&4 |
85 | need_va_copy="$define" | |
86 | ;; | |
546a4462 | 87 | esac |
161a6839 | 88 | $rm_try |
546a4462 | 89 |