summaryrefslogtreecommitdiff
path: root/src/clock
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-03-12 19:39:01 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-03-12 19:39:01 +0000
commit53091e3bce487ee82e2805a0231e780551561717 (patch)
treef0fa36ff8eadaf1f01d4510597b5e3a310764dc7 /src/clock
parentf85b8a70f3b44510a5cf3895bf7357ae90655f65 (diff)
downloads6-networking-53091e3bce487ee82e2805a0231e780551561717.tar.xz
Adapt to skalibs-2.5.0.0
Diffstat (limited to 'src/clock')
-rw-r--r--src/clock/s6-clockadd.c4
-rw-r--r--src/clock/s6-sntpclock.c17
-rw-r--r--src/clock/s6-taiclock.c15
-rw-r--r--src/clock/s6-taiclockd.c12
4 files changed, 20 insertions, 28 deletions
diff --git a/src/clock/s6-clockadd.c b/src/clock/s6-clockadd.c
index 990f3ba..cd0dcbb 100644
--- a/src/clock/s6-clockadd.c
+++ b/src/clock/s6-clockadd.c
@@ -1,7 +1,7 @@
/* ISC license. */
#include <skalibs/sgetopt.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/strerr2.h>
#include <skalibs/tai.h>
@@ -19,7 +19,7 @@ int main (int argc, char const *const *argv)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "fe:", &l) ;
+ int opt = subgetopt_r(argc, argv, "fe:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/clock/s6-sntpclock.c b/src/clock/s6-sntpclock.c
index 22c6727..1044be5 100644
--- a/src/clock/s6-sntpclock.c
+++ b/src/clock/s6-sntpclock.c
@@ -1,17 +1,14 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint32.h>
#include <skalibs/uint64.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/allreadwrite.h>
-#include <skalibs/bytestr.h>
#include <skalibs/error.h>
#include <skalibs/strerr2.h>
#include <skalibs/tai.h>
@@ -26,12 +23,12 @@
static unsigned int verbosity = 1 ;
-int ntp_exchange (int s, ip46_t const *ip, uint16 port, tain_t *stamps, tain_t const *deadline)
+int ntp_exchange (int s, ip46_t const *ip, uint16_t port, tain_t *stamps, tain_t const *deadline)
{
char query[48] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" ;
char answer[48] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" ;
tain_t starttime ;
- uint64 ntpstamp ;
+ uint64_t ntpstamp ;
ip46_t dummyip ;
uint16_t dummyport ;
ssize_t r ;
@@ -54,7 +51,7 @@ int ntp_exchange (int s, ip46_t const *ip, uint16 port, tain_t *stamps, tain_t c
if (r < 48) return (errno = EPROTO, 0) ;
if (((answer[0] & 7) != 2) && ((answer[0] & 7) != 4)) return (errno = EPROTO, 0) ;
if (!(answer[0] & 56)) return (errno = EPROTO, 0) ;
- if (byte_diff(query+40, 8, answer+24)) return (errno = EPROTO, 0) ;
+ if (memcmp(query+40, answer+24, 8)) return (errno = EPROTO, 0) ;
stamps[0] = starttime ;
uint64_unpack_big(answer+32, &ntpstamp) ;
tain_from_ntp(stamps+1, ntpstamp) ;
@@ -100,7 +97,7 @@ int main (int argc, char const *const *argv)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "fv:r:t:h:T:e:p:", &l) ;
+ int opt = subgetopt_r(argc, argv, "fv:r:t:h:T:e:p:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -169,7 +166,7 @@ int main (int argc, char const *const *argv)
unsigned int j = 0 ;
for (; j < 4 ; j++)
{
- uint64 ntp ;
+ uint64_t ntp ;
localtmn_t l ;
char fmt[UINT_FMT] ;
char fmtntp[UINT64_XFMT] ;
diff --git a/src/clock/s6-taiclock.c b/src/clock/s6-taiclock.c
index bece37d..8ea58c1 100644
--- a/src/clock/s6-taiclock.c
+++ b/src/clock/s6-taiclock.c
@@ -1,16 +1,13 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint32.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/allreadwrite.h>
-#include <skalibs/bytestr.h>
#include <skalibs/strerr2.h>
#include <skalibs/tai.h>
#include <skalibs/djbtime.h>
@@ -27,7 +24,7 @@ static unsigned int verbosity = 1 ;
#define N 28
-int tain_exchange (int s, ip46_t const *ip, uint16 port, tain_t *serversays, tain_t const *deadline)
+int tain_exchange (int s, ip46_t const *ip, uint16_t port, tain_t *serversays, tain_t const *deadline)
{
char query[N] = "ctai" ;
char answer[N] ;
@@ -42,8 +39,8 @@ int tain_exchange (int s, ip46_t const *ip, uint16 port, tain_t *serversays, tai
r = socket_recvnb46_g(s, answer, N, &dummyip, &dummyport, deadline) ;
if (r < 0) return 0 ;
if (r < N) return (errno = EPROTO, 0) ;
- if (byte_diff(answer, 4, "stai")) return (errno = EPROTO, 0) ;
- if (byte_diff(query+20, N-20, answer+20)) return (errno = EPROTO, 0) ;
+ if (memcmp(answer, "stai", 4)) return (errno = EPROTO, 0) ;
+ if (memcmp(query+20, answer+20, N-20)) return (errno = EPROTO, 0) ;
tain_unpack(answer+4, serversays) ;
return 1 ;
}
@@ -72,7 +69,7 @@ int main (int argc, char const *const *argv)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "fv:r:t:h:T:e:p:", &l) ;
+ int opt = subgetopt_r(argc, argv, "fv:r:t:h:T:e:p:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/clock/s6-taiclockd.c b/src/clock/s6-taiclockd.c
index 0477ec5..504c4fc 100644
--- a/src/clock/s6-taiclockd.c
+++ b/src/clock/s6-taiclockd.c
@@ -1,12 +1,10 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <stdint.h>
-#include <skalibs/uint16.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
-#include <skalibs/fmtscan.h>
#include <skalibs/djbunix.h>
#include <skalibs/socket.h>
#include <skalibs/tai.h>
@@ -24,7 +22,7 @@ int main (int argc, char const *const *argv)
PROG = "s6-taiclockd" ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "i:p:", &l) ;
+ int opt = subgetopt_r(argc, argv, "i:p:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -43,8 +41,8 @@ int main (int argc, char const *const *argv)
for (;;)
{
char packet[256] ;
- register ssize_t r = socket_recv46(s, packet, 256, &ip, &port) ;
- if ((r >= 20) && !byte_diff(packet, 4, "ctai"))
+ ssize_t r = socket_recv46(s, packet, 256, &ip, &port) ;
+ if ((r >= 20) && !memcmp(packet, "ctai", 4))
{
tain_t now ;
packet[0] = 's' ;