build: Remove dependencies on fmtlib
With C++23, we can replace fmt::format with std::format and fmt::print
with stdplus::print. This allows us to migrate to std::print once the
support is available.
Change-Id: I790901fb3b96d815275a3919e1fb90973189fc02
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/subprojects/ncsid/src/net_config.cpp b/subprojects/ncsid/src/net_config.cpp
index 97c6a43..4e52cc8 100644
--- a/subprojects/ncsid/src/net_config.cpp
+++ b/subprojects/ncsid/src/net_config.cpp
@@ -14,7 +14,6 @@
#include "net_config.h"
-#include <fmt/format.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -22,6 +21,7 @@
#include <sdbusplus/bus.hpp>
#include <stdplus/fd/create.hpp>
#include <stdplus/fd/ops.hpp>
+#include <stdplus/print.hpp>
#include <stdplus/util/string.hpp>
#include <cstdio>
@@ -92,7 +92,7 @@
{
if (mac == nullptr)
{
- fmt::print(stderr, "mac is nullptr\n");
+ stdplus::println(stderr, "mac is nullptr");
return -1;
}
@@ -114,14 +114,14 @@
}
catch (const sdbusplus::exception::SdBusError& ex)
{
- fmt::print(stderr, "Failed to get MACAddress: {}\n", ex.what());
+ stdplus::println(stderr, "Failed to get MACAddress: {}", ex.what());
return -1;
}
if (parse_mac(mac_string, mac) < 0)
{
- fmt::print(stderr, "Failed to parse MAC Address `{}`\n",
- mac_string);
+ stdplus::println(stderr, "Failed to parse MAC Address `{}`",
+ mac_string);
return -1;
}
@@ -154,8 +154,8 @@
}
catch (const std::exception& ex)
{
- fmt::print(stderr, "Failed to set MAC Addr `{}` writing file: {}\n",
- std::get<std::string>(mac_value), ex.what());
+ stdplus::println(stderr, "Failed to set MAC Addr `{}` writing file: {}",
+ std::get<std::string>(mac_value), ex.what());
return -1;
}
@@ -165,8 +165,8 @@
}
catch (const sdbusplus::exception::SdBusError& ex)
{
- fmt::print(stderr, "Failed to set MAC Addr `{}`: {}\n",
- std::get<std::string>(mac_value), ex.what());
+ stdplus::println(stderr, "Failed to set MAC Addr `{}`: {}",
+ std::get<std::string>(mac_value), ex.what());
return -1;
}
@@ -215,7 +215,8 @@
}
catch (const sdbusplus::exception::SdBusError& ex)
{
- fmt::print(stderr, "Failed to set systemd nic status: {}\n", ex.what());
+ stdplus::println(stderr, "Failed to set systemd nic status: {}",
+ ex.what());
return 1;
}
}