diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-01-12 15:35:29 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-01-12 15:35:29 +0000 |
commit | 3f9536c5cc9ed6659ad2514859bd1716cbf7b26b (patch) | |
tree | 3f01ca46f59b9458c93ace3f07127d1e2bb460e8 /src/clients/s6-dnstxt.c | |
parent | 3a289d1ca8dd2bce4a8bb6549709ea62262ec786 (diff) | |
download | s6-dns-3f9536c5cc9ed6659ad2514859bd1716cbf7b26b.tar.xz |
Types fix, first pass.
Some places marked XXX for the skalibs API change.
Diffstat (limited to 'src/clients/s6-dnstxt.c')
-rw-r--r-- | src/clients/s6-dnstxt.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/clients/s6-dnstxt.c b/src/clients/s6-dnstxt.c index fde69d2..5ee1427 100644 --- a/src/clients/s6-dnstxt.c +++ b/src/clients/s6-dnstxt.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include <sys/types.h> #include <errno.h> #include <skalibs/uint.h> #include <skalibs/bytestr.h> @@ -20,10 +21,11 @@ int main (int argc, char const *const *argv) { stralloc quoted = STRALLOC_ZERO ; stralloc sa = STRALLOC_ZERO ; - genalloc offsets = GENALLOC_ZERO ; /* array of unsigned int */ + genalloc offsets = GENALLOC_ZERO ; /* array of size_t */ tain_t deadline, stamp ; - unsigned int n ; - unsigned int i = 0 ; + size_t n ; + size_t i = 0 ; + unsigned int t = 0 ; int flagqualify = 0 ; int flagunsort = 0 ; PROG = "s6-dnstxt" ; @@ -35,7 +37,7 @@ int main (int argc, char const *const *argv) { case 'q' : flagqualify = 1 ; break ; case 'r' : flagunsort = 1 ; break ; - case 't' : if (!uint0_scan(subgetopt_here.arg, &i)) dieusage() ; break ; + case 't' : if (!uint0_scan(subgetopt_here.arg, &t)) dieusage() ; break ; default : dieusage() ; } } @@ -43,7 +45,7 @@ int main (int argc, char const *const *argv) if (argc < 1) dieusage() ; tain_now(&stamp) ; - if (i) tain_from_millisecs(&deadline, i) ; else deadline = tain_infinite_relative ; + if (t) tain_from_millisecs(&deadline, t) ; else deadline = tain_infinite_relative ; tain_add(&deadline, &deadline, &stamp) ; if (!s6dns_init()) strerr_diefu1sys(111, "s6dns_init") ; { @@ -51,21 +53,21 @@ int main (int argc, char const *const *argv) 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)) ; } - n = genalloc_len(unsigned int, &offsets) ; + n = genalloc_len(size_t, &offsets) ; if (!n) return 1 ; { - unsigned int printable_offsets[n] ; + size_t printable_offsets[n] ; for (i = 0 ; i < n ; i++) { - unsigned int beg = genalloc_s(unsigned int, &offsets)[i] ; - unsigned int end = (i < n-1 ? genalloc_s(unsigned int, &offsets)[i+1] : sa.len) - 1 ; + size_t beg = genalloc_s(size_t, &offsets)[i] ; + size_t end = (i < n-1 ? genalloc_s(size_t, &offsets)[i+1] : sa.len) - 1 ; printable_offsets[i] = quoted.len ; if (!string_quote("ed, sa.s + beg, end - beg) || !stralloc_0("ed)) strerr_diefu2sys(111, "quote ", sa.s + beg) ; } - genalloc_free(unsigned int, &offsets) ; + genalloc_free(size_t, &offsets) ; stralloc_free(&sa) ; - if (flagunsort) random_unsort((char *)printable_offsets, n, sizeof(unsigned int)) ; + if (flagunsort) random_unsort((char *)printable_offsets, n, sizeof(size_t)) ; for (i = 0 ; i < n ; i++) if ((buffer_puts(buffer_1small, quoted.s + printable_offsets[i]) < 0) || (buffer_put(buffer_1small, "\n", 1) < 1)) |