summaryrefslogtreecommitdiffstats
path: root/src/vlib/stats/format.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2022-03-01 15:51:18 +0100
committerDamjan Marion <dmarion@me.com>2022-03-09 13:51:31 +0000
commit8973b07eecbbfe23a5267975f8052a5c6339c756 (patch)
treefe4d3507ff24c18743d3241cd9ab049ee2add062 /src/vlib/stats/format.c
parent317cace6185ae134d78a38e1a20249baf751035e (diff)
stats: refactor
Type: refactor Change-Id: Ifd533a095d979dc55bfbe5fac7e0b7510a4d900c Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib/stats/format.c')
-rw-r--r--src/vlib/stats/format.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/vlib/stats/format.c b/src/vlib/stats/format.c
new file mode 100644
index 00000000000..419ff6b4657
--- /dev/null
+++ b/src/vlib/stats/format.c
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: Apache-2.0
+ * Copyright(c) 2022 Cisco Systems, Inc.
+ */
+
+#include <vlib/vlib.h>
+#include <vlib/unix/unix.h>
+#include <vlib/stats/stats.h>
+
+u8 *
+format_vlib_stats_symlink (u8 *s, va_list *args)
+{
+ char *input = va_arg (*args, char *);
+ char *modified_input = vec_dup (input);
+ int i;
+ u8 *result;
+
+ for (i = 0; i < strlen (modified_input); i++)
+ if (modified_input[i] == '/')
+ modified_input[i] = '_';
+
+ result = format (s, "%s", modified_input);
+ vec_free (modified_input);
+ return result;
+}