Damjan Marion | 8973b07 | 2022-03-01 15:51:18 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright(c) 2022 Cisco Systems, Inc. |
| 3 | */ |
| 4 | |
| 5 | #include <vlib/vlib.h> |
| 6 | #include <vlib/unix/unix.h> |
| 7 | #include <vlib/stats/stats.h> |
| 8 | |
| 9 | u8 * |
| 10 | format_vlib_stats_symlink (u8 *s, va_list *args) |
| 11 | { |
Damjan Marion | c5d81b9 | 2022-04-15 15:53:17 +0200 | [diff] [blame] | 12 | u8 *input = va_arg (*args, u8 *); |
Damjan Marion | 8973b07 | 2022-03-01 15:51:18 +0100 | [diff] [blame] | 13 | |
Damjan Marion | c5d81b9 | 2022-04-15 15:53:17 +0200 | [diff] [blame] | 14 | for (int i = 0; i < vec_len (input); i++) |
| 15 | if (input[i] == '/') |
| 16 | vec_add1 (s, '_'); |
| 17 | else |
| 18 | vec_add1 (s, input[i]); |
Damjan Marion | 8973b07 | 2022-03-01 15:51:18 +0100 | [diff] [blame] | 19 | |
Damjan Marion | c5d81b9 | 2022-04-15 15:53:17 +0200 | [diff] [blame] | 20 | return s; |
Damjan Marion | 8973b07 | 2022-03-01 15:51:18 +0100 | [diff] [blame] | 21 | } |