summaryrefslogtreecommitdiff
path: root/support/dktools/dk4sock04.ctr
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-09-20 03:03:26 +0000
committerNorbert Preining <norbert@preining.info>2020-09-20 03:03:26 +0000
commit1f457376b478257b88d4a857f5ec1b6155442dd7 (patch)
tree2a06a60551dea362cf8cb0cb0ba66c78608717c4 /support/dktools/dk4sock04.ctr
parentac690ca29ad5bf8a5203a65fd6252f7b564f4727 (diff)
CTAN sync 202009200303
Diffstat (limited to 'support/dktools/dk4sock04.ctr')
-rw-r--r--support/dktools/dk4sock04.ctr76
1 files changed, 72 insertions, 4 deletions
diff --git a/support/dktools/dk4sock04.ctr b/support/dktools/dk4sock04.ctr
index fdc9799775..3d4a920e89 100644
--- a/support/dktools/dk4sock04.ctr
+++ b/support/dktools/dk4sock04.ctr
@@ -1,9 +1,12 @@
%% options
-
+copyright owner = Dirk Krause
+copyright year = 2017-xxxx
+SPDX-License-Identifier: BSD-3-Clause
%% module
+#include "dk4conf.h"
#include "dk4sock.h"
#include "dk4mem.h"
#include "dk4strw.h"
@@ -12,12 +15,20 @@
#include "dk4maowh.h"
#include "dk4rec23.h"
+#include "dk4unused.h"
+#if DK4_HAVE_ASSERT_H
+#ifndef ASSERT_H_INCLUDED
+#include <assert.h>
+#define ASSERT_H_INCLUDED 1
+#endif
+#endif
-$!trace-include
+$!trace-include
+#if DK4_ON_WINDOWS
/** Constant texts used by the module, not localized.
*/
static const wchar_t * const dk4socket_wc_kw[] = {
@@ -36,14 +47,23 @@ $!string-table prefix=L
:
$!end
};
+#endif
+
int
dk4socket_wc_inet_ntop(
+#if DK4_ON_WINDOWS
wchar_t *dptr,
size_t dsz,
int afam,
const void *src,
+#else
+ wchar_t * DK4_ARG_UNUSED(dptr),
+ size_t DK4_ARG_UNUSED(dsz),
+ int DK4_ARG_UNUSED(afam),
+ const void * DK4_ARG_UNUSED(src),
+#endif
dk4_er_t *erp
)
{
@@ -55,6 +75,12 @@ dk4socket_wc_inet_ntop(
#endif
struct in_addr in4;
int back = DK4_SOCKET_RESULT_FAILED;
+
+#if DK4_USE_ASSERT
+ assert(NULL != dptr);
+ assert(NULL != src);
+ assert(0 < dsz);
+#endif
if ((NULL != dptr) && (0 < dsz)) { *dptr = L'\0'; }
if ((NULL != dptr) && (NULL != src) && (0 < dsz)) {
dk4socket_error_reset();
@@ -103,7 +129,11 @@ dk4socket_wc_inet_ntop(
#if DK4_HAVE_STRUCT_SOCKADDR_IN6
unsigned short us;
#endif
-
+#if DK4_USE_ASSERT
+ assert(NULL != dptr);
+ assert(NULL != src);
+ assert(0 < dsz);
+#endif
if ((NULL != dptr) && (0 < dsz)) { *dptr = L'\0'; }
if ((NULL != dptr) && (NULL != src) && (0 < dsz)) {
switch (afam) {
@@ -203,6 +233,10 @@ dk4socket_wc_inet_ntop(
/* ----- +Windows -inet_ntop */
#endif
#else
+ DK4_UNUSED_ARG(dptr)
+ DK4_UNUSED_ARG(dsz)
+ DK4_UNUSED_ARG(afam)
+ DK4_UNUSED_ARG(src)
dk4error_set_simple_error_code(erp, DK4_E_NOT_SUPPORTED);
return DK4_SOCKET_RESULT_FAILED;
#endif
@@ -212,11 +246,23 @@ dk4socket_wc_inet_ntop(
int
dk4socket_wc_addr_port_to_text(
+#if DK4_ON_WINDOWS
wchar_t *dptr,
size_t dsz,
+#if DK4_HAVE_GETNAMEINFO
+ int DK4_ARG_UNUSED(afam),
+#else
int afam,
+#endif
const struct sockaddr *saptr,
size_t sasz,
+#else
+ wchar_t * DK4_ARG_UNUSED(dptr),
+ size_t DK4_ARG_UNUSED(dsz),
+ int DK4_ARG_UNUSED(afam),
+ const struct sockaddr * DK4_ARG_UNUSED(saptr),
+ size_t DK4_ARG_UNUSED(sasz),
+#endif
dk4_er_t *erp
)
{
@@ -229,6 +275,13 @@ dk4socket_wc_addr_port_to_text(
const DWORD szp = DK4_SIZEOF(pbuf,wchar_t);
int back = DK4_SOCKET_RESULT_FAILED;
int res;
+ DK4_UNUSED_ARG(afam)
+#if DK4_USE_ASSERT
+ assert(NULL != dptr);
+ assert(NULL != saptr);
+ assert(0 < dsz);
+ assert(0 < sasz);
+#endif
if ((NULL != dptr) && (0 < dsz)) { *dptr = '\0'; }
if ((NULL != dptr) && (NULL != saptr) && (0 < dsz) && (0 < sasz)) {
res = NI_NUMERICHOST | NI_NUMERICSERV;
@@ -266,6 +319,12 @@ dk4socket_wc_addr_port_to_text(
int hpah = 0;
int res;
unsigned short us;
+#if DK4_USE_ASSERT
+ assert(NULL != dptr);
+ assert(NULL != saptr);
+ assert(0 < dsz);
+ assert(0 < sasz);
+#endif
if ((NULL != dptr) && (0 < dsz)) { *dptr = L'\0'; }
if ((NULL != dptr) && (NULL != saptr) && (0 < dsz) && (0 < sasz)) {
switch (afam) {
@@ -323,6 +382,11 @@ dk4socket_wc_addr_port_to_text(
/* ----- -getnameinfo */
#endif
#else
+ DK4_UNUSED_ARG(dptr)
+ DK4_UNUSED_ARG(dsz)
+ DK4_UNUSED_ARG(afam)
+ DK4_UNUSED_ARG(saptr)
+ DK4_UNUSED_ARG(sasz)
dk4error_set_simple_error_code(erp, DK4_E_NOT_SUPPORTED);
return DK4_SOCKET_RESULT_FAILED;
#endif
@@ -340,7 +404,11 @@ dk4socket_wc_sockaddr_to_text(
{
const struct sockaddr *soa;
int back = DK4_SOCKET_RESULT_FAILED;
-
+#if DK4_USE_ASSERT
+ assert(NULL != dptr);
+ assert(NULL != saptr);
+ assert(0 < dsz);
+#endif
if ((NULL != dptr) && (NULL != saptr) && (0 < dsz)) {
soa = (const struct sockaddr *)saptr;
switch (soa->sa_family) {