Index · Directives · Python · libudev · gudev systemd 209

## Name

sd_bus_label_escape, sd_bus_label_unescape — Escape D-Bus object path special characters

## Synopsis

    #include <systemd/sd-bus.h>

`char *sd_bus_label_escape(` | const char *s`)`;

`char *sd_bus_label_unescape(` | const char *f`)`;

## Description

`sd_bus_label_escape()` takes a `NUL`-terminated string as a argument. It will replace all characters which are invalid in a D-Bus object path by "`_`" and a hexadecimal number. As a special case, the empty string will be replaced by a lone "`_`". `sd_bus_label_unescape()` can be used to reverse this process.

## Return Value

On success, a new `NUL`-terminated string will be returned. It must be free(3)d by the caller. If a memory allocation failure occurs, `NULL` will be returned.

## Notes

`sd_bus_label_escape()` and `sd_bus_label_unescape()` are available as a shared library, which can be compiled and linked to with the `libsystemd` pkg-config(1) file.

## See Also

systemd(1), sd-bus(3), free(3)