/* * Written by Ondrej Jirman */ #include #include #include #include #include #include int main(int ac, char* av[]) { struct sockaddr_un addr = { .sun_family = AF_UNIX, .sun_path = "/tmp/.urc_sock", }; int fd; if (ac < 2) { printf("Usage: %s \n", av[0]); printf("Example %s '+MYURC: hello world'\n", av[0]); return 1; } fd = socket(AF_UNIX, SOCK_DGRAM, 0); if (fd < 0) { perror("socket"); return 1; } ssize_t ret = sendto(fd, av[1], strlen(av[1]), 0, (const struct sockaddr*)&addr, sizeof(struct sockaddr_un)); if (ret < 0) { perror("sendto"); return 1; } close(fd); return 0; }