mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 15:32:35 +00:00
Added printf formats for uint16_t etc
This commit is contained in:
parent
87935b7089
commit
9209312c3c
4 changed files with 114 additions and 0 deletions
3
CHANGES
3
CHANGES
|
@ -182,6 +182,9 @@ New features:
|
|||
Added AF_VSOCK support with VSOCK-CONNECT and VSOCK-LISTEN addresses.
|
||||
Developed by Stefano Garzarella.
|
||||
|
||||
Coding:
|
||||
Added printf formats for uint16_t etc.
|
||||
|
||||
Documentation:
|
||||
Address UDP-RECV does not support option fork.
|
||||
Thanks to Fulvio Scapin for reporting that mistake in docu.
|
||||
|
|
98
compat.h
98
compat.h
|
@ -94,6 +94,93 @@ typedef int sig_atomic_t;
|
|||
# define SOL_IPV6 IPPROTO_IPV6
|
||||
#endif
|
||||
|
||||
#define F_uint8_t "%hu"
|
||||
#define F_int8_t "%hd"
|
||||
|
||||
#ifndef F_uint16_t
|
||||
# if HAVE_BASIC_UINT16_T==0
|
||||
# define F_uint16_t "%hu"
|
||||
# elif HAVE_BASIC_UINT16_T==2
|
||||
# define F_uint16_t "%hu"
|
||||
# elif HAVE_BASIC_UINT16_T==4
|
||||
# define F_uint16_t "%u"
|
||||
# elif HAVE_BASIC_UINT16_T==6
|
||||
# define F_uint16_t "%lu"
|
||||
# else
|
||||
# error "HAVE_BASIC_UINT16_T is out of range:" HAVE_BASIC_UINT16_T
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef F_uint32_t
|
||||
# if HAVE_BASIC_UINT32_T==0
|
||||
# define F_uint32_t "%hu"
|
||||
# elif HAVE_BASIC_UINT32_T==2
|
||||
# define F_uint32_t "%hu"
|
||||
# elif HAVE_BASIC_UINT32_T==4
|
||||
# define F_uint32_t "%u"
|
||||
# elif HAVE_BASIC_UINT32_T==6
|
||||
# define F_uint32_t "%lu"
|
||||
# else
|
||||
# error "HAVE_BASIC_UINT32_T is out of range:" HAVE_BASIC_UINT32_T
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef F_uint64_t
|
||||
# if HAVE_BASIC_UINT64_T==0
|
||||
# define F_uint64_t "%hu"
|
||||
# elif HAVE_BASIC_UINT64_T==2
|
||||
# define F_uint64_t "%hu"
|
||||
# elif HAVE_BASIC_UINT64_T==4
|
||||
# define F_uint64_t "%u"
|
||||
# elif HAVE_BASIC_UINT64_T==6
|
||||
# define F_uint64_t "%lu"
|
||||
# else
|
||||
# error "HAVE_BASIC_UINT64_T is out of range:" HAVE_BASIC_UINT64_T
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef F_int16_t
|
||||
# if HAVE_BASIC_INT16_T==0
|
||||
# define F_int16_t "%hd"
|
||||
# elif HAVE_BASIC_INT16_T==1
|
||||
# define F_int16_t "%hd"
|
||||
# elif HAVE_BASIC_INT16_T==3
|
||||
# define F_int16_t "%d"
|
||||
# elif HAVE_BASIC_INT16_T==5
|
||||
# define F_int16_t "%l"
|
||||
# else
|
||||
# error "HAVE_BASIC_INT16_T is out of range:" HAVE_BASIC_INT16_T
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef F_int32_t
|
||||
# if HAVE_BASIC_INT32_T==0
|
||||
# define F_int32_t "%hd"
|
||||
# elif HAVE_BASIC_INT32_T==1
|
||||
# define F_int32_t "%hd"
|
||||
# elif HAVE_BASIC_INT32_T==3
|
||||
# define F_int32_t "%d"
|
||||
# elif HAVE_BASIC_INT32_T==5
|
||||
# define F_int32_t "%l"
|
||||
# else
|
||||
# error "HAVE_BASIC_INT32_T is out of range:" HAVE_BASIC_INT32_T
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef F_int64_t
|
||||
# if HAVE_BASIC_INT64_T==0
|
||||
# define F_int64_t "%hd"
|
||||
# elif HAVE_BASIC_INT64_T==1
|
||||
# define F_int64_t "%hd"
|
||||
# elif HAVE_BASIC_INT64_T==3
|
||||
# define F_int64_t "%d"
|
||||
# elif HAVE_BASIC_INT64_T==5
|
||||
# define F_int64_t "%l"
|
||||
# else
|
||||
# error "HAVE_BASIC_INT64_T is out of range:" HAVE_BASIC_INT64_T
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* all unsigned */
|
||||
#if !defined(HAVE_BASIC_SIZE_T) || !HAVE_BASIC_SIZE_T
|
||||
# undef HAVE_BASIC_SIZE_T
|
||||
|
@ -711,6 +798,17 @@ typedef unsigned long T_sigset;
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/* basic type of struct timeval tv_usec */
|
||||
#ifndef F_tv_usec
|
||||
# if TYPEOF_STRUCT_TIMEVAL_TV_USEC==1
|
||||
# define F_tv_usec "%hu"
|
||||
# elif TYPEOF_STRUCT_TIMEVAL_TV_USEC==3
|
||||
# define F_tv_usec "%u"
|
||||
# elif TYPEOF_STRUCT_TIMEVAL_TV_USEC==5
|
||||
# define F_tv_usec "%lu"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Cygwin 1.3.22 has the prototypes, but not the type... */
|
||||
#ifndef HAVE_TYPE_STAT64
|
||||
# undef HAVE_STAT64
|
||||
|
|
|
@ -598,6 +598,13 @@
|
|||
#endif
|
||||
|
||||
/* 1..short, 3..int, 5..long; 2,4,6..unsigned */
|
||||
#undef HAVE_BASIC_UINT16_T
|
||||
#undef HAVE_BASIC_UINT32_T
|
||||
#undef HAVE_BASIC_UINT64_T
|
||||
#undef HAVE_BASIC_INT16_T
|
||||
#undef HAVE_BASIC_INT32_T
|
||||
#undef HAVE_BASIC_INT64_T
|
||||
|
||||
#undef HAVE_BASIC_SIZE_T
|
||||
#undef HAVE_BASIC_MODE_T
|
||||
#undef HAVE_BASIC_PID_T
|
||||
|
|
|
@ -1844,6 +1844,12 @@ define(AC_TYPEOF_COMPONENT,[
|
|||
fi
|
||||
])
|
||||
|
||||
AC_BASIC_TYPE([#include <stdint.h>], uint16_t, HAVE_BASIC_UINT16_T, sc_cv_type_uint16_basic)
|
||||
AC_BASIC_TYPE([#include <stdint.h>], uint32_t, HAVE_BASIC_UINT32_T, sc_cv_type_uint32_basic)
|
||||
AC_BASIC_TYPE([#include <stdint.h>], uint64_t, HAVE_BASIC_UINT64_T, sc_cv_type_uint64_basic)
|
||||
AC_BASIC_TYPE([#include <stdint.h>], int16_t, HAVE_BASIC_INT16_T, sc_cv_type_int16_basic)
|
||||
AC_BASIC_TYPE([#include <stdint.h>], int32_t, HAVE_BASIC_INT32_T, sc_cv_type_int32_basic)
|
||||
AC_BASIC_TYPE([#include <stdint.h>], int64_t, HAVE_BASIC_INT64_T, sc_cv_type_int64_basic)
|
||||
AC_BASIC_TYPE([#include <stdlib.h>], size_t, HAVE_BASIC_SIZE_T, sc_cv_type_sizet_basic)
|
||||
AC_BASIC_TYPE([#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
Loading…
Reference in a new issue