commit - 509ad1bb1c2286f2b5790700a1c1c5bc2d68128e
commit + 1906b8d39fc25649c832a3d570a3ee3d220b358f
blob - 1e97e20c2b64c8ae2407a5cfa110c82f0c4b5328
blob + 5fa7d84f36cb63ac25e2df965240c35d4b5f2c26
--- FICS/network.c
+++ FICS/network.c
PUBLIC int
readline2(comstr_t *cs, int who)
{
- int howmany, state, fd, v_pending;
+ int bytes_received, state, fd, v_pending;
static const uint8_t ayt[] = "[Responding to AYT: Yes, I'm here.]\n";
static const uint8_t will_sga[] = { IAC, WILL, TELOPT_SGA, '\0' };
static const uint8_t will_tm[] = { IAC, WILL, TELOPT_TM, '\0' };
v_pending = con[who].numPending;
fd = con[who].fd;
- if ((howmany = recv(fd, start + v_pending, MAX_STRING_LENGTH - 1 -
+ if ((bytes_received = recv(fd, start + v_pending, MAX_STRING_LENGTH - 1 -
v_pending, 0)) == 0) { // error: they've disconnected
return -1;
- } else if (howmany == -1) {
+ } else if (bytes_received == -1) {
if (errno != EWOULDBLOCK) { // some other error
return -1;
} else if (con[who].processed) { // nothing new and nothing old
return 0;
} else { // nothing new
// but some unprocessed old
- howmany = 0;
+ bytes_received = 0;
}
}
if (con[who].processed)
s += v_pending;
else
- howmany += v_pending;
+ bytes_received += v_pending;
d = s;
- for (; howmany-- > 0; s++) {
+ for (; bytes_received-- > 0; s++) {
switch (state) {
case 0: // haven't skipped over any control chars or
// telnet commands
*s = '\0';
msnprintf(cs->com, ARRAY_SIZE(cs->com), "%s",
start);
- if (howmany)
- memmove(start, s + 1, howmany);
+ if (bytes_received)
+ memmove(start, s + 1, bytes_received);
con[who].state = 0;
- con[who].numPending = howmany;
+ con[who].numPending = bytes_received;
con[who].processed = 0;
con[who].outPos = 0;
return 1;
*d = '\0';
msnprintf(cs->com, ARRAY_SIZE(cs->com), "%s",
start);
- if (howmany)
- memmove(start, s + 1, howmany);
+ if (bytes_received)
+ memmove(start, s + 1, bytes_received);
con[who].state = 0;
- con[who].numPending = howmany;
+ con[who].numPending = bytes_received;
con[who].processed = 0;
con[who].outPos = 0;
return 1;