#include "csapp.h"
#include
void pton(const char * src) {
struct in_addr dst;
inet_pton(AF_INET, src, (void*)&dst);
printf("%s -> 0x%x\n", src, ntohl(dst.s_addr));
}
void ntop(const uint32_t hex) {
struct in_addr src;
src.s_addr = htonl(hex);
char dst[20];
inet_ntop(AF_INET, (void*)&src, dst, INET_ADDRSTRLEN);
printf("0x%x -> %s\n", src.s_addr, dst);
}
int main (int argc, char **argv) {
pton(argv[1]);
}