chiark / gitweb /
fs-util: change chase_symlinks() behaviour in regards to escaping the root dir
[elogind.git] / man / sd_id128_to_string.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6   This file is part of elogind.
7
8   Copyright 2012 Lennart Poettering
9
10   elogind is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14
15   elogind is distributed in the hope that it will be useful, but
16   WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with elogind; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="sd_id128_to_string">
25
26   <refentryinfo>
27     <title>sd_id128_to_string</title>
28     <productname>elogind</productname>
29
30     <authorgroup>
31       <author>
32         <contrib>Developer</contrib>
33         <firstname>Lennart</firstname>
34         <surname>Poettering</surname>
35         <email>lennart@poettering.net</email>
36       </author>
37     </authorgroup>
38   </refentryinfo>
39
40   <refmeta>
41     <refentrytitle>sd_id128_to_string</refentrytitle>
42     <manvolnum>3</manvolnum>
43   </refmeta>
44
45   <refnamediv>
46     <refname>sd_id128_to_string</refname>
47     <refname>sd_id128_from_string</refname>
48     <refpurpose>Format or parse 128-bit IDs as strings</refpurpose>
49   </refnamediv>
50
51   <refsynopsisdiv>
52     <funcsynopsis>
53       <funcsynopsisinfo>#include &lt;elogind/sd-id128.h&gt;</funcsynopsisinfo>
54
55       <funcprototype>
56         <funcdef>char *<function>sd_id128_to_string</function></funcdef>
57         <paramdef>sd_id128_t <parameter>id</parameter>, char <parameter>s</parameter>[33]</paramdef>
58       </funcprototype>
59
60       <funcprototype>
61         <funcdef>int <function>sd_id128_from_string</function></funcdef>
62         <paramdef>const char *<parameter>s</parameter>, sd_id128_t *<parameter>ret</parameter></paramdef>
63       </funcprototype>
64
65     </funcsynopsis>
66   </refsynopsisdiv>
67
68   <refsect1>
69     <title>Description</title>
70
71     <para><function>sd_id128_to_string()</function> formats a 128-bit
72     ID as a character string. It expects the ID and a string array
73     capable of storing 33 characters. The ID will be formatted as 32
74     lowercase hexadecimal digits and be terminated by a
75     <constant>NUL</constant> byte.</para>
76
77     <para><function>sd_id128_from_string()</function> implements the reverse operation: it takes a 33 character string
78     with 32 hexadecimal digits (either lowercase or uppercase, terminated by <constant>NUL</constant>) and parses them
79     back into a 128-bit ID returned in <parameter>ret</parameter>. Alternatively, this call can also parse a
80     37-character string with a 128-bit ID formatted as RFC UUID. If <parameter>ret</parameter> is passed as NULL the
81     function will validate the passed ID string, but not actually return it in parsed form.</para>
82
83     <para>For more information about the <literal>sd_id128_t</literal>
84     type see
85     <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
86     Note that these calls operate the same way on all architectures,
87     i.e. the results do not depend on endianness.</para>
88
89     <para>When formatting a 128-bit ID into a string, it is often
90     easier to use a format string for
91     <citerefentry project='man-pages'><refentrytitle>printf</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
92     This is easily done using the
93     <function>SD_ID128_FORMAT_STR</function> and
94     <function>SD_ID128_FORMAT_VAL()</function> macros. For more
95     information see
96     <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
97   </refsect1>
98
99   <refsect1>
100     <title>Return Value</title>
101
102     <para><function>sd_id128_to_string()</function> always succeeds
103     and returns a pointer to the string array passed in.
104     <function>sd_id128_from_string</function> returns 0 on success, in
105     which case <parameter>ret</parameter> is filled in, or a negative
106     errno-style error code.</para>
107   </refsect1>
108
109   <refsect1>
110     <title>Notes</title>
111
112     <para>The <function>sd_id128_to_string()</function> and
113     <function>sd_id128_from_string()</function> interfaces are
114     available as a shared library, which can be compiled and linked to
115     with the
116     <literal>libelogind</literal> <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
117     file.</para>
118   </refsect1>
119
120   <refsect1>
121     <title>See Also</title>
122
123     <para>
124       <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
125       <citerefentry><refentrytitle>sd-id128</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
126       <citerefentry project='man-pages'><refentrytitle>printf</refentrytitle><manvolnum>3</manvolnum></citerefentry>
127     </para>
128   </refsect1>
129
130 </refentry>