Plan 9 from Bell Labs’s /usr/web/sources/contrib/anothy/src/lib/djb-ape/byte/ip4_fmt.3

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


.TH ip4_fmt 3
.SH NAME
ip4_fmt \- write a formatted ASCII representation of an IPv4 number
.SH SYNTAX
.B #include <ip4.h>

unsigned int \fBip4_fmt\fP(char *\fIdest\fR,const char \fIip\fR[4]);
.SH DESCRIPTION
ip4_fmt formats an IPv4 number in dotted-decimal ASCII representation
from \fIip\fR and writes the result into \fIdest\fR. It returns the
number of bytes written.

If \fIdest\fR equals FMT_LEN (i.e. is zero), ip4_fmt returns the number
of bytes it would have written.

ip4_fmt does not append \\0.

For convenience, ip4.h defines the integer IP4_FMT to be big enough to
contain every possible ip4_fmt output plus \\0.
.SH EXAMPLE
#include <ip4.h>

  char buf[IP4_FMT];
  char ip[4];
  buf[ip4_fmt(buf,ip)]=0;
.SH "SEE ALSO"
ip4_scan(3), ip6_fmt(3)

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].