summaryrefslogtreecommitdiff
path: root/src/bin/ipconvert.c
blob: 0390aff9ae28b5921ce23b1d33b1994dadaab6a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
#include <stdio.h>
#include <arpa/inet.h>

int main(int argc,char *argv[]) {
 int addr=inet_addr(argv[1]);
 printf("hex: %x\n",htonl(addr));
 printf("dec: %u\n",htonl(addr));
 printf("dotted-quad: %u.%u.%u.%u\n",addr&255,addr>>8&255,addr>>16&255,addr>>24&255);
 return 0;
}