1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Add support to port/snprintf.c for position parameter specification:

+ # Determine if printf supports %1$ argument selection, e.g. %5$ selects
+ # the fifth argument after the printf print string.
+ # This is not in the C99 standard, but in the Single Unix Specification (SUS).
+ # It is used in our langauge translation strings.

Nicolai Tufar with configure changes by Bruce.
This commit is contained in:
Bruce Momjian
2005-02-22 03:56:22 +00:00
parent 78bb800bc2
commit b4feafb6ff
4 changed files with 294 additions and 16 deletions

57
configure vendored
View File

@ -12162,6 +12162,63 @@ fi
done
echo "$as_me:$LINENO: checking printf supports argument control" >&5
echo $ECHO_N "checking printf supports argument control... $ECHO_C" >&6
if test "${pgac_cv_printf_arg_control+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then
pgac_cv_printf_arg_control=cross
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <stdio.h>
int does_printf_have_arg_control()
{
char buf[100];
/* can it swap arguments? */
snprintf(buf, 100, "%2$d|%1$d", 3, 4);
if (strcmp(buf, "4|3") != 0)
return 0;
return 1;
}
main() {
exit(! does_printf_have_arg_control());
}
_ACEOF
rm -f conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
pgac_cv_printf_arg_control=yes
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
( exit $ac_status )
pgac_cv_printf_arg_control=no
fi
rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
echo "$as_me:$LINENO: result: $pgac_cv_printf_arg_control" >&5
echo "${ECHO_T}$pgac_cv_printf_arg_control" >&6
# cross compiler should use our snprintf too
if test $pgac_cv_printf_arg_control != yes ; then
pgac_need_repl_snprintf=yes
fi
# Check whether <stdio.h> declares snprintf() and vsnprintf(); if not,
# include/c.h will provide declarations. Note this is a separate test