]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
Add utility to convert an unsigned int to string
authorMathieu Schroeter <mathieu@schroetersa.ch>
Tue, 8 Aug 2023 21:42:56 +0000 (23:42 +0200)
committerDavid Ahern <dsahern@kernel.org>
Sun, 13 Aug 2023 16:24:32 +0000 (10:24 -0600)
Signed-off-by: Mathieu Schroeter <mathieu@schroetersa.ch>
Signed-off-by: David Ahern <dsahern@kernel.org>
include/utils.h
lib/utils.c

index cf11174d9ad309e5da8098e3d3e5e2260e49c629..f26ed822f3099bc5a6c7ca7257e7864969232e58 100644 (file)
@@ -309,6 +309,7 @@ unsigned int print_name_and_link(const char *fmt,
 extern int cmdlineno;
 
 char *int_to_str(int val, char *buf);
+char *uint_to_str(unsigned int val, char *buf);
 int get_guid(__u64 *guid, const char *arg);
 int get_real_family(int rtm_type, int rtm_family);
 
index 68f44303894de3b5b847c35f7c9d143b48028766..efa01668d797c69ef1b3896d5f86c36ffb6ac4c7 100644 (file)
@@ -1409,6 +1409,12 @@ char *int_to_str(int val, char *buf)
        return buf;
 }
 
+char *uint_to_str(unsigned int val, char *buf)
+{
+       sprintf(buf, "%u", val);
+       return buf;
+}
+
 int get_guid(__u64 *guid, const char *arg)
 {
        unsigned long tmp;