Permalink
Browse files

perl for snprintf_l, vsnprintf_l

  • Loading branch information...
khwilliamson committed Nov 14, 2017
1 parent 13617cc commit 460902d20f3de8b3b31e1fe7310556a7f11f5dc7
Showing with 118 additions and 2 deletions.
  1. +70 −0 Configure
  2. +2 −0 Cross/config.sh-arm-linux
  3. +2 −0 NetWare/config.wc
  4. +2 −0 Porting/config.sh
  5. +11 −0 config_h.SH
  6. +2 −0 configure.com
  7. +2 −0 metaconfig.h
  8. +2 −0 plan9/config_sh.sample
  9. +2 −0 symbian/config.sh
  10. +13 −2 uconfig.h
  11. +2 −0 uconfig.sh
  12. +2 −0 uconfig64.sh
  13. +2 −0 win32/config.ce
  14. +2 −0 win32/config.gc
  15. +2 −0 win32/config.vc
View
@@ -807,6 +807,8 @@ d_signbit=''
d_sigprocmask=''
d_sigsetjmp=''
usesitecustomize=''
d_snprintf_l=''
d_vsnprintf_l=''
d_sockatmark=''
d_sockatmarkproto=''
d_ip_mreq=''
@@ -18331,6 +18333,72 @@ set d_sigsetjmp
eval $setvar
$rm_try
: see if snprintf_l exists
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
@@ -24133,6 +24201,7 @@ d_sigprocmask='$d_sigprocmask'
d_sigsetjmp='$d_sigsetjmp'
d_sin6_scope_id='$d_sin6_scope_id'
d_sitearch='$d_sitearch'
d_snprintf_l='$d_snprintf_l'
d_sockaddr_in6='$d_sockaddr_in6'
d_sockaddr_sa_len='$d_sockaddr_sa_len'
d_sockatmark='$d_sockatmark'
@@ -24222,6 +24291,7 @@ d_vfork='$d_vfork'
d_void_closedir='$d_void_closedir'
d_voidsig='$d_voidsig'
d_voidtty='$d_voidtty'
d_vsnprintf_l='$d_vsnprintf_l'
d_wait4='$d_wait4'
d_waitpid='$d_waitpid'
d_wcscmp='$d_wcscmp'
@@ -529,6 +529,7 @@ d_sigprocmask='define'
d_sigsetjmp='define'
d_sin6_scope_id='undef'
d_sitearch='define'
d_snprintf_l='undef'
d_sockaddr_in6='undef'
d_sockaddr_sa_len='undef'
d_sockatmark='undef'
@@ -619,6 +620,7 @@ d_vfork='undef'
d_void_closedir='undef'
d_voidsig='define'
d_voidtty=''
d_vsnprintf_l='undef'
d_wait4='define'
d_waitpid='define'
d_wcscmp='undef'
View
@@ -519,6 +519,7 @@ d_sigprocmask='undef'
d_sigsetjmp='undef'
d_sin6_scope_id='undef'
d_sitearch='undef'
d_snprintf_l='undef'
d_sockaddr_in6='undef'
d_sockaddr_sa_len='undef'
d_sockatmark='undef'
@@ -608,6 +609,7 @@ d_vfork='undef'
d_void_closedir='undef'
d_voidsig='define'
d_voidtty=''
d_vsnprintf_l='undef'
d_wait4='undef'
d_waitpid='define'
d_wcscmp='undef'
View
@@ -542,6 +542,7 @@ d_sigprocmask='define'
d_sigsetjmp='define'
d_sin6_scope_id='define'
d_sitearch='define'
d_snprintf_l='undef'
d_sockaddr_in6='define'
d_sockaddr_sa_len='define'
d_sockatmark='define'
@@ -632,6 +633,7 @@ d_vfork='define'
d_void_closedir='undef'
d_voidsig='define'
d_voidtty=''
d_vsnprintf_l='undef'
d_wait4='define'
d_waitpid='define'
d_wcscmp='define'
View
@@ -5000,6 +5000,17 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
#$d_setservent_r HAS_SETSERVENT_R /**/
#define SETSERVENT_R_PROTO $setservent_r_proto /**/
/* HAS_SNPRINTF_L:
* This symbol, if defined, indicates that the snprintf_l () library
* function is available for use.
*/
/* HAS_VSNPRINTF_L:
* This symbol, if defined, indicates that the vsnprintf_l () library
* function is available for use.
*/
#$d_snprintf_l HAS_SNPRINTF_L /**/
#$d_vsnprintf_l HAS_VSNPRINTF_L /**/
/* HAS_SRAND48_R:
* This symbol, if defined, indicates that the srand48_r routine
* is available to srand48 re-entrantly.
View
@@ -6332,6 +6332,7 @@ $ WC "d_sigprocmask='" + d_sigprocmask + "'"
$ WC "d_sigsetjmp='" + d_sigsetjmp + "'"
$ WC "d_sin6_scope_id='" + d_sin6_scope_id + "'"
$ WC "d_sitearch='define'"
$ WC "d_snprintf_l='undef'"
$ WC "d_sockaddr_in6='define'"
$ WC "d_sockaddr_sa_len='" + d_sockaddr_sa_len + "'"
$ WC "d_sockatmark='undef'"
@@ -6429,6 +6430,7 @@ $ WC "d_vms_shorten_long_symbols='" + d_vms_shorten_long_symbols + "'" ! VMS
$ WC "d_void_closedir='define'"
$ WC "d_voidsig='undef'"
$ WC "d_voidtty='" + "'"
$ WC "d_vsnprintf_l='undef'"
$ WC "d_wait4='" + d_wait4 + "'"
$ WC "d_waitpid='define'"
$ WC "d_wcscmp='define'"
View
@@ -20,7 +20,9 @@
* HAS_MBRLEN
* HAS_MBRTOWC
* HAS_NANOSLEEP
* HAS_SNPRINTF_L
* HAS_STRTOD_L
* HAS_STRTOLD_L
* HAS_VSNPRINTF_L
* I_WCHAR
*/
View
@@ -529,6 +529,7 @@ d_sigprocmask='define'
d_sigsetjmp='define'
d_sin6_scope_id='undef'
d_sitearch='define'
d_snprintf_l='undef'
d_sockaddr_in6='undef'
d_sockaddr_sa_len='undef'
d_sockatmark='undef'
@@ -618,6 +619,7 @@ d_vfork='undef'
d_void_closedir='undef'
d_voidsig='define'
d_voidtty=''
d_vsnprintf_l='undef'
d_wait4='undef'
d_waitpid='define'
d_wcscmp='undef'
View
@@ -478,6 +478,7 @@ d_sin6_scope_id='undef'
d_sitearch='define'
d_sitecustomize='undef'
d_sitecustomize='undef'
d_snprintf_l='undef'
d_sockaddr_in6='undef'
d_sockaddr_sa_len='undef'
d_sockatmark='undef'
@@ -567,6 +568,7 @@ d_vfork='undef'
d_void_closedir='undef'
d_voidsig='undef'
d_voidtty=''
d_vsnprintf_l='undef'
d_wait4='undef'
d_waitpid='undef'
d_wcscmp='undef'
View
@@ -4955,6 +4955,17 @@
/*#define HAS_SETSERVENT_R / **/
#define SETSERVENT_R_PROTO 0 /**/
/* HAS_SNPRINTF_L:
* This symbol, if defined, indicates that the snprintf_l () library
* function is available for use.
*/
/* HAS_VSNPRINTF_L:
* This symbol, if defined, indicates that the vsnprintf_l () library
* function is available for use.
*/
/*#define HAS_SNPRINTF_L / **/
/*#define HAS_VSNPRINTF_L / **/
/* HAS_SRAND48_R:
* This symbol, if defined, indicates that the srand48_r routine
* is available to srand48 re-entrantly.
@@ -5189,6 +5200,6 @@
#endif
/* Generated from:
* 36c481d726cfda37b1f5c4972dd7e456ea50df50fb3045526451adfa7f10c046 config_h.SH
* 03fbcff54e1342bc059b5a75da23afccdc6bd4e03d09364e6dbdc9974c52d996 uconfig.sh
* 1bfb569995f8ebfb6882215cef430ed9009ddd2e10bd4adf90705578f45b5a3d config_h.SH
* 7f275f10f4b677aa3018ecafbaa4135629b00388000ffdc3e61b30f6da81173d uconfig.sh
* ex: set ro: */
View
@@ -469,6 +469,7 @@ d_sigprocmask='undef'
d_sigsetjmp='undef'
d_sin6_scope_id='undef'
d_sitearch='undef'
d_snprintf_l='undef'
d_sockaddr_in6='undef'
d_sockaddr_sa_len='undef'
d_sockatmark='undef'
@@ -558,6 +559,7 @@ d_vfork='undef'
d_void_closedir='undef'
d_voidsig='undef'
d_voidtty=''
d_vsnprintf_l='undef'
d_wait4='undef'
d_waitpid='undef'
d_wcscmp='undef'
View
@@ -469,6 +469,7 @@ d_sigprocmask='undef'
d_sigsetjmp='undef'
d_sin6_scope_id='undef'
d_sitearch='undef'
d_snprintf_l='undef'
d_sockaddr_in6='undef'
d_sockaddr_sa_len='undef'
d_sockatmark='undef'
@@ -558,6 +559,7 @@ d_vfork='undef'
d_void_closedir='undef'
d_voidsig='undef'
d_voidtty=''
d_vsnprintf_l='undef'
d_wait4='undef'
d_waitpid='undef'
d_wcscmp='undef'
View
@@ -517,6 +517,7 @@ d_sigprocmask='undef'
d_sigsetjmp='undef'
d_sin6_scope_id='undef'
d_sitearch='define'
d_snprintf_l='undef'
d_sockaddr_in6='undef'
d_sockaddr_sa_len='undef'
d_sockatmark='undef'
@@ -606,6 +607,7 @@ d_vfork='undef'
d_void_closedir='undef'
d_voidsig='define'
d_voidtty=''
d_vsnprintf_l='undef'
d_wait4='undef'
d_waitpid='define'
d_wcscmp='undef'
View
@@ -518,6 +518,7 @@ d_sigsetjmp='undef'
d_sin6_scope_id='define'
d_sitearch='define'
d_snprintf='define'
d_snprintf_l='undef'
d_sockaddr_in6='undef'
d_sockaddr_sa_len='undef'
d_sockatmark='undef'
@@ -609,6 +610,7 @@ d_void_closedir='undef'
d_voidsig='define'
d_voidtty=''
d_vsnprintf='define'
d_vsnprintf_l='undef'
d_wait4='undef'
d_waitpid='define'
d_wcscmp='define'
View
@@ -517,6 +517,7 @@ d_sigprocmask='undef'
d_sigsetjmp='undef'
d_sin6_scope_id='define'
d_sitearch='define'
d_snprintf_l='undef'
d_sockaddr_in6='undef'
d_sockaddr_sa_len='undef'
d_sockatmark='undef'
@@ -607,6 +608,7 @@ d_vfork='undef'
d_void_closedir='undef'
d_voidsig='define'
d_voidtty=''
d_vsnprintf_l='undef'
d_wait4='undef'
d_waitpid='define'
d_wcscmp='define'

0 comments on commit 460902d

Please sign in to comment.