chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
[PATCH] unmap db-file after use
[elogind.git]
/
klibc
/
klibc
/
inet
/
inet_aton.c
1
/*
2
* inet/inet_aton.c
3
*/
4
5
#include <arpa/inet.h>
6
#include <stdio.h>
7
8
int inet_aton(const char *str, struct in_addr *addr)
9
{
10
union {
11
uint8_t b[4];
12
uint32_t l;
13
} a;
14
15
if ( sscanf(str, "%hhu.%hhu.%hhu.%hhu", &a.b[0], &a.b[1], &a.b[2], &a.b[3]) == 4 ) {
16
addr->s_addr = a.l; /* Always in network byte order */
17
return 1;
18
} else {
19
return 0;
20
}
21
}
22
23