diff options
Diffstat (limited to 'src/clients')
-rw-r--r-- | src/clients/s6-dnsip4-filter.c | 6 | ||||
-rw-r--r-- | src/clients/s6-dnsip4.c | 14 | ||||
-rw-r--r-- | src/clients/s6-dnsip6-filter.c | 6 | ||||
-rw-r--r-- | src/clients/s6-dnsip6.c | 14 | ||||
-rw-r--r-- | src/clients/s6-dnsmx.c | 16 | ||||
-rw-r--r-- | src/clients/s6-dnsname-filter.c | 6 | ||||
-rw-r--r-- | src/clients/s6-dnsname.c | 10 | ||||
-rw-r--r-- | src/clients/s6-dnsns.c | 12 | ||||
-rw-r--r-- | src/clients/s6-dnsq.c | 18 | ||||
-rw-r--r-- | src/clients/s6-dnsqr.c | 9 | ||||
-rw-r--r-- | src/clients/s6-dnsqualify.c | 8 | ||||
-rw-r--r-- | src/clients/s6-dnssoa.c | 14 | ||||
-rw-r--r-- | src/clients/s6-dnssrv.c | 27 | ||||
-rw-r--r-- | src/clients/s6-dnstxt.c | 9 | ||||
-rw-r--r-- | src/clients/s6-randomip.c | 6 | ||||
-rw-r--r-- | src/clients/s6dns_generic_filter_main.c | 21 | ||||
-rw-r--r-- | src/clients/s6dns_namescanner.c | 2 |
17 files changed, 96 insertions, 102 deletions
diff --git a/src/clients/s6-dnsip4-filter.c b/src/clients/s6-dnsip4-filter.c index 6d6862e..d403f35 100644 --- a/src/clients/s6-dnsip4-filter.c +++ b/src/clients/s6-dnsip4-filter.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include <skalibs/bytestr.h> +#include <string.h> #include <skalibs/fmtscan.h> #include <skalibs/strerr2.h> #include <skalibs/stralloc.h> @@ -23,7 +23,7 @@ static int s6dns_message_parse_answer_a1 (s6dns_message_rr_t const *rr, char con { s6dns_a1_t *data = stuff ; if (data->got) return 1 ; - byte_copy(data->ip, 4, packet+pos) ; + memcpy(data->ip, packet+pos, 4) ; data->got = 1 ; } (void)packetlen ; @@ -34,7 +34,7 @@ static int ipformatter (stralloc *sa, char const *packet, unsigned int packetlen { s6dns_a1_t data ; s6dns_message_header_t h ; - register int r ; + int r ; data.got = 0 ; r = s6dns_message_parse(&h, packet, packetlen, &s6dns_message_parse_answer_a1, &data) ; if (r <= 0) return r ; diff --git a/src/clients/s6-dnsip4.c b/src/clients/s6-dnsip4.c index 1f1eb28..5d5ef54 100644 --- a/src/clients/s6-dnsip4.c +++ b/src/clients/s6-dnsip4.c @@ -1,11 +1,11 @@ /* ISC license. */ -#include <sys/types.h> +#include <string.h> #include <errno.h> -#include <skalibs/uint.h> +#include <skalibs/types.h> #include <skalibs/sgetopt.h> -#include <skalibs/bytestr.h> #include <skalibs/strerr2.h> +#include <skalibs/stralloc.h> #include <skalibs/buffer.h> #include <skalibs/tai.h> #include <skalibs/random.h> @@ -26,7 +26,7 @@ int main (int argc, char const *const *argv) for (;;) { - register int opt = subgetopt(argc, argv, "qrt:") ; + int opt = subgetopt(argc, argv, "qrt:") ; if (opt == -1) break ; switch (opt) { @@ -44,7 +44,7 @@ int main (int argc, char const *const *argv) tain_add_g(&deadline, &deadline) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { - register int r = s6dns_resolve_a_g(&ips, argv[0], str_len(argv[0]), flagqualify, &deadline) ; + int r = s6dns_resolve_a_g(&ips, argv[0], strlen(argv[0]), flagqualify, &deadline) ; if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ; if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ; } @@ -53,9 +53,9 @@ int main (int argc, char const *const *argv) for (i = 0 ; i < ips.len / 4 ; i++) { char fmt[IP4_FMT] ; - register size_t n = ip4_fmt(fmt, ips.s + 4 * i) ; + size_t n = ip4_fmt(fmt, ips.s + 4 * i) ; fmt[n++] = '\n' ; - if (buffer_put(buffer_1small, fmt, n) < (int)n) + if (buffer_put(buffer_1small, fmt, n) < (ssize_t)n) strerr_diefu1sys(111, "write to stdout") ; } if (!buffer_flush(buffer_1small)) diff --git a/src/clients/s6-dnsip6-filter.c b/src/clients/s6-dnsip6-filter.c index a5c7418..09b8b20 100644 --- a/src/clients/s6-dnsip6-filter.c +++ b/src/clients/s6-dnsip6-filter.c @@ -1,6 +1,6 @@ /* ISC license. */ -#include <skalibs/bytestr.h> +#include <string.h> #include <skalibs/fmtscan.h> #include <skalibs/strerr2.h> #include <skalibs/stralloc.h> @@ -23,7 +23,7 @@ static int s6dns_message_parse_answer_aaaa1 (s6dns_message_rr_t const *rr, char { s6dns_aaaa1_t *data = stuff ; if (data->got) return 1 ; - byte_copy(data->ip, 16, packet+pos) ; + memcpy(data->ip, packet+pos, 16) ; data->got = 1 ; } (void)packetlen ; @@ -34,7 +34,7 @@ static int ipformatter (stralloc *sa, char const *packet, unsigned int packetlen { s6dns_aaaa1_t data ; s6dns_message_header_t h ; - register int r ; + int r ; data.got = 0 ; r = s6dns_message_parse(&h, packet, packetlen, &s6dns_message_parse_answer_aaaa1, &data) ; if (r <= 0) return r ; diff --git a/src/clients/s6-dnsip6.c b/src/clients/s6-dnsip6.c index a948b49..62c337b 100644 --- a/src/clients/s6-dnsip6.c +++ b/src/clients/s6-dnsip6.c @@ -1,11 +1,11 @@ /* ISC license. */ -#include <sys/types.h> +#include <string.h> #include <errno.h> -#include <skalibs/uint.h> +#include <skalibs/types.h> #include <skalibs/sgetopt.h> -#include <skalibs/bytestr.h> #include <skalibs/strerr2.h> +#include <skalibs/stralloc.h> #include <skalibs/buffer.h> #include <skalibs/tai.h> #include <skalibs/random.h> @@ -26,7 +26,7 @@ int main (int argc, char const *const *argv) for (;;) { - register int opt = subgetopt(argc, argv, "qrt:") ; + int opt = subgetopt(argc, argv, "qrt:") ; if (opt == -1) break ; switch (opt) { @@ -44,7 +44,7 @@ int main (int argc, char const *const *argv) tain_add_g(&deadline, &deadline) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { - register int r = s6dns_resolve_aaaa_g(&ips, argv[0], str_len(argv[0]), flagqualify, &deadline) ; + int r = s6dns_resolve_aaaa_g(&ips, argv[0], strlen(argv[0]), flagqualify, &deadline) ; if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ; if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ; } @@ -53,9 +53,9 @@ int main (int argc, char const *const *argv) for (i = 0 ; i < ips.len / 16 ; i++) { char fmt[IP6_FMT] ; - register size_t n = ip6_fmt(fmt, ips.s + 16 * i) ; + size_t n = ip6_fmt(fmt, ips.s + 16 * i) ; fmt[n++] = '\n' ; - if (buffer_put(buffer_1small, fmt, n) < (int)n) + if (buffer_put(buffer_1small, fmt, n) < (ssize_t)n) strerr_diefu1sys(111, "write to stdout") ; } if (!buffer_flush(buffer_1small)) diff --git a/src/clients/s6-dnsmx.c b/src/clients/s6-dnsmx.c index 5b8359c..41fe089 100644 --- a/src/clients/s6-dnsmx.c +++ b/src/clients/s6-dnsmx.c @@ -1,10 +1,8 @@ /* ISC license. */ -#include <sys/types.h> +#include <string.h> #include <errno.h> -#include <skalibs/uint16.h> -#include <skalibs/uint.h> -#include <skalibs/bytestr.h> +#include <skalibs/types.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> #include <skalibs/buffer.h> @@ -27,7 +25,7 @@ int main (int argc, char const *const *argv) PROG = "s6-dnsmx" ; for (;;) { - register int opt = subgetopt(argc, argv, "qrt:") ; + int opt = subgetopt(argc, argv, "qrt:") ; if (opt == -1) break ; switch (opt) { @@ -45,7 +43,7 @@ int main (int argc, char const *const *argv) tain_add_g(&deadline, &deadline) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { - register int r = s6dns_resolve_mx_g(&mxs, argv[0], str_len(argv[0]), flagqualify, &deadline) ; + int r = s6dns_resolve_mx_g(&mxs, argv[0], strlen(argv[0]), flagqualify, &deadline) ; if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ; if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ; } @@ -54,10 +52,10 @@ int main (int argc, char const *const *argv) for (i = 0 ; i < genalloc_len(s6dns_message_rr_mx_t, &mxs) ; i++) { char buf[S6DNS_FMT_MX] ; - register size_t len = s6dns_fmt_mx(buf, S6DNS_FMT_MX, genalloc_s(s6dns_message_rr_mx_t, &mxs) + i) ; + size_t len = s6dns_fmt_mx(buf, S6DNS_FMT_MX, genalloc_s(s6dns_message_rr_mx_t, &mxs) + i) ; if (!len) strerr_diefu1sys(111, "format result") ; - if (buffer_put(buffer_1, buf, len) < 0) goto err ; - if (buffer_put(buffer_1, "\n", 1) < 0) goto err ; + if (buffer_put(buffer_1, buf, len) < (ssize_t)len) goto err ; + if (buffer_put(buffer_1, "\n", 1) < 1) goto err ; } if (!buffer_flush(buffer_1)) goto err ; return 0 ; diff --git a/src/clients/s6-dnsname-filter.c b/src/clients/s6-dnsname-filter.c index 0edbe7a..95869be 100644 --- a/src/clients/s6-dnsname-filter.c +++ b/src/clients/s6-dnsname-filter.c @@ -16,7 +16,7 @@ static size_t ipscanner (s6dns_domain_t *d, char const *s) { char ip[16] ; - register size_t pos ; + size_t pos ; if (flag6) { pos = ip6_scan(s, ip) ; @@ -53,7 +53,7 @@ static int s6dns_message_parse_answer_domain1 (s6dns_message_rr_t const *rr, cha if ((section == 2) && (rr->rtype == S6DNS_T_PTR)) { s6dns_domain1_t *data = stuff ; - register unsigned int start = pos ; + unsigned int start = pos ; if (data->got) return 1 ; if (!s6dns_message_get_domain(&data->d, packet, packetlen, &pos)) return 0 ; if (rr->rdlength != pos - start) return (errno = EPROTO, 0) ; @@ -66,7 +66,7 @@ static int domainformatter (stralloc *sa, char const *packet, unsigned int packe { s6dns_domain1_t data ; s6dns_message_header_t h ; - register int r ; + int r ; data.got = 0 ; r = s6dns_message_parse(&h, packet, packetlen, &s6dns_message_parse_answer_domain1, &data) ; if (r <= 0) return r ; diff --git a/src/clients/s6-dnsname.c b/src/clients/s6-dnsname.c index 103edad..87debde 100644 --- a/src/clients/s6-dnsname.c +++ b/src/clients/s6-dnsname.c @@ -2,7 +2,7 @@ #include <sys/types.h> #include <errno.h> -#include <skalibs/uint.h> +#include <skalibs/types.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> #include <skalibs/buffer.h> @@ -28,7 +28,7 @@ int main (int argc, char const *const *argv) PROG = "s6-dnsname" ; for (;;) { - register int opt = subgetopt(argc, argv, "46rt:") ; + int opt = subgetopt(argc, argv, "46rt:") ; if (opt == -1) break ; switch (opt) { @@ -58,7 +58,7 @@ int main (int argc, char const *const *argv) tain_add_g(&deadline, &deadline) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { - register int r = ip.is6 ? s6dns_resolve_name6_g(&ds, ip.ip, &deadline) : s6dns_resolve_name4_g(&ds, ip.ip, &deadline) ; + int r = ip.is6 ? s6dns_resolve_name6_g(&ds, ip.ip, &deadline) : s6dns_resolve_name4_g(&ds, ip.ip, &deadline) ; if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ; if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ; } @@ -68,9 +68,9 @@ int main (int argc, char const *const *argv) char buf[S6DNS_FMT_DOMAINLIST(genalloc_len(s6dns_domain_t, &ds))] ; size_t len = s6dns_fmt_domainlist(buf, S6DNS_FMT_DOMAINLIST(genalloc_len(s6dns_domain_t, &ds)), genalloc_s(s6dns_domain_t, &ds), genalloc_len(s6dns_domain_t, &ds), "\n", 1) ; if (!len) strerr_diefu1sys(111, "format result") ; - if (buffer_put(buffer_1, buf, len) < 0) goto err ; + if (buffer_put(buffer_1, buf, len) < (ssize_t)len) goto err ; } - if (buffer_putflush(buffer_1, "\n", 1) < 0) goto err ; + if (buffer_putflush(buffer_1, "\n", 1) < 1) goto err ; return 0 ; err: strerr_diefu1sys(111, "write to stdout") ; diff --git a/src/clients/s6-dnsns.c b/src/clients/s6-dnsns.c index 6e86b89..b54ff24 100644 --- a/src/clients/s6-dnsns.c +++ b/src/clients/s6-dnsns.c @@ -1,9 +1,9 @@ /* ISC license. */ #include <sys/types.h> +#include <string.h> #include <errno.h> -#include <skalibs/uint.h> -#include <skalibs/bytestr.h> +#include <skalibs/types.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> #include <skalibs/buffer.h> @@ -25,7 +25,7 @@ int main (int argc, char const *const *argv) PROG = "s6-dnsns" ; for (;;) { - register int opt = subgetopt(argc, argv, "qrt:") ; + int opt = subgetopt(argc, argv, "qrt:") ; if (opt == -1) break ; switch (opt) { @@ -43,7 +43,7 @@ int main (int argc, char const *const *argv) tain_add_g(&deadline, &deadline) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { - register int r = s6dns_resolve_ns_g(&ds, argv[0], str_len(argv[0]), flagqualify, &deadline) ; + int r = s6dns_resolve_ns_g(&ds, argv[0], strlen(argv[0]), flagqualify, &deadline) ; if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ; if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ; } @@ -53,9 +53,9 @@ int main (int argc, char const *const *argv) char buf[S6DNS_FMT_DOMAINLIST(genalloc_len(s6dns_domain_t, &ds))] ; size_t len = s6dns_fmt_domainlist(buf, S6DNS_FMT_DOMAINLIST(genalloc_len(s6dns_domain_t, &ds)), genalloc_s(s6dns_domain_t, &ds), genalloc_len(s6dns_domain_t, &ds), "\n", 1) ; if (!len) strerr_diefu1sys(111, "format result") ; - if (buffer_put(buffer_1, buf, len) < 0) goto err ; + if (buffer_put(buffer_1, buf, len) < (ssize_t)len) goto err ; } - if (buffer_putflush(buffer_1, "\n", 1) < 0) goto err ; + if (buffer_putflush(buffer_1, "\n", 1) < 1) goto err ; return 0 ; err: strerr_diefu1sys(111, "write to stdout") ; diff --git a/src/clients/s6-dnsq.c b/src/clients/s6-dnsq.c index 538c925..9f36716 100644 --- a/src/clients/s6-dnsq.c +++ b/src/clients/s6-dnsq.c @@ -1,11 +1,9 @@ /* ISC license. */ -#include <sys/types.h> +#include <string.h> #include <stdint.h> #include <errno.h> -#include <skalibs/uint16.h> -#include <skalibs/uint.h> -#include <skalibs/bytestr.h> +#include <skalibs/types.h> #include <skalibs/bitarray.h> #include <skalibs/strerr2.h> #include <skalibs/sgetopt.h> @@ -32,7 +30,7 @@ int main (int argc, char const *const *argv) unsigned int t = 0 ; for (;;) { - register int opt = subgetopt_r(argc, argv, "12t:D:", &l) ; + int opt = subgetopt_r(argc, argv, "12t:D:", &l) ; if (opt == -1) break ; switch (opt) { @@ -54,21 +52,21 @@ int main (int argc, char const *const *argv) unsigned int i = 0, j = 0 ; qtype = s6dns_analyze_qtype_parse(argv[0]) ; if (!qtype) dieusage() ; - if (!s6dns_domain_fromstring_noqualify_encode(&d, argv[1], str_len(argv[1]))) + if (!s6dns_domain_fromstring_noqualify_encode(&d, argv[1], strlen(argv[1]))) strerr_diefu2sys(100, "encode ", argv[1]) ; dbh.external = where ; - byte_zero(&servers, sizeof(s6dns_ip46list_t)) ; + memset(&servers, 0, sizeof(s6dns_ip46list_t)) ; for (; (i < (unsigned int)(argc - 2)) && (j < S6DNS_MAX_SERVERS) ; i++) { ip46_t z[S6DNS_MAX_SERVERS] ; - unsigned int n ; /* XXX: depends on ip46_scanlist API */ - register unsigned int k = 0 ; + size_t n ; + unsigned int k = 0 ; if (!*argv[2+i]) continue ; if (!ip46_scanlist(z, S6DNS_MAX_SERVERS - j, argv[2 + i], &n)) strerr_diefu2sys(100, "make an IP address list out of ", argv[2+i]) ; for (; k < n ; k++) { - byte_copy(s6dns_ip46list_ip(&servers, j + k), SKALIBS_IP_SIZE, z[k].ip) ; + memcpy(s6dns_ip46list_ip(&servers, j + k), z[k].ip, SKALIBS_IP_SIZE) ; #ifdef SKALIBS_IPV6_ENABLED if (ip46_is6(z + k)) bitarray_set(servers.is6, j + k) ; #endif diff --git a/src/clients/s6-dnsqr.c b/src/clients/s6-dnsqr.c index f1bb896..ed66ff9 100644 --- a/src/clients/s6-dnsqr.c +++ b/src/clients/s6-dnsqr.c @@ -1,10 +1,9 @@ /* ISC license. */ +#include <string.h> #include <stdint.h> #include <errno.h> -#include <skalibs/uint16.h> -#include <skalibs/uint.h> -#include <skalibs/bytestr.h> +#include <skalibs/types.h> #include <skalibs/strerr2.h> #include <skalibs/sgetopt.h> #include <skalibs/buffer.h> @@ -28,7 +27,7 @@ int main (int argc, char const *const *argv) unsigned int t = 0 ; for (;;) { - register int opt = subgetopt_r(argc, argv, "12t:D:", &l) ; + int opt = subgetopt_r(argc, argv, "12t:D:", &l) ; if (opt == -1) break ; switch (opt) { @@ -48,7 +47,7 @@ int main (int argc, char const *const *argv) s6dns_domain_t d ; uint16_t qtype = s6dns_analyze_qtype_parse(argv[0]) ; if (!qtype) dieusage() ; - if (!s6dns_domain_fromstring_noqualify_encode(&d, argv[1], str_len(argv[1]))) + if (!s6dns_domain_fromstring_noqualify_encode(&d, argv[1], strlen(argv[1]))) strerr_diefu2sys(100, "encode ", argv[1]) ; dbh.external = where ; if (debuglevel & 1) dbh.post_recv = &s6dns_debug_dumpdt_post_recv ; diff --git a/src/clients/s6-dnsqualify.c b/src/clients/s6-dnsqualify.c index 94405db..74d1c9b 100644 --- a/src/clients/s6-dnsqualify.c +++ b/src/clients/s6-dnsqualify.c @@ -1,7 +1,7 @@ /* ISC license. */ #include <sys/types.h> -#include <skalibs/bytestr.h> +#include <string.h> #include <skalibs/strerr2.h> #include <skalibs/buffer.h> #include <s6-dns/s6dns.h> @@ -14,7 +14,7 @@ int main (int argc, char const *const *argv) s6dns_domain_t d ; PROG = "s6-dnsqualify" ; if (argc < 2) dieusage() ; - if (!s6dns_domain_fromstring(&d, argv[1], str_len(argv[1]))) + if (!s6dns_domain_fromstring(&d, argv[1], strlen(argv[1]))) strerr_diefu2sys(100, "make a domain name from ", argv[1]) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { @@ -25,10 +25,10 @@ int main (int argc, char const *const *argv) char buf[S6DNS_FMT_DOMAINLIST(n)] ; size_t len = s6dns_fmt_domainlist(buf, S6DNS_FMT_DOMAINLIST(n), list, n, "\n", 1) ; if (!len) strerr_diefu1sys(111, "format result") ; - if (buffer_put(buffer_1, buf, len) < 0) goto err ; + if (buffer_put(buffer_1, buf, len) < (ssize_t)len) goto err ; } } - if (buffer_putflush(buffer_1, "\n", 1) < 0) goto err ; + if (buffer_putflush(buffer_1, "\n", 1) < 1) goto err ; return 0 ; err: strerr_diefu1sys(111, "write to stdout") ; diff --git a/src/clients/s6-dnssoa.c b/src/clients/s6-dnssoa.c index e620c85..68fa4d4 100644 --- a/src/clients/s6-dnssoa.c +++ b/src/clients/s6-dnssoa.c @@ -1,9 +1,9 @@ /* ISC license. */ #include <sys/types.h> +#include <string.h> #include <errno.h> -#include <skalibs/uint.h> -#include <skalibs/bytestr.h> +#include <skalibs/types.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> #include <skalibs/buffer.h> @@ -26,7 +26,7 @@ int main (int argc, char const *const *argv) PROG = "s6-dnssoa" ; for (;;) { - register int opt = subgetopt(argc, argv, "qrt:") ; + int opt = subgetopt(argc, argv, "qrt:") ; if (opt == -1) break ; switch (opt) { @@ -44,7 +44,7 @@ int main (int argc, char const *const *argv) tain_add_g(&deadline, &deadline) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { - register int r = s6dns_resolve_soa_g(&soas, argv[0], str_len(argv[0]), flagqualify, &deadline) ; + int r = s6dns_resolve_soa_g(&soas, argv[0], strlen(argv[0]), flagqualify, &deadline) ; if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ; if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ; } @@ -53,10 +53,10 @@ int main (int argc, char const *const *argv) for (i = 0 ; i < genalloc_len(s6dns_message_rr_soa_t, &soas) ; i++) { char buf[S6DNS_FMT_SOA] ; - register size_t len = s6dns_fmt_soa(buf, S6DNS_FMT_SOA, genalloc_s(s6dns_message_rr_soa_t, &soas) + i) ; + size_t len = s6dns_fmt_soa(buf, S6DNS_FMT_SOA, genalloc_s(s6dns_message_rr_soa_t, &soas) + i) ; if (!len) strerr_diefu1sys(111, "format result") ; - if (buffer_put(buffer_1, buf, len) < 0) goto err ; - if (buffer_put(buffer_1, "\n", 1) < 0) goto err ; + if (buffer_put(buffer_1, buf, len) < (ssize_t)len) goto err ; + if (buffer_put(buffer_1, "\n", 1) < 1) goto err ; } if (!buffer_flush(buffer_1)) goto err ; return 0 ; diff --git a/src/clients/s6-dnssrv.c b/src/clients/s6-dnssrv.c index 47f5df0..ecc3db6 100644 --- a/src/clients/s6-dnssrv.c +++ b/src/clients/s6-dnssrv.c @@ -1,9 +1,9 @@ /* ISC license. */ #include <sys/types.h> +#include <string.h> #include <errno.h> -#include <skalibs/uint.h> -#include <skalibs/bytestr.h> +#include <skalibs/types.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> #include <skalibs/buffer.h> @@ -26,7 +26,7 @@ int main (int argc, char const *const *argv) PROG = "s6-dnssrv" ; for (;;) { - register int opt = subgetopt(argc, argv, "qt:") ; + int opt = subgetopt(argc, argv, "qt:") ; if (opt == -1) break ; switch (opt) { @@ -44,19 +44,20 @@ int main (int argc, char const *const *argv) tain_add_g(&deadline, &deadline) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { - size_t n0 = str_len(argv[0]) ; - size_t n1 = str_len(argv[1]) ; - size_t n2 = str_len(argv[2]) ; + size_t n0 = strlen(argv[0]) ; + size_t n1 = strlen(argv[1]) ; + size_t n2 = strlen(argv[2]) ; + int r ; char name[n0 + n1 + n2 + 5] ; name[0] = '_' ; - byte_copy(name + 1, n0, argv[0]) ; + memcpy(name + 1, argv[0], n0) ; name[n0 + 1] = '.' ; name[n0 + 2] = '_' ; - byte_copy(name + n0 + 3, n1, argv[1]) ; + memcpy(name + n0 + 3, argv[1], n1) ; name[n0 + n1 + 3] = '.' ; - byte_copy(name + n0 + n1 + 4, n2, argv[2]) ; + memcpy(name + n0 + n1 + 4, argv[2], n2) ; name[n0 + n1 + n2 + 4] = 0 ; - register int r = s6dns_resolve_srv_g(&srvs, name, n0 + n1 + n2 + 4, flagqualify, &deadline) ; + r = s6dns_resolve_srv_g(&srvs, name, n0 + n1 + n2 + 4, flagqualify, &deadline) ; if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ; if (!r) strerr_diefu4x(2, "resolve ", name, ": ", s6dns_constants_error_str(errno)) ; } @@ -65,10 +66,10 @@ int main (int argc, char const *const *argv) for (i = 0 ; i < genalloc_len(s6dns_message_rr_srv_t, &srvs) ; i++) { char buf[S6DNS_FMT_SRV] ; - register size_t len = s6dns_fmt_srv(buf, S6DNS_FMT_SRV, genalloc_s(s6dns_message_rr_srv_t, &srvs) + i) ; + size_t len = s6dns_fmt_srv(buf, S6DNS_FMT_SRV, genalloc_s(s6dns_message_rr_srv_t, &srvs) + i) ; if (!len) strerr_diefu1sys(111, "format result") ; - if (buffer_put(buffer_1, buf, len) < 0) goto err ; - if (buffer_put(buffer_1, "\n", 1) < 0) goto err ; + if (buffer_put(buffer_1, buf, len) < (ssize_t)len) goto err ; + if (buffer_put(buffer_1, "\n", 1) < 1) goto err ; } if (!buffer_flush(buffer_1)) goto err ; return 0 ; diff --git a/src/clients/s6-dnstxt.c b/src/clients/s6-dnstxt.c index 5ee1427..df5aee1 100644 --- a/src/clients/s6-dnstxt.c +++ b/src/clients/s6-dnstxt.c @@ -1,9 +1,8 @@ /* ISC license. */ -#include <sys/types.h> +#include <string.h> #include <errno.h> -#include <skalibs/uint.h> -#include <skalibs/bytestr.h> +#include <skalibs/types.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> #include <skalibs/buffer.h> @@ -31,7 +30,7 @@ int main (int argc, char const *const *argv) PROG = "s6-dnstxt" ; for (;;) { - register int opt = subgetopt(argc, argv, "qrt:") ; + int opt = subgetopt(argc, argv, "qrt:") ; if (opt == -1) break ; switch (opt) { @@ -49,7 +48,7 @@ int main (int argc, char const *const *argv) tain_add(&deadline, &deadline, &stamp) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { - register int r = s6dns_resolve_txt(&sa, &offsets, argv[0], str_len(argv[0]), flagqualify, &deadline, &stamp) ; + int r = s6dns_resolve_txt(&sa, &offsets, argv[0], strlen(argv[0]), flagqualify, &deadline, &stamp) ; if (r < 0) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "resolve ", argv[0]) ; if (!r) strerr_diefu4x(2, "resolve ", argv[0], ": ", s6dns_constants_error_str(errno)) ; } diff --git a/src/clients/s6-randomip.c b/src/clients/s6-randomip.c index 95ce042..7103443 100644 --- a/src/clients/s6-randomip.c +++ b/src/clients/s6-randomip.c @@ -2,7 +2,7 @@ #include <sys/types.h> #include <errno.h> -#include <skalibs/uint.h> +#include <skalibs/types.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> #include <skalibs/buffer.h> @@ -23,7 +23,7 @@ int main (int argc, char const *const *argv) PROG = "s6-randomip" ; for (;;) { - register int opt = subgetopt(argc, argv, "46n:") ; + int opt = subgetopt(argc, argv, "46n:") ; if (opt == -1) break ; switch (opt) { @@ -51,7 +51,7 @@ int main (int argc, char const *const *argv) random_string(ip, len) ; len = (len == 16) ? ip6_fmt(fmt, ip) : ip4_fmt(fmt, ip) ; fmt[len++] = '\n' ; - if (buffer_put(buffer_1, fmt, len) < (int)len) + if (buffer_put(buffer_1, fmt, len) < (ssize_t)len) strerr_diefu1sys(111, "write to stdout") ; } if (!buffer_flush(buffer_1)) diff --git a/src/clients/s6dns_generic_filter_main.c b/src/clients/s6dns_generic_filter_main.c index 6d51e67..ba9534e 100644 --- a/src/clients/s6dns_generic_filter_main.c +++ b/src/clients/s6dns_generic_filter_main.c @@ -4,8 +4,7 @@ #include <stdint.h> #include <errno.h> #include <skalibs/error.h> -#include <skalibs/uint16.h> -#include <skalibs/uint.h> +#include <skalibs/types.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> #include <skalibs/env.h> @@ -57,7 +56,7 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co unsigned int t = 0 ; for (;;) { - register int opt = subgetopt_r(argc, argv, (qtype == S6DNS_T_PTR) ? "46l:c:t:f:e:" : "l:c:t:f:e:", &l) ; + int opt = subgetopt_r(argc, argv, (qtype == S6DNS_T_PTR) ? "46l:c:t:f:e:" : "l:c:t:f:e:", &l) ; if (opt == -1) break ; switch (opt) { @@ -127,18 +126,18 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co if (x[2].revents) { - register int j = 0 ; - register uint16_t const *list ; + int j = 0 ; + uint16_t const *list ; int n = skadns_update(&a) ; if (n < 0) strerr_diefu1sys(111, "skadns_update") ; list = skadns_list(&a) ; for (; j < n ; j++) { - register uint16_t i = lineindex[list[j]] ; - register char const *packet = skadns_packet(&a, list[j]) ; + uint16_t i = lineindex[list[j]] ; + char const *packet = skadns_packet(&a, list[j]) ; if (packet) { - register int r ; + int r ; r = (*formatter)(&storage[i].swrd, packet, skadns_packetlen(&a, list[j])) ; if (r < 0) strerr_diefu1sys(111, "format skadns answer") ; if (!r) storage[i].dpos = -errno ; @@ -159,8 +158,8 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co for (; (numlines < maxlines) && (pending < maxconn) ; lhead = (lhead+1) % (maxlines+1), numlines++) { s6dns_domain_t d ; - register line_t *line = storage + lhead ; - register int r = skagetln(buffer_0, &line->swrd, '\n') ; + line_t *line = storage + lhead ; + int r = skagetln(buffer_0, &line->swrd, '\n') ; if (r < 0) { if (error_isagain(errno)) break ; @@ -211,7 +210,7 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co for (; ltail != lhead ; ltail = (ltail+1) % (maxlines+1), numlines--) { char *args[4] ; - register line_t *line = storage + ltail ; + line_t *line = storage + ltail ; if (line->pending) break ; args[0] = line->swrd.s ; args[1] = line->dpos < 0 ? (char *)s6dns_constants_error_str(-line->dpos) : line->swrd.s + line->dpos ; diff --git a/src/clients/s6dns_namescanner.c b/src/clients/s6dns_namescanner.c index c2110d2..2df6aae 100644 --- a/src/clients/s6dns_namescanner.c +++ b/src/clients/s6dns_namescanner.c @@ -8,7 +8,7 @@ size_t s6dns_namescanner (s6dns_domain_t *d, char const *s) { - register size_t pos = 0 ; + size_t pos = 0 ; while (s[pos] && (s[pos] != ' ') && (s[pos] != '\t') && (s[pos] != '\r') && (s[pos] != '\n')) pos++ ; if (pos > UINT_MAX) return (errno = ENAMETOOLONG, 0) ; if (!s6dns_domain_fromstring_noqualify_encode(d, s, pos)) return 0 ; |