resolvectl: fix indentation of hexdump'ed packets
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 17 Apr 2020 16:29:23 +0000 (18:29 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 30 May 2020 17:54:13 +0000 (19:54 +0200)
commit3e3a31743a45859a79132e4d6a2b1cc95b31d12b
treeb6d992f2bc9fe36ebcc66efa619d8ee6e511e2db
parent6576058fab75adfda72e24a2a79d266fcbb37be5
resolvectl: fix indentation of hexdump'ed packets

ebf963c551e1077abaa5e0fa0f330e6d1c23565e changed the 'sep' argument to always
be either " " or "\n", which broke the indentation logic for the first line
in base64_append_width(). Since it now always is one character, and never NULL,
let's change the type to char and simplify the logic a bit.

$ COLUMNS=30 build/test-dns-packet test/test-resolve/org~20200417.pkts
============== test/test-resolve/org~20200417.pkts ==============
org IN DNSKEY 256 3 RSASHA1-NSEC3-SHA1
        AwEAAcLPVEcg0hFBheXQf
        QOqqLiRgckk69o2KTAsq3
        lNRY0c9mnEjzZDGsGmXNy
        2EQ6yelkIYYus7KLor2Fz
        x59hEqcM82zqkdHV6hXvZ
        yjxxSHG3nl8xQS6gF8mdI
        YouDTWWhTInfjSKoIeDok
        Hq3S67EjSngV7/wVCMTbI
        amS0NF4H
        -- Flags: ZONE_KEY
        -- Key tag: 37022
...

$ COLUMNS=120 build/test-dns-packet test/test-resolve/org~20200417.pkts
============== test/test-resolve/org~20200417.pkts ==============
org IN DNSKEY 256 3 RSASHA1-NSEC3-SHA1 AwEAAcLPVEcg0hFBheXQfQOqqLiRgckk69o2KTAsq3lNRY0c9mnEjzZDGsGmXNy2EQ6yelkIYYus7KLor
                                       2Fzx59hEqcM82zqkdHV6hXvZyjxxSHG3nl8xQS6gF8mdIYouDTWWhTInfjSKoIeDokHq3S67EjSngV7/w
                                       VCMTbIamS0NF4H
        -- Flags: ZONE_KEY
        -- Key tag: 37022
...

(cherry picked from commit 0136b1d1e091809065cfa5c9824664cacfdb5655)
src/basic/hexdecoct.c