Alien-cares

 view release on metacpan or  search on metacpan

libcares/aclocal.m4  view on Meta::CPAN

264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
if depmode=$depmode \
   source=sub/conftest.c object=$am__obj \
   depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
   $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
     >/dev/null 2>conftest.err &&
   grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
   grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
   grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
   ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
  # icc doesn't choke on unknown options, it will just issue warnings
  # or remarks (even with -Werror).  So we grep stderr for any message
  # that says an option was ignored or not supported.
  # When given -MP, icc 7.0 and 7.1 complain thusly:
  #   icc: Command line warning: ignoring option '-M'; no argument required
  # The diagnosis changed in icc 8.0:
  #   icc: Command line remark: option '-MP' not supported
  if (grep 'ignoring option' conftest.err ||
      grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
    am_cv_$1_dependencies_compiler_type=$depmode
    break
  fi

libcares/aclocal.m4  view on Meta::CPAN

1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
[ustar],
 [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
  # There is notably a 21 bits limit for the UID and the GID.  In fact,
  # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
  # and bug#13588).
  am_max_uid=2097151 # 2^21 - 1
  am_max_gid=$am_max_uid
  # The $UID and $GID variables are not portable, so we need to resort
  # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
  # below are definitely unexpected, so allow the users to see them
  # (that is, avoid stderr redirection).
  am_uid=`id -u || echo unknown`
  am_gid=`id -g || echo unknown`
  AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
  if test $am_uid -le $am_max_uid; then
     AC_MSG_RESULT([yes])
  else
     AC_MSG_RESULT([no])
     _am_tools=none
  fi
  AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])

libcares/acountry.c  view on Meta::CPAN

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
static void wait_ares(ares_channel channel);
static void callback(void *arg, int status, int timeouts, struct hostent *host);
static void callback2(void *arg, int status, int timeouts, struct hostent *host);
static void find_country_from_cname(const char *cname, struct in_addr addr);
 
static void Abort(const char *fmt, ...)
{
  va_list args;
  va_start(args, fmt);
  vfprintf(stderr, fmt, args);
  va_end(args);
  exit(1);
}
 
int main(int argc, char **argv)
{
  ares_channel channel;
  int    ch, status;
 
#if defined(WIN32) && !defined(WATT32)
  WORD wVersionRequested = MAKEWORD(USE_WINSOCK,USE_WINSOCK);
  WSADATA wsaData;
  WSAStartup(wVersionRequested, &wsaData);
#endif
 
  status = ares_library_init(ARES_LIB_INIT_ALL);
  if (status != ARES_SUCCESS)
    {
      fprintf(stderr, "ares_library_init: %s\n", ares_strerror(status));
      return 1;
    }
 
  while ((ch = ares_getopt(argc, argv, "dvh?")) != -1)
    switch (ch)
      {
      case 'd':
#ifdef WATT32
        dbug_init();
#endif

libcares/acountry.c  view on Meta::CPAN

130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
    }
 
argc -= optind;
argv += optind;
if (argc < 1)
   Abort(usage);
 
status = ares_init(&channel);
if (status != ARES_SUCCESS)
  {
    fprintf(stderr, "ares_init: %s\n", ares_strerror(status));
    return 1;
  }
 
/* Initiate the queries, one per command-line argument. */
for ( ; *argv; argv++)
  {
    struct in_addr addr;
    char buf[100];
 
    /* If this fails, assume '*argv' is a host-name that

libcares/adig.c  view on Meta::CPAN

191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#ifdef USE_WINSOCK
  WORD wVersionRequested = MAKEWORD(USE_WINSOCK,USE_WINSOCK);
  WSADATA wsaData;
  WSAStartup(wVersionRequested, &wsaData);
#endif
 
  status = ares_library_init(ARES_LIB_INIT_ALL);
  if (status != ARES_SUCCESS)
    {
      fprintf(stderr, "ares_library_init: %s\n", ares_strerror(status));
      return 1;
    }
 
  options.flags = ARES_FLAG_NOCHECKRESP;
  options.servers = NULL;
  options.nservers = 0;
  while ((c = ares_getopt(argc, argv, "df:s:c:t:T:U:")) != -1)
    {
      switch (c)
        {

libcares/adig.c  view on Meta::CPAN

226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
    options.flags |= flags[i].value;
  else
    usage();
  break;
 
case 's':
  /* User-specified name servers override default ones. */
  srvr = malloc(sizeof(struct ares_addr_node));
  if (!srvr)
    {
      fprintf(stderr, "Out of memory!\n");
      destroy_addr_list(servers);
      return 1;
    }
  append_addr_list(&servers, srvr);
  if (ares_inet_pton(AF_INET, optarg, &srvr->addr.addr4) > 0)
    srvr->family = AF_INET;
  else if (ares_inet_pton(AF_INET6, optarg, &srvr->addr.addr6) > 0)
    srvr->family = AF_INET6;
  else
    {
      hostent = gethostbyname(optarg);
      if (!hostent)
        {
          fprintf(stderr, "adig: server %s not found.\n", optarg);
          destroy_addr_list(servers);
          return 1;
        }
      switch (hostent->h_addrtype)
        {
          case AF_INET:
            srvr->family = AF_INET;
            memcpy(&srvr->addr.addr4, hostent->h_addr,
                   sizeof(srvr->addr.addr4));
            break;
          case AF_INET6:
            srvr->family = AF_INET6;
            memcpy(&srvr->addr.addr6, hostent->h_addr,
                   sizeof(srvr->addr.addr6));
            break;
          default:
            fprintf(stderr,
              "adig: server %s unsupported address family.\n", optarg);
            destroy_addr_list(servers);
            return 1;
        }
    }
  /* Notice that calling ares_init_options() without servers in the
   * options struct and with ARES_OPT_SERVERS set simultaneously in
   * the options mask, results in an initialization with no servers.
   * When alternative name servers have been specified these are set
   * later calling ares_set_servers() overriding any existing server

libcares/adig.c  view on Meta::CPAN

327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
  }
argc -= optind;
argv += optind;
if (argc == 0)
  usage();
 
status = ares_init_options(&channel, &options, optmask);
 
if (status != ARES_SUCCESS)
  {
    fprintf(stderr, "ares_init_options: %s\n",
            ares_strerror(status));
    return 1;
  }
 
if(servers)
  {
    status = ares_set_servers(channel, servers);
    destroy_addr_list(servers);
    if (status != ARES_SUCCESS)
      {
        fprintf(stderr, "ares_init_options: %s\n",
                ares_strerror(status));
        return 1;
      }
  }
 
/* Initiate the queries, one per command-line argument.  If there is
 * only one query to do, supply NULL as the callback argument;
 * otherwise, supply the query name as an argument so we can
 * distinguish responses for the user when printing them out.
 */

libcares/adig.c  view on Meta::CPAN

788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
  for (i = 0; i < nclasses; i++)
    {
      if (classes[i].value == dnsclass)
        return classes[i].name;
    }
  return "(unknown)";
}
 
static void usage(void)
{
  fprintf(stderr, "usage: adig [-f flag] [-s server] [-c class] "
          "[-t type] [-p port] name ...\n");
  exit(1);
}
 
static void destroy_addr_list(struct ares_addr_node *head)
{
  while(head)
    {
      struct ares_addr_node *detached = head;
      head = head->next;

libcares/ahost.c  view on Meta::CPAN

65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
  WORD wVersionRequested = MAKEWORD(USE_WINSOCK,USE_WINSOCK);
  WSADATA wsaData;
  WSAStartup(wVersionRequested, &wsaData);
#endif
 
  memset(&options, 0, sizeof(options));
 
  status = ares_library_init(ARES_LIB_INIT_ALL);
  if (status != ARES_SUCCESS)
    {
      fprintf(stderr, "ares_library_init: %s\n", ares_strerror(status));
      return 1;
    }
 
  while ((c = ares_getopt(argc,argv,"dt:hs:")) != -1)
    {
      switch (c)
        {
        case 'd':
#ifdef WATT32
          dbug_init();

libcares/ahost.c  view on Meta::CPAN

110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
  }
 
argc -= optind;
argv += optind;
if (argc < 1)
  usage();
 
status = ares_init_options(&channel, &options, optmask);
if (status != ARES_SUCCESS)
  {
    fprintf(stderr, "ares_init: %s\n", ares_strerror(status));
    return 1;
  }
 
/* Initiate the queries, one per command-line argument. */
for ( ; *argv; argv++)
  {
    if (ares_inet_pton(AF_INET, *argv, &addr4) == 1)
      {
        ares_gethostbyaddr(channel, &addr4, sizeof(addr4), AF_INET, callback,
                           *argv);

libcares/ahost.c  view on Meta::CPAN

168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
}
 
static void callback(void *arg, int status, int timeouts, struct hostent *host)
{
  char **p;
 
  (void)timeouts;
 
  if (status != ARES_SUCCESS)
    {
      fprintf(stderr, "%s: %s\n", (char *) arg, ares_strerror(status));
      return;
    }
 
  for (p = host->h_addr_list; *p; p++)
    {
      char addr_buf[46] = "??";
 
      ares_inet_ntop(host->h_addrtype, *p, addr_buf, sizeof(addr_buf));
      printf("%-32s\t%s", host->h_name, addr_buf);
#if 0

libcares/ahost.c  view on Meta::CPAN

194
195
196
197
198
199
200
201
202
203
204
205
206
           for (i = 0; host->h_aliases[i]; i++)
               printf("%s ", host->h_aliases[i]);
        }
#endif
      puts("");
    }
}
 
static void usage(void)
{
  fprintf(stderr, "usage: ahost [-t {a|aaaa|u}] {host|addr} ...\n");
  exit(1);
}

libcares/ares_getaddrinfo.c  view on Meta::CPAN

316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
  fp = fopen(PATH_HOSTS, "r");
  if (!fp)
    {
      error = ERRNO;
      switch(error)
        {
        case ENOENT:
        case ESRCH:
          return ARES_ENOTFOUND;
        default:
          DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
                         error, strerror(error)));
          DEBUGF(fprintf(stderr, "Error opening file: %s\n",
                         PATH_HOSTS));
          return ARES_EFILE;
        }
    }
  status = ares__get_addrinfo(fp, hquery->name, hquery->port, &hquery->hints, &hquery->ai);
  fclose(fp);
  return status;
}
 
/* Resolve service name into port number given in host byte order.

libcares/ares_gethostbyaddr.c  view on Meta::CPAN

218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
fp = fopen(PATH_HOSTS, "r");
if (!fp)
  {
    error = ERRNO;
    switch(error)
      {
      case ENOENT:
      case ESRCH:
        return ARES_ENOTFOUND;
      default:
        DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
                       error, strerror(error)));
        DEBUGF(fprintf(stderr, "Error opening file: %s\n",
                       PATH_HOSTS));
        *host = NULL;
        return ARES_EFILE;
      }
  }
while ((status = ares__get_hostent(fp, addr->family, host)) == ARES_SUCCESS)
  {
    if (addr->family != (*host)->h_addrtype)
      {
        ares_free_hostent(*host);

libcares/ares_gethostbyname.c  view on Meta::CPAN

390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
fp = fopen(PATH_HOSTS, "r");
if (!fp)
  {
    error = ERRNO;
    switch(error)
      {
      case ENOENT:
      case ESRCH:
        return ARES_ENOTFOUND;
      default:
        DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
                       error, strerror(error)));
        DEBUGF(fprintf(stderr, "Error opening file: %s\n",
                       PATH_HOSTS));
        *host = NULL;
        return ARES_EFILE;
      }
  }
while ((status = ares__get_hostent(fp, family, host)) == ARES_SUCCESS)
  {
    if (strcasecmp((*host)->h_name, name) == 0)
      break;
    for (alias = (*host)->h_aliases; *alias; alias++)

libcares/ares_getopt.c  view on Meta::CPAN

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
    (oli = strchr(ostr, optopt)) == NULL) {
    /*
     * if the user didn't specify '-' as an option,
     * assume it means EOF.
     */
    if (optopt == (int)'-')
        return (EOF);
    if (!*place)
        ++optind;
    if (opterr && *ostr != ':')
        (void)fprintf(stderr,
            "%s: illegal option -- %c\n", __FILE__, optopt);
    return (BADCH);
}
if (*++oli != ':') {                      /* don't need argument */
    optarg = NULL;
    if (!*place)
        ++optind;
}
else {                                    /* need an argument */
    if (*place)                           /* no white space */
        optarg = place;
    else if (nargc <= ++optind) {         /* no arg */
        place = EMSG;
        if (*ostr == ':')
            return (BADARG);
        if (opterr)
            (void)fprintf(stderr,
                "%s: option requires an argument -- %c\n",
                __FILE__, optopt);
        return (BADCH);
    }
     else                                 /* white space */
        optarg = nargv[optind];
    place = EMSG;
    ++optind;
}
return (optopt);                          /* dump back option letter */

libcares/ares_init.c  view on Meta::CPAN

188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
    {
      ares__init_list_head(&(channel->queries_by_timeout[i]));
    }
 
  /* Initialize configuration by each of the four sources, from highest
   * precedence to lowest.
   */
 
  status = init_by_options(channel, options, optmask);
  if (status != ARES_SUCCESS) {
    DEBUGF(fprintf(stderr, "Error: init_by_options failed: %s\n",
                   ares_strerror(status)));
    /* If we fail to apply user-specified options, fail the whole init process */
    goto done;
  }
  status = init_by_environment(channel);
  if (status != ARES_SUCCESS)
    DEBUGF(fprintf(stderr, "Error: init_by_environment failed: %s\n",
                   ares_strerror(status)));
  if (status == ARES_SUCCESS) {
    status = init_by_resolv_conf(channel);
    if (status != ARES_SUCCESS)
      DEBUGF(fprintf(stderr, "Error: init_by_resolv_conf failed: %s\n",
                     ares_strerror(status)));
  }
 
  /*
   * No matter what failed or succeeded, seed defaults to provide
   * useful behavior for things that we missed.
   */
  status = init_by_defaults(channel);
  if (status != ARES_SUCCESS)
    DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n",
                   ares_strerror(status)));
 
  /* Generate random key */
 
  if (status == ARES_SUCCESS) {
    status = init_id_key(&channel->id_key, ARES_ID_KEY_LEN);
    if (status == ARES_SUCCESS)
      channel->next_id = ares__generate_new_id(&channel->id_key);
    else
      DEBUGF(fprintf(stderr, "Error: init_id_key failed: %s\n",
                     ares_strerror(status)));
  }
 
done:
  if (status != ARES_SUCCESS)
    {
      /* Something failed; clean up memory we may have allocated. */
      if (channel->servers)
        ares_free(channel->servers);
      if (channel->ndomains != -1)

libcares/ares_init.c  view on Meta::CPAN

1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
  fclose(fp);
}
else {
  error = ERRNO;
  switch(error) {
  case ENOENT:
  case ESRCH:
    status = ARES_EOF;
    break;
  default:
    DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
                  error, strerror(error)));
    DEBUGF(fprintf(stderr, "Error opening file: %s\n", PATH_RESOLV_CONF));
    status = ARES_EFILE;
  }
}
 
if ((status == ARES_EOF) && (!channel->lookups)) {
  /* Many systems (Solaris, Linux, BSD's) use nsswitch.conf */
  fp = fopen("/etc/nsswitch.conf", "r");
  if (fp) {
    while ((status = ares__read_line(fp, &line, &linesize)) ==
           ARES_SUCCESS)

libcares/ares_init.c  view on Meta::CPAN

1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
    }
    fclose(fp);
  }
  else {
    error = ERRNO;
    switch(error) {
    case ENOENT:
    case ESRCH:
      break;
    default:
      DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
                     error, strerror(error)));
      DEBUGF(fprintf(stderr, "Error opening file: %s\n",
                     "/etc/nsswitch.conf"));
    }
 
    /* ignore error, maybe we will get luck in next if clause */
    status = ARES_EOF;
  }
}
 
if ((status == ARES_EOF) && (!channel->lookups)) {
  /* Linux / GNU libc 2.x and possibly others have host.conf */

libcares/ares_init.c  view on Meta::CPAN

1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
    }
    fclose(fp);
  }
  else {
    error = ERRNO;
    switch(error) {
    case ENOENT:
    case ESRCH:
      break;
    default:
      DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
                     error, strerror(error)));
      DEBUGF(fprintf(stderr, "Error opening file: %s\n",
                     "/etc/host.conf"));
    }
 
    /* ignore error, maybe we will get luck in next if clause */
    status = ARES_EOF;
  }
}
 
if ((status == ARES_EOF) && (!channel->lookups)) {
  /* Tru64 uses /etc/svc.conf */

libcares/ares_init.c  view on Meta::CPAN

1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
      }
      fclose(fp);
    }
    else {
      error = ERRNO;
      switch(error) {
      case ENOENT:
      case ESRCH:
        break;
      default:
        DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
                       error, strerror(error)));
        DEBUGF(fprintf(stderr, "Error opening file: %s\n", "/etc/svc.conf"));
      }
 
      /* ignore error, default value will be chosen for `channel->lookups` */
      status = ARES_EOF;
    }
  }
 
  if(line)
    ares_free(line);
}

libcares/ares_search.c  view on Meta::CPAN

293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
          }
        else
          {
            error = ERRNO;
            switch(error)
              {
              case ENOENT:
              case ESRCH:
                break;
              default:
                DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
                               error, strerror(error)));
                DEBUGF(fprintf(stderr, "Error opening file: %s\n",
                               hostaliases));
                *s = NULL;
                return ARES_EFILE;
              }
          }
      }
  }
 
if (channel->flags & ARES_FLAG_NOSEARCH || channel->ndomains == 0)
  {

libcares/config.sub  view on Meta::CPAN

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that
# program.  This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
 
 
# Please send patches to <config-patches@gnu.org>.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
 
# You can get the latest version of this script from:
 
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
# Each package is responsible for reporting which valid configurations
# it does not support.  The user should be able to distinguish

libcares/configure  view on Meta::CPAN

640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
else
  as_fn_arith ()
  {
    as_val=`expr "$@" || test $? -eq 1`
  }
fi # as_fn_arith
 
 
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
  as_status=$1; test $as_status -eq 0 && as_status=1
  if test "$4"; then
    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
  fi
  $as_echo "$as_me: error: $2" >&2

libcares/configure  view on Meta::CPAN

4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
  ac_status=$?
  if test -s conftest.err; then
    sed '10a\
... rest of stderr output deleted ...
         10q' conftest.err >conftest.er1
    cat conftest.er1 >&5
  fi
  rm -f conftest.er1 conftest.err
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }
done
 
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

libcares/configure  view on Meta::CPAN

5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
  ac_status=$?
  if test -s conftest.err; then
    sed '10a\
... rest of stderr output deleted ...
         10q' conftest.err >conftest.er1
    cat conftest.er1 >&5
  fi
  rm -f conftest.er1 conftest.err
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }
done
 
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }

libcares/configure  view on Meta::CPAN

6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
if depmode=$depmode \
   source=sub/conftest.c object=$am__obj \
   depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
   $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
     >/dev/null 2>conftest.err &&
   grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
   grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
   grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
   ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
  # icc doesn't choke on unknown options, it will just issue warnings
  # or remarks (even with -Werror).  So we grep stderr for any message
  # that says an option was ignored or not supported.
  # When given -MP, icc 7.0 and 7.1 complain thusly:
  #   icc: Command line warning: ignoring option '-M'; no argument required
  # The diagnosis changed in icc 8.0:
  #   icc: Command line remark: option '-MP' not supported
  if (grep 'ignoring option' conftest.err ||
      grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
    am_cv_CC_dependencies_compiler_type=$depmode
    break
  fi

libcares/configure  view on Meta::CPAN

6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
if depmode=$depmode \
   source=sub/conftest.c object=$am__obj \
   depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
   $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
     >/dev/null 2>conftest.err &&
   grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
   grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
   grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
   ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
  # icc doesn't choke on unknown options, it will just issue warnings
  # or remarks (even with -Werror).  So we grep stderr for any message
  # that says an option was ignored or not supported.
  # When given -MP, icc 7.0 and 7.1 complain thusly:
  #   icc: Command line warning: ignoring option '-M'; no argument required
  # The diagnosis changed in icc 8.0:
  #   icc: Command line remark: option '-MP' not supported
  if (grep 'ignoring option' conftest.err ||
      grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
    am_cv_CXX_dependencies_compiler_type=$depmode
    break
  fi

libcares/configure  view on Meta::CPAN

32021
32022
32023
32024
32025
32026
32027
32028
32029
32030
32031
32032
32033
32034
32035
32036
32037
32038
32039
32040
32041
#
# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
 
_ACEOF
 
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(
  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
    eval ac_val=\$$ac_var
    case $ac_val in #(
    *${as_nl}*)
      case $ac_var in #(
      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      esac

libcares/configure  view on Meta::CPAN

32318
32319
32320
32321
32322
32323
32324
32325
32326
32327
32328
32329
32330
32331
32332
32333
32334
32335
32336
32337
32338
export LC_ALL
LANGUAGE=C
export LANGUAGE
 
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
 
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
  as_status=$1; test $as_status -eq 0 && as_status=1
  if test "$4"; then
    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
  fi
  $as_echo "$as_me: error: $2" >&2

libcares/ltmain.sh  view on Meta::CPAN

6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
    }
  return str;
}
 
void
lt_debugprintf (const char *file, int line, const char *fmt, ...)
{
  va_list args;
  if (lt_debug)
    {
      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
      va_start (args, fmt);
      (void) vfprintf (stderr, fmt, args);
      va_end (args);
    }
}
 
static void
lt_error_core (int exit_status, const char *file,
               int line, const char *mode,
               const char *message, va_list ap)
{
  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
  vfprintf (stderr, message, ap);
  fprintf (stderr, ".\n");
 
  if (exit_status >= 0)
    exit (exit_status);
}
 
void
lt_fatal (const char *file, int line, const char *message, ...)
{
  va_list ap;
  va_start (ap, message);

libcares/test/aclocal.m4  view on Meta::CPAN

264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
if depmode=$depmode \
   source=sub/conftest.c object=$am__obj \
   depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
   $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
     >/dev/null 2>conftest.err &&
   grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
   grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
   grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
   ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
  # icc doesn't choke on unknown options, it will just issue warnings
  # or remarks (even with -Werror).  So we grep stderr for any message
  # that says an option was ignored or not supported.
  # When given -MP, icc 7.0 and 7.1 complain thusly:
  #   icc: Command line warning: ignoring option '-M'; no argument required
  # The diagnosis changed in icc 8.0:
  #   icc: Command line remark: option '-MP' not supported
  if (grep 'ignoring option' conftest.err ||
      grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
    am_cv_$1_dependencies_compiler_type=$depmode
    break
  fi

libcares/test/aclocal.m4  view on Meta::CPAN

1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
[ustar],
 [# The POSIX 1988 'ustar' format is defined with fixed-size fields.
  # There is notably a 21 bits limit for the UID and the GID.  In fact,
  # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343
  # and bug#13588).
  am_max_uid=2097151 # 2^21 - 1
  am_max_gid=$am_max_uid
  # The $UID and $GID variables are not portable, so we need to resort
  # to the POSIX-mandated id(1) utility.  Errors in the 'id' calls
  # below are definitely unexpected, so allow the users to see them
  # (that is, avoid stderr redirection).
  am_uid=`id -u || echo unknown`
  am_gid=`id -g || echo unknown`
  AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format])
  if test $am_uid -le $am_max_uid; then
     AC_MSG_RESULT([yes])
  else
     AC_MSG_RESULT([no])
     _am_tools=none
  fi
  AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format])

libcares/test/ares-fuzz.c  view on Meta::CPAN

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
    int count = 0;
    while (KEEP_FUZZING(count)) {
      ProcessFile(fileno(stdin));
      count++;
    }
  } else {
    int ii;
    for (ii = 1; ii < argc; ++ii) {
      int fd = open(argv[ii], O_RDONLY);
      if (fd < 0) {
        fprintf(stderr, "Failed to open '%s'\n", argv[ii]);
        continue;
      }
      ProcessFile(fd);
      close(fd);
    }
  }
  return 0;
}

libcares/test/ares-test.cc  view on Meta::CPAN

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
  if (extrafd >= nfds) {
    nfds = extrafd + 1;
  }
}
 
// Wait for activity or timeout.
tv.tv_sec = 0;
tv.tv_usec = 100000;  // 100ms
count = select(nfds, &readers, &writers, nullptr, &tv);
if (count < 0) {
  fprintf(stderr, "select() failed, errno %d\n", errno);
  return;
}
 
// Let the library process any activity.
ares_process(channel, &readers, &writers);
 
// Let the provided callback process any activity on the extra FD.
for (int extrafd : extrafds) {
  if (FD_ISSET(extrafd, &readers)) {
    process_extra(extrafd);

libcares/test/configure  view on Meta::CPAN

405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
else
  as_fn_arith ()
  {
    as_val=`expr "$@" || test $? -eq 1`
  }
fi # as_fn_arith
 
 
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
  as_status=$1; test $as_status -eq 0 && as_status=1
  if test "$4"; then
    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
  fi
  $as_echo "$as_me: error: $2" >&2

libcares/test/configure  view on Meta::CPAN

3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
  ac_status=$?
  if test -s conftest.err; then
    sed '10a\
... rest of stderr output deleted ...
         10q' conftest.err >conftest.er1
    cat conftest.er1 >&5
  fi
  rm -f conftest.er1 conftest.err
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }
done
 
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

libcares/test/configure  view on Meta::CPAN

3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
if depmode=$depmode \
   source=sub/conftest.c object=$am__obj \
   depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
   $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
     >/dev/null 2>conftest.err &&
   grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
   grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
   grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
   ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
  # icc doesn't choke on unknown options, it will just issue warnings
  # or remarks (even with -Werror).  So we grep stderr for any message
  # that says an option was ignored or not supported.
  # When given -MP, icc 7.0 and 7.1 complain thusly:
  #   icc: Command line warning: ignoring option '-M'; no argument required
  # The diagnosis changed in icc 8.0:
  #   icc: Command line remark: option '-MP' not supported
  if (grep 'ignoring option' conftest.err ||
      grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
    am_cv_CXX_dependencies_compiler_type=$depmode
    break
  fi

libcares/test/configure  view on Meta::CPAN

4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
case "(($ac_try" in
  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
  *) ac_try_echo=$ac_try;;
esac
eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
$as_echo "$ac_try_echo"; } >&5
  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
  ac_status=$?
  if test -s conftest.err; then
    sed '10a\
... rest of stderr output deleted ...
         10q' conftest.err >conftest.er1
    cat conftest.er1 >&5
  fi
  rm -f conftest.er1 conftest.err
  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
  test $ac_status = 0; }
done
 
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }

libcares/test/configure  view on Meta::CPAN

4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
if depmode=$depmode \
   source=sub/conftest.c object=$am__obj \
   depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
   $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
     >/dev/null 2>conftest.err &&
   grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
   grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
   grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
   ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
  # icc doesn't choke on unknown options, it will just issue warnings
  # or remarks (even with -Werror).  So we grep stderr for any message
  # that says an option was ignored or not supported.
  # When given -MP, icc 7.0 and 7.1 complain thusly:
  #   icc: Command line warning: ignoring option '-M'; no argument required
  # The diagnosis changed in icc 8.0:
  #   icc: Command line remark: option '-MP' not supported
  if (grep 'ignoring option' conftest.err ||
      grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
    am_cv_CC_dependencies_compiler_type=$depmode
    break
  fi

libcares/test/configure  view on Meta::CPAN

17023
17024
17025
17026
17027
17028
17029
17030
17031
17032
17033
17034
17035
17036
17037
17038
17039
17040
17041
17042
17043
#
# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
 
_ACEOF
 
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
# So, we kill variables containing newlines.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
(
  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
    eval ac_val=\$$ac_var
    case $ac_val in #(
    *${as_nl}*)
      case $ac_var in #(
      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
      esac

libcares/test/configure  view on Meta::CPAN

17295
17296
17297
17298
17299
17300
17301
17302
17303
17304
17305
17306
17307
17308
17309
17310
17311
17312
17313
17314
17315
export LC_ALL
LANGUAGE=C
export LANGUAGE
 
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
 
# as_fn_error STATUS ERROR [LINENO LOG_FD]
# ----------------------------------------
# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
# script with STATUS, using 1 if that was 0.
as_fn_error ()
{
  as_status=$1; test $as_status -eq 0 && as_status=1
  if test "$4"; then
    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
  fi
  $as_echo "$as_me: error: $2" >&2

libcares/test/gmock-1.8.0/gmock-gtest-all.cc  view on Meta::CPAN

4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
  errors
      << "Attempted redefinition of test case " << test_case_name << ".\n"
      << "All tests in the same test case must use the same test fixture\n"
      << "class.  However, in test case " << test_case_name << ", you tried\n"
      << "to define a test using a fixture class different from the one\n"
      << "used earlier. This can happen if the two fixture classes are\n"
      << "from different namespaces and have the same name. You should\n"
      << "probably rename one of the classes to put the tests into different\n"
      << "test cases.";
 
  fprintf(stderr, "%s %s",
          FormatFileLocation(code_location.file.c_str(),
                             code_location.line).c_str(),
          errors.GetString().c_str());
}
#endif  // GTEST_HAS_PARAM_TEST
 
}  // namespace internal
 
namespace {

libcares/test/gmock-1.8.0/gmock-gtest-all.cc  view on Meta::CPAN

4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
  // The output file.
  const std::string output_file_;
 
  GTEST_DISALLOW_COPY_AND_ASSIGN_(XmlUnitTestResultPrinter);
};
 
// Creates a new XmlUnitTestResultPrinter.
XmlUnitTestResultPrinter::XmlUnitTestResultPrinter(const char* output_file)
    : output_file_(output_file) {
  if (output_file_.c_str() == NULL || output_file_.empty()) {
    fprintf(stderr, "XML output file may not be null\n");
    fflush(stderr);
    exit(EXIT_FAILURE);
  }
}
 
// Called after the unit test ends.
void XmlUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test,
                                                  int /*iteration*/) {
  FILE* xmlout = NULL;
  FilePath output_file(output_file_);
  FilePath output_dir(output_file.RemoveFileName());

libcares/test/gmock-1.8.0/gmock-gtest-all.cc  view on Meta::CPAN

4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
    // TODO(wan): report the reason of the failure.
    //
    // We don't do it for now as:
    //
    //   1. There is no urgent need for it.
    //   2. It's a bit involved to make the errno variable thread-safe on
    //      all three operating systems (Linux, Windows, and Mac OS).
    //   3. To interpret the meaning of errno in a thread-safe way,
    //      we need the strerror_r() function, which is not available on
    //      Windows.
    fprintf(stderr,
            "Unable to open file \"%s\"\n",
            output_file_.c_str());
    fflush(stderr);
    exit(EXIT_FAILURE);
  }
  std::stringstream stream;
  PrintXmlUnitTest(&stream, unit_test);
  fprintf(xmlout, "%s", StringStreamToString(&stream).c_str());
  fclose(xmlout);
}
 
// Returns an XML-escaped copy of the input string str.  If is_attribute
// is true, the text is meant to appear as an attribute value, and

libcares/test/gmock-1.8.0/gmock-gtest-all.cc  view on Meta::CPAN

5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
  if (impl()->catch_exceptions() || in_death_test_child_process) {
# if !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT
    // SetErrorMode doesn't exist on CE.
    SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
                 SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
# endif  // !GTEST_OS_WINDOWS_MOBILE
 
# if (defined(_MSC_VER) || GTEST_OS_WINDOWS_MINGW) && !GTEST_OS_WINDOWS_MOBILE
    // Death test children can be terminated with _abort().  On Windows,
    // _abort() can show a dialog with a warning message.  This forces the
    // abort message to go to stderr instead.
    _set_error_mode(_OUT_TO_STDERR);
# endif
 
# if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
    // In the debug version, Visual Studio pops up a separate dialog
    // offering a choice to debug the aborted program. We need to suppress
    // this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement
    // executed. Google Test will notify the user of any unexpected
    // failure via stderr.
    //
    // VC++ doesn't define _set_abort_behavior() prior to the version 8.0.
    // Users of prior VC versions shall suffer the agony and pain of
    // clicking through the countless debug dialogs.
    // TODO(vladl@google.com): find a way to suppress the abort dialog() in the
    // debug mode when compiled with VC 7.1 or lower.
    if (!GTEST_FLAG(break_on_failure))
      _set_abort_behavior(
          0x0,                                    // Clear the following flags:
          _WRITE_ABORT_MSG | _CALL_REPORTFAULT);  // pop-up window, core dump.

libcares/test/gmock-1.8.0/gmock-gtest-all.cc  view on Meta::CPAN

6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
      ParseStringFlag(arg, kStreamResultToFlag,
                      &GTEST_FLAG(stream_result_to)) ||
      ParseBoolFlag(arg, kThrowOnFailureFlag,
                    &GTEST_FLAG(throw_on_failure));
}
 
#if GTEST_USE_OWN_FLAGFILE_FLAG_
void LoadFlagsFromFile(const std::string& path) {
  FILE* flagfile = posix::FOpen(path.c_str(), "r");
  if (!flagfile) {
    fprintf(stderr,
            "Unable to open file \"%s\"\n",
            GTEST_FLAG(flagfile).c_str());
    fflush(stderr);
    exit(EXIT_FAILURE);
  }
  std::string contents(ReadEntireFile(flagfile));
  posix::FClose(flagfile);
  std::vector<std::string> lines;
  SplitString(contents, '\n', &lines);
  for (size_t i = 0; i < lines.size(); ++i) {
    if (lines[i].empty())
      continue;
    if (!ParseGoogleTestFlag(lines[i].c_str()))

libcares/test/gmock-1.8.0/gmock-gtest-all.cc  view on Meta::CPAN

7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
// statement, which is not allowed; THREW means that the test statement
// returned control by throwing an exception.  IN_PROGRESS means the test
// has not yet concluded.
// TODO(vladl@google.com): Unify names and possibly values for
// AbortReason, DeathTestOutcome, and flag characters above.
enum DeathTestOutcome { IN_PROGRESS, DIED, LIVED, RETURNED, THREW };
 
// Routine for aborting the program which is safe to call from an
// exec-style death test child process, in which case the error
// message is propagated back to the parent process.  Otherwise, the
// message is simply printed to stderr.  In either case, the program
// then exits with status 1.
void DeathTestAbort(const std::string& message) {
  // On a POSIX system, this function may be called from a threadsafe-style
  // death test child process, which operates on a very small stack.  Use
  // the heap for any additional non-minuscule memory requirements.
  const InternalRunDeathTestFlag* const flag =
      GetUnitTestImpl()->internal_run_death_test_flag();
  if (flag != NULL) {
    FILE* parent = posix::FDOpen(flag->write_fd(), "w");
    fputc(kDeathTestInternalError, parent);
    fprintf(parent, "%s", message.c_str());
    fflush(parent);
    _exit(1);
  } else {
    fprintf(stderr, "%s", message.c_str());
    fflush(stderr);
    posix::Abort();
  }
}
 
// A replacement for CHECK that calls DeathTestAbort if the assertion
// fails.
# define GTEST_DEATH_TEST_CHECK_(expression) \
  do { \
    if (!::testing::internal::IsTrue(expression)) { \
      DeathTestAbort( \

libcares/test/gmock-1.8.0/gmock-gtest-all.cc  view on Meta::CPAN

7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
  // when built as Windows DLL), destructors of global objects will still
  // run after calling _exit(). On such systems, write_fd_ will be
  // indirectly closed from the destructor of UnitTestImpl, causing double
  // close if it is also closed here. On debug configurations, double close
  // may assert. As there are no in-process buffers to flush here, we are
  // relying on the OS to close the descriptor after the process terminates
  // when the destructors are not run.
  _exit(1);  // Exits w/o any normal exit hooks (we were supposed to crash)
}
 
// Returns an indented copy of stderr output for a death test.
// This makes distinguishing death test output lines from regular log lines
// much easier.
static ::std::string FormatDeathTestOutput(const ::std::string& output) {
  ::std::string ret;
  for (size_t at = 0; ; ) {
    const size_t line_end = output.find('\n', at);
    ret += "[  DEATH   ] ";
    if (line_end == ::std::string::npos) {
      ret += output.substr(at);
      break;

libcares/test/gmock-1.8.0/gmock-gtest-all.cc  view on Meta::CPAN

7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
// 2. The parent starts the child and provides it with the information
//    necessary to acquire the handle to the write end of the pipe.
// 3. The child acquires the write end of the pipe and signals the parent
//    using a Windows event.
// 4. Now the parent can release the write end of the pipe on its side. If
//    this is done before step 3, the object's reference count goes down to
//    0 and it is destroyed, preventing the child from acquiring it. The
//    parent now has to release it, or read operations on the read end of
//    the pipe will not return when the child terminates.
// 5. The parent reads child's output through the pipe (outcome code and
//    any possible error messages) from the pipe, and its stderr and then
//    determines whether to fail the test.
//
// Note: to distinguish Win32 API calls from the local method and function
// calls, the former are explicitly resolved in the global namespace.
//
class WindowsDeathTest : public DeathTestImpl {
 public:
  WindowsDeathTest(const char* a_statement,
                   const RE* a_regex,
                   const char* file,

libcares/test/gmock-1.8.0/gmock-gtest-all.cc  view on Meta::CPAN

7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
// there are multiple threads running before the death test, and another
// thread writes to the log file.
FlushInfoLog();
 
const pid_t child_pid = fork();
GTEST_DEATH_TEST_CHECK_(child_pid != -1);
set_child_pid(child_pid);
if (child_pid == 0) {
  GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[0]));
  set_write_fd(pipe_fd[1]);
  // Redirects all logging to stderr in the child process to prevent
  // concurrent writes to the log files.  We capture stderr in the parent
  // process and append the child process' output to a log.
  LogToStderr();
  // Event forwarding to the listeners of event listener API mush be shut
  // down in death test subprocesses.
  GetUnitTestImpl()->listeners()->SuppressEventForwarding();
  g_in_fast_death_test_child = true;
  return EXECUTE_TEST;
} else {
  GTEST_DEATH_TEST_CHECK_SYSCALL_(close(pipe_fd[1]));
  set_read_fd(pipe_fd[0]);

libcares/test/gmock-1.8.0/gmock-gtest-all.cc  view on Meta::CPAN

9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
      severity == GTEST_WARNING ? "[WARNING]" :
      severity == GTEST_ERROR ?   "[ ERROR ]" : "[ FATAL ]";
  GetStream() << ::std::endl << marker << " "
              << FormatFileLocation(file, line).c_str() << ": ";
}
 
// Flushes the buffers and, if severity is GTEST_FATAL, aborts the program.
GTestLog::~GTestLog() {
  GetStream() << ::std::endl;
  if (severity_ == GTEST_FATAL) {
    fflush(stderr);
    posix::Abort();
  }
}
// Disable Microsoft deprecation warnings for POSIX functions called from
// this class (creat, dup, dup2, and close)
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4996)
 
#if GTEST_HAS_STREAM_REDIRECTION
 
// Object that captures an output stream (stdout/stderr).
class CapturedStream {
 public:
  // The ctor redirects the stream to a temporary file.
  explicit CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
# if GTEST_OS_WINDOWS
    char temp_dir_path[MAX_PATH + 1] = { '\0' };  // NOLINT
    char temp_file_path[MAX_PATH + 1] = { '\0' };  // NOLINT
 
    ::GetTempPathA(sizeof(temp_dir_path), temp_dir_path);
    const UINT success = ::GetTempFileNameA(temp_dir_path,

libcares/test/gmock-1.8.0/gmock-gtest-all.cc  view on Meta::CPAN

9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
    FILE* const file = posix::FOpen(filename_.c_str(), "r");
    const std::string content = ReadEntireFile(file);
    posix::FClose(file);
    return content;
  }
 
 private:
  const int fd_;  // A stream to capture.
  int uncaptured_fd_;
  // Name of the temporary file holding the stderr output.
  ::std::string filename_;
 
  GTEST_DISALLOW_COPY_AND_ASSIGN_(CapturedStream);
};
 
GTEST_DISABLE_MSC_WARNINGS_POP_()
 
static CapturedStream* g_captured_stderr = NULL;
static CapturedStream* g_captured_stdout = NULL;
 
// Starts capturing an output stream (stdout/stderr).
void CaptureStream(int fd, const char* stream_name, CapturedStream** stream) {
  if (*stream != NULL) {
    GTEST_LOG_(FATAL) << "Only one " << stream_name
                      << " capturer can exist at a time.";
  }
  *stream = new CapturedStream(fd);
}
 
// Stops capturing the output stream and returns the captured string.
std::string GetCapturedStream(CapturedStream** captured_stream) {

libcares/test/gmock-1.8.0/gmock-gtest-all.cc  view on Meta::CPAN

9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
  *captured_stream = NULL;
 
  return content;
}
 
// Starts capturing stdout.
void CaptureStdout() {
  CaptureStream(kStdOutFileno, "stdout", &g_captured_stdout);
}
 
// Starts capturing stderr.
void CaptureStderr() {
  CaptureStream(kStdErrFileno, "stderr", &g_captured_stderr);
}
 
// Stops capturing stdout and returns the captured string.
std::string GetCapturedStdout() {
  return GetCapturedStream(&g_captured_stdout);
}
 
// Stops capturing stderr and returns the captured string.
std::string GetCapturedStderr() {
  return GetCapturedStream(&g_captured_stderr);
}
 
#endif  // GTEST_HAS_STREAM_REDIRECTION
 
std::string TempDir() {
#if GTEST_OS_WINDOWS_MOBILE
  return "\\temp\\";
#elif GTEST_OS_WINDOWS
  const char* temp_dir = posix::GetEnv("TEMP");
  if (temp_dir == NULL || temp_dir[0] == '\0')

libcares/test/gmock-1.8.0/gmock-gtest-all.cc  view on Meta::CPAN

10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
  for (RegisteredTestIter it = registered_tests_.begin();
       it != registered_tests_.end();
       ++it) {
    if (tests.count(it->first) == 0) {
      errors << "You forgot to list test " << it->first << ".\n";
    }
  }
 
  const std::string& errors_str = errors.GetString();
  if (errors_str != "") {
    fprintf(stderr, "%s %s", FormatFileLocation(file, line).c_str(),
            errors_str.c_str());
    fflush(stderr);
    posix::Abort();
  }
 
  return registered_tests;
}
 
#endif  // GTEST_HAS_TYPED_TEST_P
 
}  // namespace internal
}  // namespace testing

libcares/test/gmock-1.8.0/gtest/gtest.h  view on Meta::CPAN

317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
//   scoped_ptr     - as in TR2.
//
// Regular expressions:
//   RE             - a simple regular expression class using the POSIX
//                    Extended Regular Expression syntax on UNIX-like
//                    platforms, or a reduced regular exception syntax on
//                    other platforms, including Windows.
//
// Logging:
//   GTEST_LOG_()   - logs messages at the specified severity level.
//   LogToStderr()  - directs all log messages to stderr.
//   FlushInfoLog() - flushes informational log messages.
//
// Stdout and stderr capturing:
//   CaptureStdout()     - starts capturing stdout.
//   GetCapturedStdout() - stops capturing stdout and returns the captured
//                         string.
//   CaptureStderr()     - starts capturing stderr.
//   GetCapturedStderr() - stops capturing stderr and returns the captured
//                         string.
//
// Integer types:
//   TypeWithSize   - maps an integer to a int type.
//   Int32, UInt32, Int64, UInt64, TimeInMillis
//                  - integers of known sizes.
//   BiggestInt     - the biggest signed integer type.
//
// Command-line utilities:
//   GTEST_DECLARE_*()  - declares a flag.

libcares/test/gmock-1.8.0/gtest/gtest.h  view on Meta::CPAN

2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
// Formats a file location for compiler-independent XML output.
// Although this function is not platform dependent, we put it next to
// FormatFileLocation in order to contrast the two functions.
GTEST_API_ ::std::string FormatCompilerIndependentFileLocation(const char* file,
                                                               int line);
 
// Defines logging utilities:
//   GTEST_LOG_(severity) - logs messages at the specified severity level. The
//                          message itself is streamed into the macro.
//   LogToStderr()  - directs all log messages to stderr.
//   FlushInfoLog() - flushes informational log messages.
 
enum GTestLogSeverity {
  GTEST_INFO,
  GTEST_WARNING,
  GTEST_ERROR,
  GTEST_FATAL
};
 
// Formats log entry severity, provides a stream object for streaming the

libcares/test/gmock-1.8.0/gtest/gtest.h  view on Meta::CPAN

2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
  return ::down_cast<Derived*>(base);
#elif GTEST_HAS_RTTI
  return dynamic_cast<Derived*>(base);  // NOLINT
#else
  return static_cast<Derived*>(base);  // Poor man's downcast.
#endif
}
 
#if GTEST_HAS_STREAM_REDIRECTION
 
// Defines the stderr capturer:
//   CaptureStdout     - starts capturing stdout.
//   GetCapturedStdout - stops capturing stdout and returns the captured string.
//   CaptureStderr     - starts capturing stderr.
//   GetCapturedStderr - stops capturing stderr and returns the captured string.
//
GTEST_API_ void CaptureStdout();
GTEST_API_ std::string GetCapturedStdout();
GTEST_API_ void CaptureStderr();
GTEST_API_ std::string GetCapturedStderr();
 
#endif  // GTEST_HAS_STREAM_REDIRECTION
 
// Returns a path to temporary directory.
GTEST_API_ std::string TempDir();

libcares/test/gmock-1.8.0/gtest/gtest.h  view on Meta::CPAN

8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
class GTEST_API_ TypedTestCasePState {
 public:
  TypedTestCasePState() : registered_(false) {}
 
  // Adds the given test name to defined_test_names_ and return true
  // if the test case hasn't been registered; otherwise aborts the
  // program.
  bool AddTestName(const char* file, int line, const char* case_name,
                   const char* test_name) {
    if (registered_) {
      fprintf(stderr, "%s Test %s must be defined before "
              "REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
              FormatFileLocation(file, line).c_str(), test_name, case_name);
      fflush(stderr);
      posix::Abort();
    }
    registered_tests_.insert(
        ::std::make_pair(test_name, CodeLocation(file, line)));
    return true;
  }
 
  bool TestExists(const std::string& test_name) const {
    return registered_tests_.count(test_name) > 0;
  }

libcares/test/gmock-1.8.0/gtest/gtest.h  view on Meta::CPAN

8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
// something such that we can call this function in a namespace scope.
template <GTEST_TEMPLATE_ Fixture, typename Tests, typename Types>
class TypeParameterizedTestCase {
 public:
  static bool Register(const char* prefix, CodeLocation code_location,
                       const TypedTestCasePState* state,
                       const char* case_name, const char* test_names) {
    std::string test_name = StripTrailingSpaces(
        GetPrefixUntilComma(test_names));
    if (!state->TestExists(test_name)) {
      fprintf(stderr, "Failed to get code location for test %s.%s at %s.",
              case_name, test_name.c_str(),
              FormatFileLocation(code_location.file.c_str(),
                                 code_location.line).c_str());
      fflush(stderr);
      posix::Abort();
    }
    const CodeLocation& test_location = state->GetCodeLocation(test_name);
 
    typedef typename Tests::Head Head;
 
    // First, register the first test in 'Test' for each type in 'Types'.
    TypeParameterizedTest<Fixture, Head, Types>::Register(
        prefix, test_location, case_name, test_names, 0);

libcares/test/gmock-1.8.0/gtest/gtest.h  view on Meta::CPAN

9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
};
 
// Assumes one of the above roles.
virtual TestRole AssumeRole() = 0;
 
// Waits for the death test to finish and returns its status.
virtual int Wait() = 0;
 
// Returns true if the death test passed; that is, the test process
// exited during the test, its exit status matches a user-supplied
// predicate, and its stderr output matches a user-supplied regular
// expression.
// The user-supplied predicate may be a macro expression rather
// than a function pointer or functor, or else Wait and Passed could
// be combined.
virtual bool Passed(bool exit_status_ok) = 0;
 
// Signals that the death test did not die as expected.
virtual void Abort(AbortReason reason) = 0;
 
// Returns a human-readable outcome message regarding the outcome of

libcares/test/gmock-1.8.0/gtest/gtest.h  view on Meta::CPAN

9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
 
// Traps C++ exceptions escaping statement and reports them as test
// failures. Note that trapping SEH exceptions is not implemented here.
# if GTEST_HAS_EXCEPTIONS
#  define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
  try { \
    GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
  } catch (const ::std::exception& gtest_exception) { \
    fprintf(\
        stderr, \
        "\n%s: Caught std::exception-derived exception escaping the " \
        "death test statement. Exception message: %s\n", \
        ::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
        gtest_exception.what()); \
    fflush(stderr); \
    death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
  } catch (...) { \
    death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
  }
 
# else
#  define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
  GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
 
# endif



( run in 0.409 second using v1.01-cache-2.11-cpan-cba739cd03b )