void * shell(void *arg) { Client *C = arg; char input[INPUTSIZE]; int rc; int menu=1; //the following is done in order to change the prompt for the user to X or O while (1) { // Clear input each time bzero(&input, INPUTSIZE); prompt(menu, input); if (strlen(input)>0) { rc=docmd(C, input); menu = 1; } if (rc<0) { killConnection(C->ph); break; } if (rc==1) { menu=1; // Proto_Game_State *gs = proto_client_game_state(C->ph); } if (((Proto_Client *) C->ph)->game.status == IN_PROGRESS && DISPLAYUI == 1) { // launchUI(C); return NULL; } else menu=1; } if (PROTO_PRINT_DUMPS==1) fprintf(stderr, "terminating\n"); fflush(stdout); return NULL; }
/* * getNetBaud() * * This gets the baud of network caller -- refer to SysDep.doc */ char getNetBaud() { extern UNS_16 intrates[]; extern FILE *netLog; int Time, baudRunner; extern int BaudRate; char laterMessage[100]; char found = FALSE, notFinished; extern char inNet; /* If anytime answer, then we already have baud rate */ sprintf(laterMessage, "System will be in network mode for another %d minutes; please call back.\n", timeLeft()); if (inNet == ANY_CALL || inNet == STROLL_CALL) { found = TRUE; baudRunner = LastBaudIndex; } else if (GetFirst(&ResList)) { if ((baudRunner = getModemId()) != ERROR) { found = TRUE; setNetCallBaud(baudRunner); } } pause(50); /* Pause a half second */ if (found) { BaudRate = atoi(rates[baudRunner]); for (Time = 0; gotCarrier() && Time < 20; Time++) { if (check_for_init(FALSE)) return TRUE; if (cfg.BoolFlags.debug) splitF(netLog, ".\n"); } if (gotCarrier()) { outFlag = IMPERVIOUS; mPrintf(laterMessage); } } else { while (MIReady()) Citinp(); /* Clear garbage */ for (Time = 0; gotCarrier() && Time < 20; Time++) { for (notFinished = TRUE, baudRunner = 0; gotCarrier() && notFinished;) { BaudRate = intrates[baudRunner]*10; setNetCallBaud(baudRunner); if (check_for_init(FALSE)) return TRUE; /* get connection */ if (cfg.BoolFlags.debug) splitF(netLog, ".\n"); notFinished = !(baudRunner == cfg.sysBaud); baudRunner++; } } if (gotCarrier()) { outFlag = IMPERVIOUS; for (baudRunner = cfg.sysBaud; baudRunner > -1; baudRunner--) { setNetCallBaud(baudRunner); mPrintf(laterMessage); } outFlag = OUTOK; } } if (!gotCarrier()) splitF(netLog, "Lost carrier\n"); killConnection("gnb"); return FALSE; }