| 252 |
timeout.tv_sec = TIME_OUT; |
timeout.tv_sec = TIME_OUT; |
| 253 |
timeout.tv_usec = 0; |
timeout.tv_usec = 0; |
| 254 |
|
|
| 255 |
result = select (FD_SETSIZE, &testfds, (fd_set *) NULL, |
result = SignalSafeSelect (FD_SETSIZE, &testfds, (fd_set *) NULL, |
| 256 |
(fd_set *) NULL, &timeout); |
(fd_set *) NULL, &timeout); |
| 257 |
|
|
| 258 |
switch (result) |
if (result == 0) |
| 259 |
{ |
{ |
|
case 0: |
|
| 260 |
if (time (0) - BBS_last_access_tm >= MAX_DELAY_TIME) |
if (time (0) - BBS_last_access_tm >= MAX_DELAY_TIME) |
| 261 |
{ |
{ |
| 262 |
loop = 0; |
loop = 0; |
| 263 |
} |
} |
| 264 |
break; |
} |
| 265 |
case -1: |
if (result < 0) |
| 266 |
log_error ("select() error!\n"); |
{ |
| 267 |
break; |
log_error ("select() error (%d) !\n", result); |
| 268 |
default: |
loop = 0; |
| 269 |
|
} |
| 270 |
|
if (result > 0) |
| 271 |
|
{ |
| 272 |
if (FD_ISSET (0, &testfds)) |
if (FD_ISSET (0, &testfds)) |
| 273 |
{ |
{ |
| 274 |
len = read (0, buf, 255); |
len = read (0, buf, 255); |
| 275 |
if (len == 0) |
if (len == 0) |
| 276 |
{ |
{ |
| 277 |
loop = 0; |
loop = 0; |
|
break; |
|
| 278 |
} |
} |
| 279 |
write (sock, buf, len); |
write (sock, buf, len); |
| 280 |
} |
} |
| 284 |
if (len == 0) |
if (len == 0) |
| 285 |
{ |
{ |
| 286 |
loop = 0; |
loop = 0; |
|
break; |
|
| 287 |
} |
} |
| 288 |
write (1, buf, len); |
write (1, buf, len); |
| 289 |
} |
} |
|
break; |
|
| 290 |
BBS_last_access_tm = time (0); |
BBS_last_access_tm = time (0); |
| 291 |
} |
} |
| 292 |
} |
} |
| 330 |
("¨t¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨s"); |
("¨t¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨T¨s"); |
| 331 |
moveto (23, 0); |
moveto (23, 0); |
| 332 |
prints (" [\x1b[1;32mCtrl+C\x1b[m]Í˳ö"); |
prints (" [\x1b[1;32mCtrl+C\x1b[m]Í˳ö"); |
| 333 |
|
|
| 334 |
iflush (); |
iflush (); |
| 335 |
|
|
| 336 |
return 0; |
return 0; |