1SD_ID128_TO_STRING(3)         sd_id128_to_string         SD_ID128_TO_STRING(3)
2
3
4

NAME

6       sd_id128_to_string, sd_id128_from_string - Format or parse 128-bit IDs
7       as strings
8

SYNOPSIS

10       #include <systemd/sd-id128.h>
11
12       char *sd_id128_to_string(sd_id128_t id, char s[33]);
13
14       int sd_id128_from_string(const char *s, sd_id128_t *ret);
15

DESCRIPTION

17       sd_id128_to_string() formats a 128-bit ID as a character string. It
18       expects the ID and a string array capable of storing 33 characters. The
19       ID will be formatted as 32 lowercase hexadecimal digits and be
20       terminated by a NUL byte.
21
22       sd_id128_from_string() implements the reverse operation: it takes a 33
23       character string with 32 hexadecimal digits (either lowercase or
24       uppercase, terminated by NUL) and parses them back into a 128-bit ID
25       returned in ret. Alternatively, this call can also parse a 37-character
26       string with a 128-bit ID formatted as RFC UUID. If ret is passed as
27       NULL the function will validate the passed ID string, but not actually
28       return it in parsed form.
29
30       For more information about the "sd_id128_t" type see sd-id128(3). Note
31       that these calls operate the same way on all architectures, i.e. the
32       results do not depend on endianness.
33
34       When formatting a 128-bit ID into a string, it is often easier to use a
35       format string for printf(3). This is easily done using the
36       SD_ID128_FORMAT_STR and SD_ID128_FORMAT_VAL() macros. For more
37       information see sd-id128(3).
38

RETURN VALUE

40       sd_id128_to_string() always succeeds and returns a pointer to the
41       string array passed in.  sd_id128_from_string returns 0 on success, in
42       which case ret is filled in, or a negative errno-style error code.
43

NOTES

45       These APIs are implemented as a shared library, which can be compiled
46       and linked to with the libsystemd pkg-config(1) file.
47

SEE ALSO

49       systemd(1), sd-id128(3), printf(3)
50
51
52
53systemd 241                                              SD_ID128_TO_STRING(3)
Impressum