| 3 |
* menu |
* menu |
| 4 |
* - configurable user interactive menu feature |
* - configurable user interactive menu feature |
| 5 |
* |
* |
| 6 |
* Copyright (C) 2004-2025 by Leaflet <leaflet@leafok.com> |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
| 7 |
*/ |
*/ |
| 8 |
|
|
| 9 |
|
#ifdef HAVE_CONFIG_H |
| 10 |
|
#include "config.h" |
| 11 |
|
#endif |
| 12 |
|
|
| 13 |
#include "bbs.h" |
#include "bbs.h" |
| 14 |
#include "bbs_cmd.h" |
#include "bbs_cmd.h" |
| 15 |
#include "bbs_cmd.h" |
#include "bbs_cmd.h" |
| 28 |
#include <sys/ipc.h> |
#include <sys/ipc.h> |
| 29 |
#include <sys/shm.h> |
#include <sys/shm.h> |
| 30 |
|
|
| 31 |
#define MENU_SCREEN_PATH_PREFIX "var/MENU_SCR_" |
enum _menu_constant_t |
| 32 |
#define MENU_CONF_DELIM_WITH_SPACE " ,\t\r\n" |
{ |
| 33 |
#define MENU_CONF_DELIM_WITHOUT_SPACE "\r\n" |
MENU_SET_RESERVED_LENGTH = sizeof(int16_t) * 4, |
| 34 |
|
MENU_SHMGET_RETRY_LIMIT = 10, |
| 35 |
#define MENU_SET_RESERVED_LENGTH (sizeof(int16_t) * 4) |
}; |
| 36 |
|
|
| 37 |
#define MENU_SHMGET_RETRY_LIMIT 10 |
static const char MENU_CONF_DELIM_WITH_SPACE[] = " ,\t\r\n"; |
| 38 |
|
static const char MENU_CONF_DELIM_WITHOUT_SPACE[] = "\r\n"; |
| 39 |
|
|
| 40 |
MENU_SET bbs_menu; |
MENU_SET bbs_menu; |
| 41 |
MENU_SET top10_menu; |
MENU_SET top10_menu; |
| 192 |
return -1; |
return -1; |
| 193 |
} |
} |
| 194 |
p = q; |
p = q; |
| 195 |
while (isalnum(*q) || *q == '_' || *q == '-') |
while (isalnum((int)*q) || *q == '_' || *q == '-') |
| 196 |
{ |
{ |
| 197 |
q++; |
q++; |
| 198 |
} |
} |
| 275 |
else |
else |
| 276 |
{ |
{ |
| 277 |
q = p; |
q = p; |
| 278 |
while (isalnum(*q) || *q == '_' || *q == '-') |
while (isalnum((int)*q) || *q == '_' || *q == '-') |
| 279 |
{ |
{ |
| 280 |
q++; |
q++; |
| 281 |
} |
} |
| 302 |
return -1; |
return -1; |
| 303 |
} |
} |
| 304 |
p = q; |
p = q; |
| 305 |
while (isdigit(*q)) |
while (isdigit((int)*q)) |
| 306 |
{ |
{ |
| 307 |
q++; |
q++; |
| 308 |
} |
} |
| 321 |
return -1; |
return -1; |
| 322 |
} |
} |
| 323 |
p = q; |
p = q; |
| 324 |
while (isdigit(*q)) |
while (isdigit((int)*q)) |
| 325 |
{ |
{ |
| 326 |
q++; |
q++; |
| 327 |
} |
} |
| 340 |
return -1; |
return -1; |
| 341 |
} |
} |
| 342 |
p = q; |
p = q; |
| 343 |
while (isdigit(*q)) |
while (isdigit((int)*q)) |
| 344 |
{ |
{ |
| 345 |
q++; |
q++; |
| 346 |
} |
} |
| 359 |
return -1; |
return -1; |
| 360 |
} |
} |
| 361 |
p = q; |
p = q; |
| 362 |
while (isdigit(*q)) |
while (isdigit((int)*q)) |
| 363 |
{ |
{ |
| 364 |
q++; |
q++; |
| 365 |
} |
} |
| 464 |
return -1; |
return -1; |
| 465 |
} |
} |
| 466 |
p = q; |
p = q; |
| 467 |
while (isdigit(*q)) |
while (isdigit((int)*q)) |
| 468 |
{ |
{ |
| 469 |
q++; |
q++; |
| 470 |
} |
} |
| 483 |
return -1; |
return -1; |
| 484 |
} |
} |
| 485 |
p = q; |
p = q; |
| 486 |
while (isdigit(*q)) |
while (isdigit((int)*q)) |
| 487 |
{ |
{ |
| 488 |
q++; |
q++; |
| 489 |
} |
} |
| 551 |
return -1; |
return -1; |
| 552 |
} |
} |
| 553 |
p = q; |
p = q; |
| 554 |
while (isdigit(*q)) |
while (isdigit((int)*q)) |
| 555 |
{ |
{ |
| 556 |
q++; |
q++; |
| 557 |
} |
} |
| 570 |
return -1; |
return -1; |
| 571 |
} |
} |
| 572 |
p = q; |
p = q; |
| 573 |
while (isdigit(*q)) |
while (isdigit((int)*q)) |
| 574 |
{ |
{ |
| 575 |
q++; |
q++; |
| 576 |
} |
} |
| 589 |
return -1; |
return -1; |
| 590 |
} |
} |
| 591 |
p = q; |
p = q; |
| 592 |
while (isalnum(*q) || *q == '_' || *q == '-') |
while (isalnum((int)*q) || *q == '_' || *q == '-') |
| 593 |
{ |
{ |
| 594 |
q++; |
q++; |
| 595 |
} |
} |
| 619 |
return -1; |
return -1; |
| 620 |
} |
} |
| 621 |
p = q; |
p = q; |
| 622 |
while (isdigit(*q)) |
while (isdigit((int)*q)) |
| 623 |
{ |
{ |
| 624 |
q++; |
q++; |
| 625 |
} |
} |
| 638 |
return -1; |
return -1; |
| 639 |
} |
} |
| 640 |
p = q; |
p = q; |
| 641 |
while (isdigit(*q)) |
while (isdigit((int)*q)) |
| 642 |
{ |
{ |
| 643 |
q++; |
q++; |
| 644 |
} |
} |
| 657 |
return -1; |
return -1; |
| 658 |
} |
} |
| 659 |
p = q; |
p = q; |
| 660 |
while (isdigit(*q)) |
while (isdigit((int)*q)) |
| 661 |
{ |
{ |
| 662 |
q++; |
q++; |
| 663 |
} |
} |
| 703 |
p_screen = get_menu_screen_by_id(p_menu_set, screen_id); |
p_screen = get_menu_screen_by_id(p_menu_set, screen_id); |
| 704 |
|
|
| 705 |
q = p; |
q = p; |
| 706 |
while (isalnum(*q) || *q == '_' || *q == '-') |
while (isalnum((int)*q) || *q == '_' || *q == '-') |
| 707 |
{ |
{ |
| 708 |
q++; |
q++; |
| 709 |
} |
} |
| 1428 |
void *p_shm; |
void *p_shm; |
| 1429 |
|
|
| 1430 |
// Remap shared memory in read-only mode |
// Remap shared memory in read-only mode |
| 1431 |
|
#if defined(__CYGWIN__) |
| 1432 |
|
if (shmdt(p_menu_set->p_reserved) == -1) |
| 1433 |
|
{ |
| 1434 |
|
log_error("shmdt() error (%d)\n", errno); |
| 1435 |
|
return -1; |
| 1436 |
|
} |
| 1437 |
|
p_shm = shmat(p_menu_set->shmid, p_menu_set->p_reserved, SHM_RDONLY); |
| 1438 |
|
#else |
| 1439 |
p_shm = shmat(p_menu_set->shmid, p_menu_set->p_reserved, SHM_RDONLY | SHM_REMAP); |
p_shm = shmat(p_menu_set->shmid, p_menu_set->p_reserved, SHM_RDONLY | SHM_REMAP); |
| 1440 |
|
#endif |
| 1441 |
if (p_shm == (void *)-1) |
if (p_shm == (void *)-1) |
| 1442 |
{ |
{ |
| 1443 |
log_error("shmat(menu_shm shmid = %d) error (%d)\n", p_menu_set->shmid, errno); |
log_error("shmat(menu_shm shmid = %d) error (%d)\n", p_menu_set->shmid, errno); |