MCPcopy Create free account
hub / github.com/RsyncProject/rsync / inet_ntop4

Function inet_ntop4

lib/inet_ntop.c:73–88  ·  view source on GitHub ↗

const char * * inet_ntop4(src, dst, size) * format an IPv4 address * return: * `dst' (as a const) * notes: * (1) uses no statics * (2) takes a unsigned char* not an in_addr as input * author: * Paul Vixie, 1996. */

Source from the content-addressed store, hash-verified

71 * Paul Vixie, 1996.
72 */
73static const char *
74inet_ntop4(const unsigned char *src, char *dst, size_t size)
75{
76 static const char *fmt = "%u.%u.%u.%u";
77 char tmp[sizeof "255.255.255.255"];
78 size_t len;
79
80 len = snprintf(tmp, sizeof tmp, fmt, src[0], src[1], src[2], src[3]);
81 if (len >= size) {
82 errno = ENOSPC;
83 return (NULL);
84 }
85 memcpy(dst, tmp, len + 1);
86
87 return (dst);
88}
89
90/* const char *
91 * isc_inet_ntop6(src, dst, size)

Callers 2

inet_ntopFunction · 0.85
inet_ntop6Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected