ID photo of Ciro Santilli taken in 2013 right eyeCiro Santilli OurBigBook logoOurBigBook.com  Sponsor 中国独裁统治 China Dictatorship 新疆改造中心、六四事件、法轮功、郝海东、709大抓捕、2015巴拿马文件 邓家贵、低端人口、西藏骚乱
c/posix/inet/pton.c
/* https://cirosantilli.com/c-posix-library */

#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
    struct in_addr addr;
    int s;

    if (argc != 2) {
        exit(EXIT_FAILURE);
    }
    s = inet_pton(AF_INET, argv[1], &addr);
    if (s <= 0) {
        if (s == 0)
            fprintf(stderr, "Not in presentation format");
        else
            perror("inet_pton");
        exit(EXIT_FAILURE);
    }
    printf("0x%08x\n", ntohl(addr.s_addr));
    exit(EXIT_SUCCESS);
}