aboutsummaryrefslogtreecommitdiffstats
path: root/libglouglou/examples/dnsreverse.c
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2013-06-05 19:27:25 +0200
committerLaurent Ghigonis <laurent@p1sec.com>2013-06-05 19:27:25 +0200
commitc870d03c638130e8cb9dd94f62f51da06b0f04ca (patch)
tree903490f5ba3b60e2085dc582817445b56c66e9f3 /libglouglou/examples/dnsreverse.c
parentlibglouglou: update my email (last one...) (diff)
parentindent fix, pass 2 (diff)
downloadglouglou-c870d03c638130e8cb9dd94f62f51da06b0f04ca.tar.xz
glouglou-c870d03c638130e8cb9dd94f62f51da06b0f04ca.zip
Merge branch 'master' into traceroute
Conflicts: gg_sniff/pcap.c
Diffstat (limited to 'libglouglou/examples/dnsreverse.c')
-rw-r--r--libglouglou/examples/dnsreverse.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/libglouglou/examples/dnsreverse.c b/libglouglou/examples/dnsreverse.c
index 5111391..7a68d64 100644
--- a/libglouglou/examples/dnsreverse.c
+++ b/libglouglou/examples/dnsreverse.c
@@ -9,45 +9,45 @@
static void _cb_dns(struct in_addr *, char *, void *);
struct event_base *_ev_base;
-char *_name = NULL;
-int _answer = 0;
+char *_name = NULL;
+int _answer = 0;
int
main(int argc, char *argv[])
{
- struct ggnet_dns *ggdns;
- struct in_addr ip;
- struct timeval tv;
+ struct ggnet_dns *ggdns;
+ struct in_addr ip;
+ struct timeval tv;
- if (argc < 2) {
- printf("usage: dnsreverse <fqdn>\n");
- exit(1);
- }
- inet_aton(argv[1], &ip);
- ip.s_addr = ntohl(ip.s_addr);
+ if (argc < 2) {
+ printf("usage: dnsreverse <ip>\n");
+ exit(1);
+ }
+ inet_aton(argv[1], &ip);
+ ip.s_addr = ntohl(ip.s_addr);
- bzero(&tv, sizeof(struct timeval));
- tv.tv_sec = 5;
+ bzero(&tv, sizeof(struct timeval));
+ tv.tv_sec = 5;
- _ev_base = event_base_new();
+ _ev_base = event_base_new();
- ggdns = ggnet_dns_new(_ev_base);
- ggnet_dns_reverse(ggdns, &ip, _cb_dns, NULL);
+ ggdns = ggnet_dns_new(_ev_base);
+ ggnet_dns_reverse(ggdns, &ip, _cb_dns, NULL);
- event_base_loopexit(_ev_base, &tv);
- event_base_dispatch(_ev_base);
+ event_base_loopexit(_ev_base, &tv);
+ event_base_dispatch(_ev_base);
- if (_answer)
- printf("%x: %s\n", ip.s_addr, _name);
- else
- printf("no answer\n");
- return 0;
+ if (_answer)
+ printf("%x: %s\n", ip.s_addr, _name);
+ else
+ printf("no answer\n");
+ return 0;
}
static void
_cb_dns(struct in_addr *ip, char *name, void *data)
{
- _name = name;
- _answer = 1;
- event_base_loopexit(_ev_base, NULL);
+ _name = name;
+ _answer = 1;
+ event_base_loopexit(_ev_base, NULL);
}