]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
eb1f0e66 | 2 | |
f989d285 DDM |
3 | #include "libudev.h" |
4 | ||
5 | #include "forward.h" | |
07630cea | 6 | #include "device-nodes.h" |
eb1f0e66 | 7 | |
0bbe8838 KS |
8 | /** |
9 | * SECTION:libudev-util | |
10 | * @short_description: utils | |
21dbe43a KS |
11 | * |
12 | * Utilities useful when dealing with devices and device node names. | |
0bbe8838 KS |
13 | */ |
14 | ||
92f43136 | 15 | /** |
0bbe8838 | 16 | * udev_util_encode_string: |
92f43136 KS |
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 | |
21 | * | |
22 | * Encode all potentially unsafe characters of a string to the | |
0bbe8838 | 23 | * corresponding 2 char hex value prefixed by '\x'. |
92f43136 KS |
24 | * |
25 | * Returns: 0 if the entire string was copied, non-zero otherwise. | |
26 | **/ | |
1544d17f | 27 | _public_ int udev_util_encode_string(const char *str, char *str_enc, size_t len) { |
8f6ce71f | 28 | return encode_devnode_name(str, str_enc, len); |
92f43136 | 29 | } |