struct sockaddr_un addr;
addr.sun_family = AF_LOCAL;
sprintf(addr.sun_path, "/run/user/1000/tomd/socket");
-
+
if(connect(sfd, (struct sockaddr *) &addr, SUN_LEN(&addr)) != 0){
perror("connect");
exit(EXIT_FAILURE);
}
options.name = NULL;
-
+
for(int i = 1;
i < argc;
i++){
if(wrote != write_len){ \
perror("[tomc] write size mismatch"); \
exit(EXIT_FAILURE); \
- }}
-
+ }}
+
int last_read_size = 0;
static void do_read(char *line)
{
- printf("got %s as input.\n", line);
+ /* printf("got %s as input.\n", line); */
strcpy(socket_buf, line);
/* printf("socket_buf: %s\n", socket_buf); */
}
SOCK_WRITE(options.name); \
SOCK_ACK; \
}
-
+
static void write_client(void)
{
SOCK_WRITE("client:tomc");
}
while(1){
- printf("looking for that last ack.\n");
+ /* printf("looking for that last ack.\n"); */
SOCK_READ;
if(strcmp(socket_buf, "ACK") == 0){
- tomc_p("got the ending ack.");
+ /* tomc_p("got the ending ack."); */
+ write(sfd, "ACK", sizeof "ACK");
break;
}else{
- printf("in else.\n");
+ /* printf("in else.\n"); */
/* int len = strlen(socket_buf); */
/* int total = len; */
/* if(last_read_size == 0){ */
init();
write_requests();
- tomc_p("dying of our own accord.");
-
+ /* tomc_p("dying of our own accord."); */
+
return EXIT_SUCCESS;
}