michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nspr.h" michael@0: michael@0: #include michael@0: #include michael@0: michael@0: int main(int argc, char **argv) michael@0: { michael@0: PRAddrInfo *ai; michael@0: void *iter; michael@0: PRNetAddr addr; michael@0: michael@0: ai = PR_GetAddrInfoByName(argv[1], PR_AF_UNSPEC, PR_AI_ADDRCONFIG); michael@0: if (ai == NULL) { michael@0: fprintf(stderr, "PR_GetAddrInfoByName failed: (%d, %d)\n", michael@0: PR_GetError(), PR_GetOSError()); michael@0: exit(1); michael@0: } michael@0: printf("%s\n", PR_GetCanonNameFromAddrInfo(ai)); michael@0: iter = NULL; michael@0: while ((iter = PR_EnumerateAddrInfo(iter, ai, 0, &addr)) != NULL) { michael@0: char buf[128]; michael@0: PR_NetAddrToString(&addr, buf, sizeof buf); michael@0: printf("%s\n", buf); michael@0: } michael@0: PR_FreeAddrInfo(ai); michael@0: return 0; michael@0: }