summaryrefslogtreecommitdiffstats
path: root/src/vlib/stats/format.c
blob: 419ff6b4657140ebcb830a729a92fb83f28155f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;
}