Permalink
Browse files

f

  • Loading branch information...
khwilliamson committed Nov 14, 2017
1 parent 460902d commit a57586d6228158c6d8c1c750b6fa9eebfd7a76e1
Showing with 303 additions and 361 deletions.
  1. +2 −59 Configure
  2. +301 −302 Porting/config.sh
View
@@ -18333,72 +18333,15 @@ set d_sigsetjmp
eval $setvar
$rm_try
: see if snprintf_l exists
: see if snprintf_l exists. We assume that if present it works properly,
: since we should have tested plain 'snprintf' for proper function
set snprintf_l d_snprintf_l
eval $inlibc
: see if vsnprintf_l exists
set vsnprintf_l d_vsnprintf_l
eval $inlibc
case "$d_snprintf_l-$d_vsnprintf_l" in
"$define-$define")
$cat <<EOM
Checking whether your snprintf_l() and vsnprintf_l() work okay...
EOM
$cat >try.c <<'EOCP'
/* v?snprintf_l testing logic courtesy of Russ Allbery.
* According to C99:
* - if the buffer is too short it still must be \0-terminated
* - if the buffer is too short the potentially required length
* must be returned and not -1
* - if the buffer is NULL the potentially required length
* must be returned and not -1 or core dump
*/
#include <stdio.h>
#include <stdarg.h>
char buf[2];
int test (locale_t locale, char *format, ...)
{
va_list args;
int count;
va_start (args, format);
count = vsnprintf_l (buf, sizeof buf, locale, format, args);
va_end (args);
return count;
}
int main ()
{
locale_t locale = duplocale(LC_GLOBAL_LOCALE);
return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
&& snprintf_l (NULL, 0, locale, "%s", "abcd") == 4) ? 0 : 1);
}
EOCP
set try
if eval $compile; then
`$run ./try`
case "$?" in
0) echo "Your snprintf_l() and vsnprintf_l() seem to be working okay." ;;
*) cat <<EOM >&4
Your snprintf_l() and snprintf_l() don't seem to be working okay.
EOM
d_snprintf_l="$undef"
d_vsnprintf_l="$undef"
;;
esac
else
echo "(I can't seem to compile the test program--assuming they don't)"
d_snprintf_l="$undef"
d_vsnprintf_l="$undef"
fi
$rm_try
;;
esac
: see if sockatmark exists
set sockatmark d_sockatmark
eval $inlibc
Oops, something went wrong.

0 comments on commit a57586d

Please sign in to comment.