This repository has been archived on 2022-02-17. You can view files and clone it, but cannot push or open issues or pull requests.
2007-09-14 23:28:01 +00:00
|
|
|
/*
|
|
|
|
* src/nl-util-addr.c Address Helper
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation version 2.1
|
|
|
|
* of the License.
|
|
|
|
*
|
2008-05-22 22:02:02 +00:00
|
|
|
* Copyright (c) 2003-2008 Thomas Graf <tgraf@suug.ch>
|
2007-09-14 23:28:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "utils.h"
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
char host[256];
|
|
|
|
struct nl_addr *a;
|
|
|
|
|
|
|
|
if (argc < 2) {
|
|
|
|
fprintf(stderr, "Usage: nl-util-addr <address>\n");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2008-05-22 22:02:02 +00:00
|
|
|
a = nlt_addr_parse(argv[1], AF_UNSPEC);
|
2007-09-14 23:28:01 +00:00
|
|
|
err = nl_addr_resolve(a, host, sizeof(host));
|
2008-05-22 22:02:02 +00:00
|
|
|
if (err != 0)
|
|
|
|
fatal(err, "Unable to resolve address \"%s\": %s",
|
|
|
|
argv[1], nl_geterror(err));
|
2007-09-14 23:28:01 +00:00
|
|
|
|
|
|
|
printf("%s\n", host);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|