SD_BUS_LABEL_ESCAPE(3)

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)