mdns_result_t TXT values may have a key and no value. Here is an excerpt of what is generated on my system by one of our printers the the second format specifier in line 140 is changed from %s to %p:
....
TXT : [15] txtvers=0x3ffbaa5c; note=0x0; rp=0x3ffbac98; qtotal=0x3ffc7460; priority=0x3ffbacc0; ty=0x3ffbacd0; product=0x3ffbacf8; pdl=0x3ffbad1c; adminurl=0x3ffbb50c; usb_MFG=0x3ffbb534; usb_MDL=0x3ffbb54c; UUID=0x3ffbb56c; Transparent=0x3ffbb5a8; Binary=0x3ffbb5bc; TBCP=0x3ffbb5d0;
....
Look at the second entry, "note." The value is NULL.
mdns_result_t TXT values may have a key and no value. Here is an excerpt of what is generated on my system by one of our printers the the second format specifier in line 140 is changed from %s to %p: .... TXT : [15] txtvers=0x3ffbaa5c; note=0x0; rp=0x3ffbac98; qtotal=0x3ffc7460; priority=0x3ffbacc0; ty=0x3ffbacd0; product=0x3ffbacf8; pdl=0x3ffbad1c; adminurl=0x3ffbb50c; usb_MFG=0x3ffbb534; usb_MDL=0x3ffbb54c; UUID=0x3ffbb56c; Transparent=0x3ffbb5a8; Binary=0x3ffbb5bc; TBCP=0x3ffbb5d0; ....
Look at the second entry, "note." The value is NULL.
A simple fix on line 140 alone:
printf("%s=%s; ", r->txt[t].key, r->txt[t].value);
to:
printf("%s=%p; ", r->txt[t].key, r->txt[t].value);
The %p format specifier allows for NULL. The %s format specifier does not. A slightly more user-friendly fix would be:
if (r->txt[t].value) { printf("%s=%s; ", r->txt[t].key, r->txt[t].value); } else { printf("%s=%p; ", r->txt[t].key, r->txt[t].value); }
If you do that then you get output like this instead of just addresses:
TXT : [26] txtvers=1; note=0x0; rp=ipp/print; qtotal=1; priority=40; ty=Xerox WorkCentre 6515DN; product=(Xerox WorkCentre 6515); pdl=application/octet-stream,image/urf,image/pwg-raster,image/jpeg,application/pdf; adminurl=http://XC6e1ff8.local/; usb_MFG=Xerox; usb_MDL=WorkCentre 6515; UUID=fe55c9a0-1dd1-11b2-92e7-9c934e6e1ff8; TLS=1.2; Transparent=T; Binary=T; TBCP=F; wfds-print=T; mopria-certified=1.3; URF=IS4-20,IFU20,OB10,CP255,DM1,MT1,PQ4-5,RS600,W8,SRGB24,V1.4,FN3; Color=T; Duplex=T; Fax=T; Scan=T; kind=document,envelope,label; PaperMax=legal-A4; rfo=ipp/faxout;