Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/dnsres/dnsres.c

    r5a6cc679 ra35b458  
    3838#include <stdio.h>
    3939#include <stdlib.h>
     40#include <str.h>
    4041
    4142#define NAME  "dnsres"
     
    5253                return 1;
    5354        }
    54        
     55
    5556        uint16_t ver;
    5657        char *hname;
    57        
     58
    5859        if (str_cmp(argv[1], "-4") == 0) {
    5960                if (argc < 3) {
     
    6162                        return 1;
    6263                }
    63                
     64
    6465                ver = ip_v4;
    6566                hname = argv[2];
     
    6970                        return 1;
    7071                }
    71                
     72
    7273                ver = ip_v6;
    7374                hname = argv[2];
     
    7677                hname = argv[1];
    7778        }
    78        
     79
    7980        dnsr_hostinfo_t *hinfo;
    8081        errno_t rc = dnsr_name2host(hname, &hinfo, ver);
     
    8384                return rc;
    8485        }
    85        
     86
    8687        char *saddr;
    8788        rc = inet_addr_format(&hinfo->addr, &saddr);
     
    9192                return rc;
    9293        }
    93        
     94
    9495        printf("Host name: %s\n", hname);
    95        
     96
    9697        if (str_cmp(hname, hinfo->cname) != 0)
    9798                printf("Canonical name: %s\n", hinfo->cname);
    98        
     99
    99100        printf("Address: %s\n", saddr);
    100        
     101
    101102        dnsr_hostinfo_destroy(hinfo);
    102103        free(saddr);
    103        
     104
    104105        return 0;
    105106}
Note: See TracChangeset for help on using the changeset viewer.