All pastes #777226 Raw Edit

Anonymous

public c v1 · immutable
·published 2007-11-16 17:16 UTC
rendered paste body
    while(1){                                                                                                     |    int size_path;        printf("cmd (? for help)> ");                                                                             |    ssize_t n = read(sock, buf, 10);        scanf("%s",str);                                                                                          |    if (n == -1)        if(strcmp(str,"?")==0){                                                                                   |        perror("write: ");            printChoice(state);                                                                                   |        }else if((strcmp(str,"1") == 0) && state == 0){                                                           |    buf[n] = '\0';            write(sock, str, strlen(str)); // write command to socket host                                        |    if ( (strcmp(buf, "KTHX_FILE")) != 0){/*          fprintf(stderr,"sock er: %d ", sock); */  DETTE ER PRINTEN                                            |        fprintf(stderr,"Handshake failed, please try again");            int read_check = check_read(sock, str);                                                               |        exit(1);            if (read_check == 1){                                                                                 |    }                int sockread = readsock(sock, str);                                                               |    memset(buf,0,strlen(buf));                if (sockread == 0){                                                                               |    while ( (strcmp(buf,"KTHXBYE")) != 0){                    fprintf(stderr,"There was a fault in sockread");                                              |        memset(buf,0,strlen(buf));                }                                                                                                 |        read(sock,size_of_path,200);            }