Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nspr.h"
8 #include <stdio.h>
9 #include <stdlib.h>
11 int main(int argc, char **argv)
12 {
13 PRAddrInfo *ai;
14 void *iter;
15 PRNetAddr addr;
17 ai = PR_GetAddrInfoByName(argv[1], PR_AF_UNSPEC, PR_AI_ADDRCONFIG);
18 if (ai == NULL) {
19 fprintf(stderr, "PR_GetAddrInfoByName failed: (%d, %d)\n",
20 PR_GetError(), PR_GetOSError());
21 exit(1);
22 }
23 printf("%s\n", PR_GetCanonNameFromAddrInfo(ai));
24 iter = NULL;
25 while ((iter = PR_EnumerateAddrInfo(iter, ai, 0, &addr)) != NULL) {
26 char buf[128];
27 PR_NetAddrToString(&addr, buf, sizeof buf);
28 printf("%s\n", buf);
29 }
30 PR_FreeAddrInfo(ai);
31 return 0;
32 }