chiark / gitweb /
libsystemd-bus: rename to libsystemd
[elogind.git] / man / sd_bus_label_escape.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 systemd.
7
8 Copyright 2014 Zbigniew Jędrzejewski-Szmek
9
10 systemd 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 systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="sd_bus_label_escape">
25
26   <refentryinfo>
27     <title>sd_bus_label_escape</title>
28     <productname>systemd</productname>
29
30     <authorgroup>
31       <author>
32         <contrib>A monkey with a typewriter</contrib>
33         <firstname>Zbigniew</firstname>
34         <surname>Jędrzejewski-Szmek</surname>
35         <email>zbyszek@in.waw.pl</email>
36       </author>
37     </authorgroup>
38   </refentryinfo>
39
40   <refmeta>
41     <refentrytitle>sd_bus_label_escape</refentrytitle>
42     <manvolnum>3</manvolnum>
43   </refmeta>
44
45   <refnamediv>
46     <refname>sd_bus_label_escape</refname>
47     <refname>sd_bus_label_unescape</refname>
48
49     <refpurpose>Escape D-Bus object path special characters</refpurpose>
50   </refnamediv>
51
52   <refsynopsisdiv>
53     <funcsynopsis>
54       <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
55
56       <funcprototype>
57         <funcdef>char* <function>sd_bus_label_escape</function></funcdef>
58         <paramdef>const char* <parameter>s</parameter></paramdef>
59       </funcprototype>
60
61       <funcprototype>
62         <funcdef>char* <function>sd_bus_label_unescape</function></funcdef>
63         <paramdef>const char* <parameter>f</parameter></paramdef>
64       </funcprototype>
65     </funcsynopsis>
66   </refsynopsisdiv>
67
68   <refsect1>
69     <title>Description</title>
70
71     <para><function>sd_bus_label_escape()</function> takes a
72     <constant>NUL</constant>-terminated string as a argument. It will
73     replace all characters which are invalid in a D-Bus object path by
74     <literal>_</literal> and a hexadecimal number. As a special case,
75     the empty string will be replaced by a lone <literal>_</literal>.
76     <function>sd_bus_label_unescape()</function> can be used to
77     reverse this process.</para>
78   </refsect1>
79
80   <refsect1>
81     <title>Return Value</title>
82
83     <para>On success, a new <constant>NUL</constant>-terminated string
84     will be returned. It must be
85     <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>d
86     by the caller. If a memory allocation failure occurs,
87     <constant>NULL</constant> will be returned.
88     </para>
89   </refsect1>
90
91   <refsect1>
92     <title>Notes</title>
93
94     <para><function>sd_bus_label_escape()</function> and
95     <function>sd_bus_label_unescape()</function> are available as a
96     shared library, which can be compiled and linked to with the
97     <constant>libsystemd</constant> <citerefentry><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry>
98     file.</para>
99   </refsect1>
100
101   <refsect1>
102     <title>See Also</title>
103
104     <para>
105       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
106       <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
107       <citerefentry><refentrytitle>free</refentrytitle><manvolnum>3</manvolnum></citerefentry>
108     </para>
109   </refsect1>
110
111 </refentry>