4 #include <sys/socket.h>
8 transpose(char *str, int len)
12 for (i = 0; i < len / 2; ++i) {
14 str[i] = str[len - 1 - i];
20 main(int ac, char **av)
23 const int len = strlen(av[1]);
30 assert(socketpair(AF_UNIX, SOCK_STREAM, 0, sv) == 0);
38 assert(close(1) == 0);
39 transpose(av[1], len);
40 assert(sendto(0, av[1], len, MSG_DONTROUTE, NULL, 0) == len);
41 assert(recvfrom(0, av[1], len, MSG_WAITALL, NULL, NULL) == len);
42 assert(close(0) == 0);
45 assert(waitpid(pid, &status, 0) == pid);
48 assert(close(0) == 0);
49 assert(recvfrom(1, av[1], len, MSG_WAITALL, NULL, NULL) == len);
50 transpose(av[1], len);
51 assert(sendto(1, av[1], len, MSG_DONTROUTE, NULL, 0) == len);
52 assert(recvfrom(1, av[1], len, MSG_WAITALL, NULL, NULL) == 0);
53 assert(close(1) == 0);