]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/libudev/libudev-util.c
5ee9ebd03e463b02f65538cb5219d0370d5762b7
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
6 #include "device-nodes.h"
10 * @short_description: utils
12 * Utilities useful when dealing with devices and device node names.
16 * udev_util_encode_string:
17 * @str: input string to be encoded
18 * @str_enc: output string to store the encoded input string
19 * @len: maximum size of the output string, which may be
20 * four times as long as the input string
22 * Encode all potentially unsafe characters of a string to the
23 * corresponding 2 char hex value prefixed by '\x'.
25 * Returns: 0 if the entire string was copied, non-zero otherwise.
27 _public_
int udev_util_encode_string(const char *str
, char *str_enc
, size_t len
) {
28 return encode_devnode_name(str
, str_enc
, len
);