lib/fmt/SocketAddressFormatter: new library

This commit is contained in:
Max Kellermann
2023-09-19 11:17:48 +02:00
parent b36f5f1ec4
commit 64647edbe1
4 changed files with 35 additions and 17 deletions

View File

@@ -1,12 +1,14 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright The Music Player Daemon Project
#include "lib/fmt/SocketAddressFormatter.hxx"
#include "net/Resolver.hxx"
#include "net/AddressInfo.hxx"
#include "net/ToString.hxx"
#include "net/SocketAddress.hxx"
#include "util/PrintException.hxx"
#include <fmt/format.h>
#include <exception>
#include <stdio.h>
@@ -20,7 +22,7 @@ try {
}
for (const auto &i : Resolve(argv[1], 80, AI_PASSIVE, SOCK_STREAM)) {
printf("%s\n", ToString(i).c_str());
fmt::print("{}\n", i);
}
return EXIT_SUCCESS;