dect
/
libnl
Archived
13
0
Fork 0
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.
libnl/src/nl-util-addr.c

35 lines
767 B
C
Raw Normal View History

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.
*
* Copyright (c) 2003-2009 Thomas Graf <tgraf@suug.ch>
2007-09-14 23:28:01 +00:00
*/
#include <netlink/cli/utils.h>
2007-09-14 23:28:01 +00:00
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;
}
a = nl_cli_addr_parse(argv[1], AF_UNSPEC);
2007-09-14 23:28:01 +00:00
err = nl_addr_resolve(a, host, sizeof(host));
if (err != 0)
nl_cli_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;
}