summaryrefslogtreecommitdiff
path: root/src/libstddjb/ip4_scanu32.c
blob: ab51ad6b4ea6a1f64f5d06b758d03e95fb0b0fd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* ISC license. */

#include <sys/types.h>
#include <stdint.h>
#include <skalibs/uint32.h>
#include <skalibs/fmtscan.h>

size_t ip4_scanu32 (char const *s, uint32_t *ip)
{
  char pack[4] ;
  size_t r = ip4_scan(s, pack) ;
  if (r) uint32_unpack_big(pack, ip) ;
  return r ;
}