forked from unpbook/unpv13e
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwraplib.c
31 lines (25 loc) · 766 Bytes
/
wraplib.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* Wrapper functions for our own library functions.
* Most are included in the source file for the function itself.
*/
#include "unp.h"
const char *
Inet_ntop(int family, const void *addrptr, char *strptr, size_t len)
{
const char *ptr;
if (strptr == NULL) /* check for old code */
err_quit("NULL 3rd argument to inet_ntop");
if ( (ptr = inet_ntop(family, addrptr, strptr, len)) == NULL)
err_sys("inet_ntop error"); /* sets errno */
return(ptr);
}
void
Inet_pton(int family, const char *strptr, void *addrptr)
{
int n;
if ( (n = inet_pton(family, strptr, addrptr)) < 0)
err_sys("inet_pton error for %s", strptr); /* errno set */
else if (n == 0)
err_quit("inet_pton error for %s", strptr); /* errno not set */
/* nothing to return */
}