1 2 3 4 5 6 7 8 9 10 11 12
#include "host.c" int main (int argc, char ** argv) { if (argc != 3) { fprintf(stderr, "%s network hostnumber\n", argv[0]); return 1; } struct in_net h = host(str2net(argv[1]), strtoll(argv[2], NULL, 10)); char b[16]; strcpy(b, inet_ntoa(h.addr)); printf("addr: %s mask %s\n", b, inet_ntoa(h.mask)); return 0; }