linux-scalability-benchmarks / libowfat / socket / scan_ip4.3

The default branch has multiple heads

.TH scan_ip4 3
.SH NAME
scan_ip4 \- parse an IPv4 number in dotted-decimal notation
.SH SYNTAX
.B #include <ip4.h>

int \fBscan_ip4\fP(const char *\fIsrc\fR,char \fIip\fR[4]);
.SH DESCRIPTION
scan_ip4 parses an IPv4 number in dotted-decimal ASCII representation
from \fIsrc\fR and writes the result into \fIip\fR. It returns the
number of bytes read from \fIsrc\fR or 0 if the parsing failed.

Unlike many other IP parsing routines, scan_ip4 does not recognize octal
(like \fB0177.0.0.1\fR) or hexadecimal numbers (like \fB0x7f000001\fR).
.SH EXAMPLE
#include <str.h>
.br
#include <ip4.h>

  char buf[]="160.45.40.10";
  char ip[4];
  if (scan_ip4(buf,ip) != str_len(buf))
    parse_error();

.SH "SEE ALSO"
fmt_ip4(3), scan_ip6(3), inet_pton(3)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.