~ubuntu-branches/ubuntu/trusty/systemd/trusty

« back to all changes in this revision

Viewing changes to man/sd_id128_from_string.html

Tags: upstream-202
Import upstream version 202

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_id128_to_string</title><meta name="generator" content="DocBook XSL Stylesheets V1.77.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><a href="index.html">Index </a>·
 
2
  <a href="systemd.directives.html">Directives </a>·
 
3
  <a href="../python-systemd/index.html">Python </a>·
 
4
  <a href="../libudev/index.html">libudev </a>·
 
5
  <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 202</span><hr><div class="refentry"><a name="sd_id128_to_string"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_id128_to_string, sd_id128_from_string — Format or parse 128 bit IDs as strings</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;systemd/sd-id128.h&gt;</pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">char* <b class="fsfunc">sd_id128_to_string</b>(</code></td><td>sd_id128_t <var class="pdparam">id</var>, char <var class="pdparam">s</var>[33]<code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_id128_from_string</b>(</code></td><td>const char <var class="pdparam">s</var>[33], sd_id128_t* <var class="pdparam">ret</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp3964784"></a><h2>Description</h2><p><code class="function">sd_id128_to_string()</code>
 
6
                formats a 128 bit ID as character string. It expects
 
7
                the ID and a string array capable of storing 33
 
8
                characters. The ID will be formatted as 32 lowercase
 
9
                hexadecimal digits and be terminated by a NUL
 
10
                byte.</p><p><code class="function">sd_id128_from_string()</code>
 
11
                implements the reverse operation: it takes a 33
 
12
                character array with 32 hexadecimal digits
 
13
                (terminated by NUL) and parses them back into an
 
14
                128 bit ID returned in
 
15
                <em class="parameter"><code>ret</code></em>.</p><p>For more information about the
 
16
                <code class="literal">sd_id128_t</code> type see
 
17
                <a href="sd-id128.html"><span class="citerefentry"><span class="refentrytitle">sd-id128</span>(3)</span></a>.</p><p>When formatting a 128 bit ID into a string it is
 
18
                often easier to use a format string for
 
19
                <a href="printf.html"><span class="citerefentry"><span class="refentrytitle">printf</span>(3)</span></a>. This
 
20
                is easily done using the
 
21
                <code class="function">SD_ID128_FORMAT_STR</code> and
 
22
                <code class="function">SD_ID128_FORMAT_VAL()</code> macros. For
 
23
                more information see
 
24
                <a href="sd-id128.html"><span class="citerefentry"><span class="refentrytitle">sd-id128</span>(3)</span></a>.</p></div><div class="refsect1"><a name="idp24752"></a><h2>Return Value</h2><p><code class="function">sd_id128_to_string()</code> always
 
25
                succeeds and returns a pointer to the string array
 
26
                passed in.  <code class="function">sd_id128_from_string</code>
 
27
                returns 0 on success (in which case
 
28
                <em class="parameter"><code>ret</code></em> is filled in), or a negative
 
29
                errno-style error code.</p></div><div class="refsect1"><a name="idp27952"></a><h2>Notes</h2><p>The <code class="function">sd_id128_to_string()</code>
 
30
                and <code class="function">sd_id128_from_string()</code> interfaces are
 
31
                available as shared library, which can be compiled and
 
32
                linked to with the <code class="literal">libsystemd-id128</code>
 
33
                <a href="pkg-config.html"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
 
34
                file.</p></div><div class="refsect1"><a name="idp32240"></a><h2>See Also</h2><p>
 
35
                        <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
 
36
                        <a href="sd-id128.html"><span class="citerefentry"><span class="refentrytitle">sd-id128</span>(3)</span></a>,
 
37
                        <a href="printf.html"><span class="citerefentry"><span class="refentrytitle">printf</span>(3)</span></a>
 
38
                </p></div></div></body></html>