| 232 |
int ch = KEY_NULL; |
int ch = KEY_NULL; |
| 233 |
int input_ok, line, max_lines; |
int input_ok, line, max_lines; |
| 234 |
long int line_current = 0; |
long int line_current = 0; |
| 235 |
const void *p_file_shm; |
const void *p_shm; |
|
const void *p_data; |
|
| 236 |
size_t data_len; |
size_t data_len; |
| 237 |
long line_total; |
long line_total; |
| 238 |
|
const void *p_data; |
| 239 |
const long *p_line_offsets; |
const long *p_line_offsets; |
| 240 |
long int len; |
long int len; |
| 241 |
long int percentile; |
long int percentile; |
| 242 |
int loop; |
int loop; |
| 243 |
|
|
| 244 |
if ((p_file_shm = get_file_shm(filename)) == NULL) |
if ((p_shm = get_file_shm(filename, &data_len, &line_total, &p_data, &p_line_offsets)) == NULL) |
| 245 |
{ |
{ |
| 246 |
log_error("get_file_shm(%s) error\n", filename); |
log_error("get_file_shm(%s) error\n", filename); |
| 247 |
return KEY_NULL; |
return KEY_NULL; |
| 248 |
} |
} |
| 249 |
|
|
|
data_len = *((size_t *)p_file_shm); |
|
|
line_total = *((long *)(p_file_shm + sizeof(size_t))); |
|
|
p_data = p_file_shm + sizeof(data_len) + sizeof(line_total); |
|
|
p_line_offsets = p_data + data_len + 1; |
|
|
|
|
| 250 |
clrline(begin_line, SCREEN_ROWS); |
clrline(begin_line, SCREEN_ROWS); |
| 251 |
line = begin_line; |
line = begin_line; |
| 252 |
max_lines = SCREEN_ROWS - 1; |
max_lines = SCREEN_ROWS - 1; |
| 418 |
} |
} |
| 419 |
|
|
| 420 |
cleanup: |
cleanup: |
|
if (shmdt(p_file_shm) == -1) |
|
|
{ |
|
|
log_error("shmdt() error (%d)\n", errno); |
|
|
} |
|
|
|
|
| 421 |
return ch; |
return ch; |
| 422 |
} |
} |
| 423 |
|
|
| 496 |
int show_active_board() |
int show_active_board() |
| 497 |
{ |
{ |
| 498 |
static int line_current = 0; |
static int line_current = 0; |
| 499 |
static const void *p_file_shm = NULL; |
static const void *p_shm = NULL; |
|
static const void *p_data; |
|
| 500 |
static size_t data_len; |
static size_t data_len; |
| 501 |
static long line_total; |
static long line_total; |
| 502 |
|
static const void *p_data; |
| 503 |
static const long *p_line_offsets; |
static const long *p_line_offsets; |
| 504 |
|
|
| 505 |
char buffer[LINE_BUFFER_LEN]; |
char buffer[LINE_BUFFER_LEN]; |
| 506 |
long int len; |
long int len; |
| 507 |
|
|
| 508 |
if (p_file_shm == NULL) |
if (p_shm == NULL) |
| 509 |
{ |
{ |
| 510 |
if ((p_file_shm = get_file_shm(DATA_ACTIVE_BOARD)) == NULL) |
if ((p_shm = get_file_shm(DATA_ACTIVE_BOARD, &data_len, &line_total, &p_data, &p_line_offsets)) == NULL) |
| 511 |
{ |
{ |
| 512 |
log_error("get_file_shm(%s) error\n", DATA_ACTIVE_BOARD); |
log_error("get_file_shm(%s) error\n", DATA_ACTIVE_BOARD); |
| 513 |
return KEY_NULL; |
return KEY_NULL; |
| 514 |
} |
} |
|
|
|
|
data_len = *((size_t *)p_file_shm); |
|
|
line_total = *((long *)(p_file_shm + sizeof(size_t))); |
|
|
p_data = p_file_shm + sizeof(data_len) + sizeof(line_total); |
|
|
p_line_offsets = p_data + data_len + 1; |
|
| 515 |
} |
} |
| 516 |
|
|
| 517 |
clrline(3, 2 + ACTIVE_BOARD_HEIGHT); |
clrline(3, 2 + ACTIVE_BOARD_HEIGHT); |
| 532 |
prints("%s", buffer); |
prints("%s", buffer); |
| 533 |
|
|
| 534 |
line_current++; |
line_current++; |
| 535 |
if (line_current + 1 >= line_total) |
if (line_current >= line_total) |
| 536 |
{ |
{ |
| 537 |
line_current = 0; |
line_current = 0; |
| 538 |
break; |
break; |