46 lines
1.4 KiB
Diff
46 lines
1.4 KiB
Diff
From db7fb3f1965751444c3b743ba0253061fd7e3b44 Mon Sep 17 00:00:00 2001
|
|
From: Mathieu Schroeter <mathieu@schroetersa.ch>
|
|
Date: Tue, 8 Aug 2023 23:42:56 +0200
|
|
Subject: [PATCH] Add utility to convert an unsigned int to string
|
|
|
|
Conflict:contaxt adapt in include/utiles.h due to ebe23249ce1eeedb3610890e4c0c0f52fb8341fe
|
|
Reference:https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit?id=db7fb3f1965751444c3b743ba0253061fd7e3b44
|
|
|
|
|
|
Signed-off-by: Mathieu Schroeter <mathieu@schroetersa.ch>
|
|
Signed-off-by: David Ahern <dsahern@kernel.org>
|
|
---
|
|
include/utils.h | 1 +
|
|
lib/utils.c | 6 ++++++
|
|
2 files changed, 7 insertions(+)
|
|
|
|
diff --git a/include/utils.h b/include/utils.h
|
|
index cf11174d9..f26ed822f 100644
|
|
--- a/include/utils.h
|
|
+++ b/include/utils.h
|
|
@@ -309,6 +309,7 @@ unsigned int print_name_and_link(const char *fmt,
|
|
int makeargs(char *line, char *argv[], int maxargs);
|
|
|
|
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);
|
|
|
|
diff --git a/lib/utils.c b/lib/utils.c
|
|
index 68f443038..efa01668d 100644
|
|
--- a/lib/utils.c
|
|
+++ b/lib/utils.c
|
|
@@ -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;
|