]> git.proxmox.com Git - systemd.git/blob - man/sd_id128_to_string.3
Imported Upstream version 214
[systemd.git] / man / sd_id128_to_string.3
1 '\" t
2 .TH "SD_ID128_TO_STRING" "3" "" "systemd 214" "sd_id128_to_string"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 sd_id128_to_string, sd_id128_from_string \- Format or parse 128\-bit IDs as strings
24 .SH "SYNOPSIS"
25 .sp
26 .ft B
27 .nf
28 #include <systemd/sd\-id128\&.h>
29 .fi
30 .ft
31 .HP \w'char\ *sd_id128_to_string('u
32 .BI "char *sd_id128_to_string(sd_id128_t\ " "id" ",\ char\ " "s" "[33]);"
33 .HP \w'int\ sd_id128_from_string('u
34 .BI "int sd_id128_from_string(const\ char\ *" "s" ",\ sd_id128_t\ *" "ret" ");"
35 .SH "DESCRIPTION"
36 .PP
37 \fBsd_id128_to_string()\fR
38 formats a 128\-bit ID as a character string\&. It expects the ID and a string array capable of storing 33 characters\&. The ID will be formatted as 32 lowercase hexadecimal digits and be terminated by a
39 \fBNUL\fR
40 byte\&.
41 .PP
42 \fBsd_id128_from_string()\fR
43 implements the reverse operation: it takes a 33 character string with 32 hexadecimal digits (either lowercase or uppercase, terminated by
44 \fBNUL\fR) and parses them back into a 128\-bit ID returned in
45 \fIret\fR\&. Alternatively, this call can also parse a 37\-character string with a 128\-bit ID formatted as RFC UUID\&.
46 .PP
47 For more information about the
48 "sd_id128_t"
49 type see
50 \fBsd-id128\fR(3)\&. Note that these calls operate the same way on all architectures, i\&.e\&. the results do not depend on endianness\&.
51 .PP
52 When formatting a 128\-bit ID into a string, it is often easier to use a format string for
53 \fBprintf\fR(3)\&. This is easily done using the
54 \fBSD_ID128_FORMAT_STR\fR
55 and
56 \fBSD_ID128_FORMAT_VAL()\fR
57 macros\&. For more information see
58 \fBsd-id128\fR(3)\&.
59 .SH "RETURN VALUE"
60 .PP
61 \fBsd_id128_to_string()\fR
62 always succeeds and returns a pointer to the string array passed in\&.
63 \fBsd_id128_from_string\fR
64 returns 0 on success, in which case
65 \fIret\fR
66 is filled in, or a negative errno\-style error code\&.
67 .SH "NOTES"
68 .PP
69 The
70 \fBsd_id128_to_string()\fR
71 and
72 \fBsd_id128_from_string()\fR
73 interfaces are available as a shared library, which can be compiled and linked to with the
74 "libsystemd"\ \&\fBpkg-config\fR(1)
75 file\&.
76 .SH "SEE ALSO"
77 .PP
78 \fBsystemd\fR(1),
79 \fBsd-id128\fR(3),
80 \fBprintf\fR(3)