summaryrefslogtreecommitdiff
path: root/src/libs6dns/s6dns_fmt_hinfo.c
blob: 2389926259cc1044e914fccd02fa39cb8aaadda3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* ISC license. */

#include <sys/types.h>
#include <errno.h>
#include <skalibs/bytestr.h>
#include <s6-dns/s6dns-message.h>
#include <s6-dns/s6dns-fmt.h>

size_t s6dns_fmt_hinfo (char *s, size_t max, s6dns_message_rr_hinfo_t const *hinfo)
{
  if (hinfo->cpu.len + 1 + hinfo->os.len > max) return (errno = ENAMETOOLONG, 0) ;
  byte_copy(s, hinfo->cpu.len, hinfo->cpu.s) ;
  s[hinfo->cpu.len] = ' ' ;
  byte_copy(s + hinfo->cpu.len + 1, hinfo->os.len, hinfo->os.s) ;
  return hinfo->cpu.len + 1 + hinfo->os.len ;
}