Back to index

glibc  2.9
Classes | Functions | Variables
tst-aton.c File Reference
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

Go to the source code of this file.

Classes

struct  tests

Functions

int main (int argc, char *argv[])

Variables

static struct tests tests []

Class Documentation

struct tests

Definition at line 25 of file bug-regex27.c.

Class Members
int cflags
const char * input
const char * regex
uint32_t result
int retval
const char * string
reg_syntax_t syntax
int valid

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 47 of file tst-aton.c.

{
  int result = 0;
  size_t cnt;

  for (cnt = 0; cnt < sizeof (tests) / sizeof (tests[0]); ++cnt)
    {
      struct in_addr addr;

      if ((int) inet_aton (tests[cnt].input, &addr) != tests[cnt].valid)
       {
         if (tests[cnt].valid)
           printf ("\"%s\" not seen as valid IP address\n", tests[cnt].input);
         else
           printf ("\"%s\" seen as valid IP address\n", tests[cnt].input);
         result = 1;
       }
      else if (tests[cnt].valid && addr.s_addr != ntohl (tests[cnt].result))
       {
         printf ("\"%s\" not converted correctly: is %08x, should be %08x\n",
                tests[cnt].input, addr.s_addr, tests[cnt].result);
         result = 1;
       }
    }

  return result;
}

Here is the call graph for this function:


Variable Documentation

struct tests tests[] [static]