2023-03-06 14:42:04 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
// Copyright The Music Player Daemon Project
|
2011-09-20 20:51:46 +02:00
|
|
|
|
2015-02-10 21:46:23 +01:00
|
|
|
#include "net/Resolver.hxx"
|
2018-08-21 08:26:12 +02:00
|
|
|
#include "net/AddressInfo.hxx"
|
2015-07-22 10:03:36 +02:00
|
|
|
#include "net/ToString.hxx"
|
2015-02-10 20:30:10 +01:00
|
|
|
#include "net/SocketAddress.hxx"
|
2017-12-29 17:12:55 +01:00
|
|
|
#include "util/PrintException.hxx"
|
2013-08-10 18:02:44 +02:00
|
|
|
|
2017-12-19 10:56:23 +01:00
|
|
|
#include <exception>
|
2016-10-28 10:36:05 +02:00
|
|
|
|
2014-01-07 23:57:39 +01:00
|
|
|
#include <stdio.h>
|
2011-09-20 20:51:46 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
2016-10-28 10:36:05 +02:00
|
|
|
try {
|
2011-09-20 20:51:46 +02:00
|
|
|
if (argc != 2) {
|
2013-12-24 14:44:08 +01:00
|
|
|
fprintf(stderr, "Usage: run_resolver HOST\n");
|
2011-09-20 20:51:46 +02:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
2018-08-21 08:26:12 +02:00
|
|
|
for (const auto &i : Resolve(argv[1], 80, AI_PASSIVE, SOCK_STREAM)) {
|
|
|
|
printf("%s\n", ToString(i).c_str());
|
2011-09-20 20:51:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
2017-12-19 10:56:23 +01:00
|
|
|
} catch (...) {
|
2017-12-29 17:12:55 +01:00
|
|
|
PrintException(std::current_exception());
|
2016-10-28 10:36:05 +02:00
|
|
|
return EXIT_FAILURE;
|
2011-09-20 20:51:46 +02:00
|
|
|
}
|