blob: 268a80e35de596919543ca90e42a619368de204f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
/* See LICENSE file for copyright and license details. */
#include "libcmap.h"
#include <stdio.h>
int
libcmap_snprint_range(char *buf, size_t bufsize, const struct libcmap_range *range, const char *endash)
{
unsigned long int first = (unsigned long int)range->first;
unsigned long int last = (unsigned long int)range->last;
if (first == last)
return snprintf(buf, bufsize, "U+%04lX", first);
else
return snprintf(buf, bufsize, "U+%04lX%sU+%04lX", first, endash ? endash : "–", last);
}
|