| 140 |
port = strtol(t4, &endptr, 10); |
port = strtol(t4, &endptr, 10); |
| 141 |
if (*endptr != '\0' || port <= 0 || port > 65535) |
if (*endptr != '\0' || port <= 0 || port > 65535) |
| 142 |
{ |
{ |
| 143 |
log_error("Invalid port value %d of menu item %d\n", port, menu_item_id); |
log_error("Invalid port value %ld of menu item %d\n", port, menu_item_id); |
| 144 |
fclose(fp); |
fclose(fp); |
| 145 |
unload_bbsnet_conf(); |
unload_bbsnet_conf(); |
| 146 |
return -3; |
return -3; |
| 212 |
char buf2[LINE_BUFFER_LEN]; |
char buf2[LINE_BUFFER_LEN]; |
| 213 |
int pos; |
int pos; |
| 214 |
|
|
| 215 |
if (len <= 0) |
if (len < 4) |
| 216 |
{ |
{ |
| 217 |
len = 1; |
len = 4; |
| 218 |
} |
} |
| 219 |
else if (len > LINE_BUFFER_LEN) |
else if (len + 2 > LINE_BUFFER_LEN) |
| 220 |
{ |
{ |
| 221 |
len = LINE_BUFFER_LEN - 1; |
len = LINE_BUFFER_LEN - 3; |
| 222 |
} |
} |
| 223 |
if (percent < 0) |
if (percent < 0) |
| 224 |
{ |
{ |
| 1313 |
ret = 1; // Normal disconnect |
ret = 1; // Normal disconnect |
| 1314 |
BBS_last_access_tm = time(NULL); |
BBS_last_access_tm = time(NULL); |
| 1315 |
t_used = BBS_last_access_tm - t_begin; |
t_used = BBS_last_access_tm - t_begin; |
| 1316 |
log_common("BBSNET disconnect, %d days %d hours %d minutes %d seconds used\n", |
log_common("BBSNET disconnect, %ld days %ld hours %ld minutes %ld seconds used\n", |
| 1317 |
t_used / 86400, t_used % 86400 / 3600, t_used % 3600 / 60, t_used % 60); |
t_used / 86400, t_used % 86400 / 3600, t_used % 3600 / 60, t_used % 60); |
| 1318 |
|
|
| 1319 |
cleanup: |
cleanup: |
| 1425 |
|
|
| 1426 |
int bbs_net() |
int bbs_net() |
| 1427 |
{ |
{ |
| 1428 |
int ch, i; |
int ch; |
| 1429 |
|
|
| 1430 |
if (load_bbsnet_conf(CONF_BBSNET) < 0) |
if (load_bbsnet_conf(CONF_BBSNET) < 0) |
| 1431 |
{ |
{ |
| 1465 |
case Ctrl('C'): // user cancel |
case Ctrl('C'): // user cancel |
| 1466 |
goto cleanup; |
goto cleanup; |
| 1467 |
case CR: |
case CR: |
| 1468 |
bbsnet_connect(bbsnet_menu.menu_item_pos[0]); |
if (bbsnet_connect(bbsnet_menu.menu_item_pos[0]) < 0) |
| 1469 |
|
{ |
| 1470 |
|
log_debug("bbsnet_connect() error\n"); |
| 1471 |
|
} |
| 1472 |
// Force cleanup anything remaining in the output buffer |
// Force cleanup anything remaining in the output buffer |
| 1473 |
clearscr(); |
clearscr(); |
| 1474 |
iflush(); |
iflush(); |
| 1478 |
bbsnet_selchange(); |
bbsnet_selchange(); |
| 1479 |
break; |
break; |
| 1480 |
case KEY_UP: |
case KEY_UP: |
| 1481 |
for (i = 0; i < STATION_PER_LINE; i++) |
for (int i = 0; i < STATION_PER_LINE; i++) |
| 1482 |
{ |
{ |
| 1483 |
menu_control(&bbsnet_menu, KEY_UP); |
menu_control(&bbsnet_menu, KEY_UP); |
| 1484 |
} |
} |
| 1485 |
bbsnet_selchange(); |
bbsnet_selchange(); |
| 1486 |
break; |
break; |
| 1487 |
case KEY_DOWN: |
case KEY_DOWN: |
| 1488 |
for (i = 0; i < STATION_PER_LINE; i++) |
for (int i = 0; i < STATION_PER_LINE; i++) |
| 1489 |
{ |
{ |
| 1490 |
menu_control(&bbsnet_menu, KEY_DOWN); |
menu_control(&bbsnet_menu, KEY_DOWN); |
| 1491 |
} |
} |