/* * This is the thread routine for taking input from * the user and placing it into the chat buffer. */ #include #include #include #include "chat.h" void AddToChatBuffer(struct chatbuff *G, struct linebuff *pMyLineBuff){ int mySlot ; mySlot = G->nextSlot ; INCRSLOT(&G->nextSlot) ; bcopy((void *)pMyLineBuff,(void *)&G->buff[mySlot],sizeof(struct linebuff)); } void *InputFromUser(void *ptArgs) { struct chatbuff * volatile G ; int mySock ; struct linebuff myLineBuff ; struct timeval present ; int userInputSize ; int stillConnected ; FILE *sockIn ; mySock = ((struct ptGenericArg *)ptArgs) -> sock ; G = ((struct ptGenericArg *)ptArgs) -> G ; free(ptArgs) ; if ((sockIn = fdopen(mySock, "r")) == (FILE *)NULL) { perror("fdopen") ; pthread_exit((void *)NULL) ; } stillConnected = 1 ; myLineBuff.status = MESSAGE ; while (stillConnected) { int nextC = 0 ; myLineBuff.size = 0 ; while (stillConnected && myLineBuff.size