?RCS: $Id: d_vprintf.U,v 3.0 1993/08/18 12:07:59 ram Exp $ ?RCS: ?RCS: Copyright (c) 1991-1993, Raphael Manfredi ?RCS: ?RCS: You may redistribute only under the terms of the Artistic License, ?RCS: as specified in the README file that comes with the distribution. ?RCS: You may reuse parts of this distribution only within the terms of ?RCS: that same Artistic License; a copy of which may be found at the root ?RCS: of the source tree for dist 3.0. ?RCS: ?RCS: $Log: d_vprintf.U,v $ ?RCS: Revision 3.0 1993/08/18 12:07:59 ram ?RCS: Baseline for dist 3.0 netwide release. ?RCS: ?MAKE:d_vprintf d_charvspr: Compile Guess cat Csym Setvar run rm_try \ i_stdlib i_unistd i_stdarg i_varargs ?MAKE: -pick add $@ %< ?S:d_vprintf: ?S: This variable conditionally defines the HAS_VPRINTF symbol, which ?S: indicates to the C program that the vprintf() routine is available ?S: to printf with a pointer to an argument list. ?S:. ?S:d_charvspr: ?S: This variable conditionally defines CHARVSPRINTF if this system ?S: has vsprintf returning type (char*). The trend seems to be to ?S: declare it as "int vsprintf()". ?S:. ?C:HAS_VPRINTF (VPRINTF): ?C: This symbol, if defined, indicates that the vprintf routine is available ?C: to printf with a pointer to an argument list. If unavailable, you ?C: may need to write your own, probably in terms of _doprnt(). ?C:. ?C:USE_CHAR_VSPRINTF (CHARVSPRINTF): ?C: This symbol is defined if this system has vsprintf() returning type ?C: (char*). The trend seems to be to declare it as "int vsprintf()". It ?C: is up to the package author to declare vsprintf correctly based on the ?C: symbol. ?C:. ?H:#$d_vprintf HAS_VPRINTF /**/ ?H:#$d_charvspr USE_CHAR_VSPRINTF /**/ ?H:. ?T:val2 ?F:!try ?LINT:set d_vprintf d_charvspr : see if vprintf exists echo " " if set vprintf val -f d_vprintf; eval $csym; $val; then echo 'vprintf() found.' >&4 val="$define" $cat >try.c < #else /* I_VARARGS */ # include #endif #ifdef I_UNISTD # include #endif #ifdef I_STDLIB # include #endif #include /* vsprintf prototype */ #ifdef I_STDARG void xxx(int n, ...) { va_list args; char buf[10]; va_start(args, n); exit((unsigned long)vsprintf(buf,"%s",args) > 10L); } int main() { xxx(1, "foo"); } #else /* I_VARARGS */ xxx(va_alist) va_dcl { va_list args; char buf[10]; va_start(args); exit((unsigned long)vsprintf(buf,"%s",args) > 10L); } int main() { xxx("foo"); } #endif EOF set try if eval $compile_ok; then if $run ./try; then echo "Your vsprintf() returns (int)." >&4 val2="$undef" else echo "Your vsprintf() returns (char*)." >&4 val2="$define" fi else echo 'I am unable to compile the vsprintf() test program.' >&4 # We shouldn't get here. If we do, assume the standard signature, # not the old BSD one. echo 'Guessing that vsprintf() returns (int).' >&4 val2="$undef" fi else echo 'vprintf() NOT found.' >&4 val="$undef" val2="$undef" fi $rm_try set d_vprintf eval $setvar val=$val2 set d_charvspr eval $setvar