2011-09-20 20:51:46 +02:00
|
|
|
/*
|
2018-10-31 17:54:59 +01:00
|
|
|
* Copyright 2003-2018 The Music Player Daemon Project
|
2011-09-20 20:51:46 +02:00
|
|
|
* http://www.musicpd.org
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
}
|