C-Menu 0.2.9
A User Interface Toolkit
Loading...
Searching...
No Matches
Initializing View I/O

Populate the C-Menu View Struct and Connect Input. More...

Files

file  init_view.c
 Initialize C-Menu View Screen IO and Input.

Functions

int init_view_full_screen (Init *init)
 Initialize C-Menu View in full screen mode.
void view_calc_full_screen_dimensions (Init *init)
 Calculate the dimensions for full screen mode.
int init_view_boxwin (Init *init, char *title)
 Initialize the C-Menu View in box window mode.
void view_calc_win_dimensions (Init *init, char *title)
 Calculate the dimensions and position of the box window for C-Menu View.
int view_init_input (View *view, char *file_name)
 Initialize the input for a C-Menu View.

Detailed Description

Populate the C-Menu View Struct and Connect Input.

Function Documentation

◆ init_view_boxwin()

int init_view_boxwin ( Init * init,
char * title )

Initialize the C-Menu View in box window mode.

Note
sets up the view structure for box window mode, adjusts dimensions based on screen size, and creates a new pad for the view. It also configures various parameters such as scroll lines, command line position, and tab size.
Parameters
initPointer to the Init structure containing view settings.
titleTitle for the box window.
Returns
0 on success, -1 on failure.

view->cmdln_win: status or command line window

view->ln_win: line number window

pad for main content

Definition at line 172 of file init_view.c.

172 {
173 view = init->view;
174
175 if (view->tab_stop <= 0)
176 view->tab_stop = TABSIZE;
177 set_tabsize(view->tab_stop);
178 view->f_full_screen = false;
179
181 if (title != nullptr && title[0] != '\0')
182 strnz__cpy(view->title, title, MAXLEN - 1);
183 else {
184 if (view->argv != nullptr && view->argv[0] != nullptr &&
185 view->argv[0][0] != '\0')
186 strnz__cpy(view->title, view->argv[0], MAXLEN - 1);
187 }
188#ifdef DEBUG_RESIZE
189 ssnprintf(em0, MAXLEN - 1,
190 "init_view_boxwin(): view->box: begy=%d, begx=%d, lines=%d, "
191 "cols=%d, title=%s",
192 view->begy, view->begx, view->lines + 2, view->cols + 2,
193 view->title);
195#endif
196 if (box_new(view->lines, view->cols, view->begy, view->begx, view->title,
197 false)) {
198 ssnprintf(em0, MAXLEN - 1, "%s, line: %d", __FILE__, __LINE__ - 1);
199 ssnprintf(em1, MAXLEN - 1, "win_new(%d, %d, %d, %d, %s) failed",
200 view->lines, view->cols, view->begy, view->begx, view->title);
201 em2[0] = '\0';
202 display_error(em0, em1, em2, nullptr);
203 return (-1);
204 }
205 view->box = win_box[win_ptr];
206
208 view->cmdln_win =
209 newwin(1, view->cols, view->begy + view->lines, view->begx + 1);
210 keypad(view->cmdln_win, true);
211 idlok(view->cmdln_win, false);
212 idcok(view->cmdln_win, false);
213 wbkgrnd(view->cmdln_win, &CCC_WIN);
214 wbkgrndset(view->cmdln_win, &CCC_WIN);
215 scrollok(view->cmdln_win, false);
216#ifdef DEBUG_IMMEDOK
217 immedok(view->cmdln_win, true);
218#endif
219
221#ifdef DEBUG_RESIZE
222 ssnprintf(em0, MAXLEN - 1,
223 "init_view_boxwin(): view->ln_win: begy=%d, begx=%d, lines=%d, "
224 "cols=%d, scroll_lines=%d",
225 view->begy, view->begx, view->ln_win_lines, view->ln_win_cols,
226 view->scroll_lines);
228#endif
229 if (view->f_ln) {
230 view->ln_win = newwin(view->ln_win_lines, view->ln_win_cols,
231 view->begy + 1, view->begx + 1);
232 keypad(view->ln_win, false);
233 idlok(view->ln_win, false);
234 idcok(view->ln_win, false);
235 wbkgrnd(view->ln_win, &CCC_LN);
236 wbkgrndset(view->ln_win, &CCC_LN);
237 scrollok(view->ln_win, true);
238 wsetscrreg(view->ln_win, 0, view->scroll_lines - 1);
239 }
240#ifdef DEBUG_IMMEDOK
241 immedok(view->ln_win, true);
242#endif
244 view->pad = newpad(view->lines - 1, PAD_COLS);
245 keypad(view->pad, true);
246 idlok(view->pad, false);
247 idcok(view->pad, false);
248 wbkgrnd(view->pad, &CCC_WIN);
249 wbkgrndset(view->pad, &CCC_WIN);
250 scrollok(view->pad, true);
251 wsetscrreg(view->pad, 0, view->scroll_lines - 1);
252#ifdef DEBUG_IMMEDOK
253 immedok(view->pad, true);
254#endif
255 return (0);
256}
Init * init
Definition common.h:183
#define PAD_COLS
Definition view.h:30
View * view
Definition mem.c:48
#define MAXLEN
Definition curskeys.c:15
cchar_t CCC_LN
Definition dwin.c:152
char em1[MAXLEN]
Definition dwin.c:134
cchar_t CCC_WIN
Definition dwin.c:147
int win_ptr
Definition dwin.c:122
char em0[MAXLEN]
Definition dwin.c:133
WINDOW * win_box[MAXWIN]
Definition dwin.c:116
char em2[MAXLEN]
Definition dwin.c:135
int box_new(int, int, int, int, char *, bool)
Create a new window with optional box and title.
Definition dwin.c:783
int display_error(char *em0, char *em1, char *em2, char *em3)
Display an error message window or print to stderr.
Definition dwin.c:1059
size_t strnz__cpy(char *, const char *, size_t)
safer alternative to strncpy
Definition futil.c:278
size_t ssnprintf(char *, size_t, const char *,...)
ssnprintf was designed to be a safer alternative to snprintf.
Definition futil.c:156
void write_cmenu_log_nt(char *)
Write message to C-Menu log file without timestamp.
Definition futil.c:1655
void view_calc_win_dimensions(Init *, char *title)
Calculate the dimensions and position of the box window for C-Menu View.
Definition init_view.c:367

References View::argv, View::begx, View::begy, View::box, box_new(), CCC_LN, CCC_WIN, View::cmdln_win, View::cols, display_error(), em0, em1, em2, View::f_full_screen, View::f_ln, View::lines, View::ln_win, View::ln_win_cols, View::ln_win_lines, View::pad, View::scroll_lines, ssnprintf(), strnz__cpy(), View::tab_stop, View::title, Init::view, view, view_calc_win_dimensions(), win_box, and win_ptr.

Referenced by main(), and popup_view().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init_view_full_screen()

int init_view_full_screen ( Init * init)

Initialize C-Menu View in full screen mode.

Note
This function sets up the view structure for full screen mode and creates a new pad for the view.
Parameters
initPointer to the Init structure containing view settings.
Returns
0 on success, -1 on failure.
The function creates the following windows:
1. view->cmdln_win: Status or Command Line
2. view->ln_win: Line Number Window
3. view->pad: Main Content Pad

view->cmdln_win: status or command line window

view->ln_win: line number window

view->cmdln_win: status or command line window

Definition at line 45 of file init_view.c.

45 {
46 view = init->view;
47
48 if (view->tab_stop <= 0)
49 view->tab_stop = TABSIZE;
50 set_tabsize(view->tab_stop);
51 view->f_full_screen = true;
53#ifdef DEBUG_RESIZE
54 ssnprintf(em0, MAXLEN - 1,
55 "init_view_full_screen(): lines=%d, cols=%d, "
56 "ln_win_lines=%d, ln_win_cols=%d, "
57 "scroll_lines=%d",
58 view->lines, view->cols, view->ln_win_lines, view->ln_win_cols,
59 view->scroll_lines);
60#endif
62 view->cmdln_win =
63 newwin(1, view->cols, view->begy + view->lines - 1, view->begx);
64 keypad(view->cmdln_win, true);
65 idlok(view->cmdln_win, false);
66 idcok(view->cmdln_win, false);
67 wbkgrnd(view->cmdln_win, &CCC_WIN);
68 wbkgrndset(view->cmdln_win, &CCC_WIN);
69 scrollok(view->cmdln_win, false);
70#ifdef DEBUG_IMMEDOK
71 immedok(view->cmdln_win, true);
72#endif
74 view->ln_win = newwin(view->ln_win_lines - 1, view->ln_win_cols, 0, 0);
75 keypad(view->ln_win, false);
76 idlok(view->ln_win, false);
77 idcok(view->ln_win, false);
78 wbkgrnd(view->ln_win, &CCC_LN);
79 wbkgrndset(view->ln_win, &CCC_LN);
80 scrollok(view->ln_win, true);
81 wsetscrreg(view->ln_win, 0, view->scroll_lines - 1);
82#ifdef DEBUG_IMMEDOK
83 immedok(view->ln_win, true);
84#endif
86 view->pad = newpad(view->lines - 1, PAD_COLS);
87 if (view->pad == nullptr) {
88 ssnprintf(em0, MAXLEN - 1, "%s, line: %d", __FILE__, __LINE__ - 2);
89 ssnprintf(em1, MAXLEN - 1, "newpad(%d, %d) failed", view->lines,
90 PAD_COLS);
91 em2[0] = '\0';
92 display_error(em0, em1, em2, nullptr);
93 abend(-1, "init_view_full_screen: newpad() failed");
94 }
95 keypad(view->pad, false);
96 idlok(view->pad, false);
97 idcok(view->pad, false);
98 wbkgrnd(view->pad, &CCC_WIN);
99 wbkgrndset(view->pad, &CCC_WIN);
100 scrollok(view->pad, true);
101 wsetscrreg(view->pad, 0, view->scroll_lines - 1);
102#ifdef DEBUG_IMMEDOK
103 immedok(view->pad, true);
104#endif
105 return 0;
106}
void abend(int, char *)
Abnormal program termination.
Definition dwin.c:1336
void view_calc_full_screen_dimensions(Init *)
Calculate the dimensions for full screen mode.
Definition init_view.c:140

References abend(), View::begx, View::begy, CCC_LN, CCC_WIN, View::cmdln_win, View::cols, display_error(), em0, em1, em2, View::f_full_screen, View::lines, View::ln_win, View::ln_win_cols, View::ln_win_lines, View::pad, View::scroll_lines, ssnprintf(), View::tab_stop, Init::view, view, and view_calc_full_screen_dimensions().

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ view_calc_full_screen_dimensions()

void view_calc_full_screen_dimensions ( Init * init)

Calculate the dimensions for full screen mode.

This function calculates the dimensions for the full screen mode of the C-Menu View. It retrieves the maximum dimensions of the standard screen and sets the view parameters accordingly. It also resizes the line number window and command line window based on the new dimensions.

Parameters
initPointer to the Init structure containing view settings.

Definition at line 140 of file init_view.c.

140 {
141 view = init->view;
142 getmaxyx(stdscr, view->lines, view->cols);
143 view->ln_win_lines = view->lines;
144 view->ln_win_cols = 8;
145 view->scroll_lines = view->lines - 1;
146#ifdef DEBUG_RESIZE
147 ssnprintf(
148 em0, MAXLEN - 1,
149 "view->lines=%d, view->cols=%d, view->maxrows=%d, view->maxcols=%d",
150 view->lines, view->cols, view->smaxrow, view->smaxcol);
152#endif
153 view->cmd_line = 0;
154 view->pminrow = 0;
155 view->pmincol = 0;
156 view->sminrow = 0;
157 view->smincol = 0;
158 view->smaxrow = view->lines - 1;
159 view->smaxcol = view->cols - 1;
160 view->ln = view->page_top_ln + view->scroll_lines;
161 view->page_bot_ln = view->ln;
162}

References View::cmd_line, View::cols, View::lines, View::ln, View::ln_win_cols, View::ln_win_lines, View::page_bot_ln, View::page_top_ln, View::pmincol, View::pminrow, View::scroll_lines, View::smaxcol, View::smaxrow, View::smincol, View::sminrow, Init::view, and view.

Referenced by init_view_full_screen(), and view_full_screen_resize().

Here is the caller graph for this function:

◆ view_calc_win_dimensions()

void view_calc_win_dimensions ( Init * init,
char * title )

Calculate the dimensions and position of the box window for C-Menu View.

This function calculates the dimensions and position of the box window for the C-Menu View based on the screen size and any specified parameters in the Init structure. It ensures that the box window fits within the screen dimensions and adjusts its size and position accordingly.

Parameters
initPointer to the Init structure containing view settings.
titleTitle for the box window, used to ensure minimum width if provided.

Use view->lines and view->cols if set, otherwise calculate based on screen size with some padding. Ensure the view fits within the screen dimensions.

Definition at line 367 of file init_view.c.

367 {
368 int scr_lines, scr_cols;
369 view = init->view;
370 getmaxyx(stdscr, scr_lines, scr_cols);
371 int len = strlen(title);
372
376
377 if (init->lines != 0 && view->lines == 0)
378 view->lines = init->lines;
379 if (view->lines == 0)
380 view->lines = scr_lines * 3 / 4;
381 if (view->lines > scr_lines - 3)
382 view->lines = scr_lines - 3;
383
384 if (init->cols != 0 && view->cols == 0)
385 view->cols = init->cols;
386 if (view->cols == 0)
387 view->cols = scr_cols * 3 / 4;
388 if (view->cols < len + 4)
389 view->cols = len + 4;
390 if (view->cols > scr_cols - 4)
391 view->cols = scr_cols - 4;
392
393 if (init->begy != 0 && view->begy == 0)
394 view->begy = init->begy;
395 if (view->begy == 0)
396 view->begy = (scr_lines - view->lines) / 5;
397 if (view->begy + view->lines > scr_lines - 2)
398 view->begy = scr_lines - view->lines - 2;
399
400 if (init->begx != 0 && view->begx == 0)
401 view->begx = init->begx;
402 if (view->begx == 0)
403 view->begx = (scr_cols - view->cols) / 5;
404 if (view->begx + view->cols > scr_cols - 2)
405 view->begx = scr_cols - view->cols - 2;
406
407 view->ln_win_lines = view->lines - 1;
408 if (view->f_ln)
409 view->ln_win_cols = 8;
410 else
411 view->ln_win_cols = 0;
412
413 view->scroll_lines = view->lines - 1;
414 view->cmd_line = 0;
415
416 view->pminrow = 0;
417 view->pmincol = 0;
418 view->sminrow = view->begy + 1;
419 view->smincol = view->begx + 1;
420 view->smaxrow = view->begy + view->lines;
421 view->smaxcol = view->begx + view->cols;
422
423 view->ln = view->page_top_ln + view->scroll_lines;
424 view->page_bot_ln = view->ln;
425}

References Init::begx, View::begx, Init::begy, View::begy, View::cmd_line, Init::cols, View::cols, View::f_ln, Init::lines, View::lines, View::ln, View::ln_win_cols, View::ln_win_lines, View::page_bot_ln, View::page_top_ln, View::pmincol, View::pminrow, View::scroll_lines, View::smaxcol, View::smaxrow, View::smincol, View::sminrow, Init::view, and view.

Referenced by init_view_boxwin(), popup_view(), and view_win_resize().

Here is the caller graph for this function:

◆ view_init_input()

int view_init_input ( View * view,
char * file_name )

Initialize the input for a C-Menu View.

This function initializes the input for view, which can be a file, standard input, or a provider command to be initiated by view. It handles different input sources and sets up the necessary file descriptors and memory mapping for efficient access.

Parameters
viewPointer to the View structure to be initialized.
file_nameName of the input file or "-" for standard input.
Returns
true on success, false on failure.
Note
if a provider command is specified, set up a pipe to read its output. A child process is spawned, and view, the parent process, reads from the pipe.
If input is from a pipe or standard input, clone it to a temporary file. This allows for memory-mapping the input later. It does not support real-time updates to the input, but it allows for efficient access to the data.

Open the input file for reading and get its size.

< 200ms timeout to check for input

If user cancels while waiting for view input, kill provider_cmd child process and close pipe

If error occurs while waiting for view input, kill provider_cmd child process and close pipe

If timeout occurs while waiting for view input, kill provider_cmd child process and close pipe

If unexpected error occurs while waiting for view input, kill provider_cmd child process and close pipe

Definition at line 443 of file init_view.c.

443 {
444 struct stat sb;
445 int idx = 0;
446 pid_t pid = -1;
447 int pipe_fd[2];
448 int s_argc = 0;
449 char *s_argv[MAXARGS];
450 char tmp_str[MAXLEN];
451 view->f_in_pipe = false;
452 if (strcmp(file_name, "-") == 0) {
453 file_name = "/dev/stdin";
454 view->f_in_pipe = true;
455 }
456 if (view->provider_cmd[0] != '\0') {
457 s_argc = str_to_args(s_argv, view->provider_cmd, MAXARGS - 1);
458 if (pipe(pipe_fd) == -1) {
459 Perror("pipe(pipe_fd) failed in init_view");
460 return -1;
461 }
462 if ((pid = fork()) == -1) {
463 Perror("fork() failed in init_view");
464 return -1;
465 }
466 if (pid == 0) { // Child
467 close(pipe_fd[P_READ]);
468 dup2(pipe_fd[P_WRITE], STDOUT_FILENO);
469 close(pipe_fd[P_WRITE]);
470 execvp(s_argv[0], s_argv);
471 strnz__cpy(tmp_str, "Can't exec view start cmd: ", MAXLEN - 1);
472 strnz__cat(tmp_str, s_argv[0], MAXLEN - 1);
473 Perror(tmp_str);
474 exit(EXIT_FAILURE);
475 }
476 // Back to parent
477 destroy_argv(s_argc, s_argv);
478 close(pipe_fd[P_WRITE]);
479 dup2(pipe_fd[P_READ], STDIN_FILENO);
480 view->in_fd = dup(STDIN_FILENO);
481 view->f_in_pipe = true;
482 } else {
483 if (view->f_in_pipe)
484 view->in_fd = dup(STDIN_FILENO);
485 else {
486 /*----------------------------------------------------------------------*/
489 view->in_fd = open(file_name, O_RDONLY);
490 if (view->in_fd == -1) {
491 ssnprintf(em0, MAXLEN - 1, "%s, line: %d", __FILE__,
492 __LINE__ - 3);
493 ssnprintf(em1, MAXLEN - 1, "open %s", file_name);
494 strerror_r(errno, em2, MAXLEN);
495 display_error(em0, em1, em2, nullptr);
496 return -1;
497 }
498 if (fstat(view->in_fd, &sb) == -1) {
499 ssnprintf(em0, MAXLEN - 1, "%s, line: %d", __FILE__,
500 __LINE__ - 1);
501 ssnprintf(em1, MAXLEN - 1, "fstat %s", file_name);
502 strerror_r(errno, em2, MAXLEN);
503 display_error(em0, em1, em2, nullptr);
504 close(view->in_fd);
505 return -1;
506 }
507 view->file_size = sb.st_size;
508 if (view->file_size == 0) {
509 close(view->in_fd);
510 ssnprintf(em0, MAXLEN - 1, "%s, line: %d", __FILE__,
511 __LINE__ - 1);
512 ssnprintf(em1, MAXLEN - 1, "file %s is empty", file_name);
513 strerror_r(errno, em2, MAXLEN);
514 display_error(em0, em1, em2, nullptr);
515 return -1;
516 }
517 if (!S_ISREG(sb.st_mode))
518 view->f_in_pipe = true;
519 }
520 /*----------------------------------------------------------------------*/
521 }
522 if (view->f_in_pipe) {
523 char tmp_filename[] = "/tmp/view_XXXXXX";
524 char buf[VBUFSIZ];
525 ssize_t bytes_read = 0;
526 ssize_t bytes_written = 0;
527 close(view->in_fd);
528 view->in_fd = mkstemp(tmp_filename);
529 if (view->in_fd == -1) {
530 abend(-1, "failed to mkstemp");
531 exit(EXIT_FAILURE);
532 }
533 unlink(tmp_filename);
534 /*-----------------------------------------------------------------*/
535 bool f_wait = false;
536 int ready;
537 fd_set read_fds;
538 struct timeval timeout;
539 Chyron *wait_chyron = nullptr;
540 WINDOW *wait_win = nullptr;
541 int remaining;
542 FD_ZERO(&read_fds);
543 FD_SET(STDIN_FILENO, &read_fds);
544 timeout.tv_sec = 0;
545 timeout.tv_usec = 200000;
546 ready = select(STDIN_FILENO + 1, &read_fds, nullptr, nullptr, &timeout);
547 if (ready == 0) {
548 f_wait = true;
549 remaining = wait_timeout;
550 wait_chyron = wait_mk_chyron();
551 wait_win = wait_mk_win(wait_chyron, "WAITING for VIEW INPUT");
552 }
553 cmd_key = 0;
554 while (ready == 0 && remaining > 0 && cmd_key != KEY_F(9)) {
555 cmd_key = wait_continue(wait_win, wait_chyron, remaining);
556 if (cmd_key == KEY_F(9))
557 break;
558 FD_ZERO(&read_fds);
559 FD_SET(STDIN_FILENO, &read_fds);
560 timeout.tv_sec = 0;
561 timeout.tv_usec = 0;
562 ready =
563 select(STDIN_FILENO + 1, &read_fds, nullptr, nullptr, &timeout);
564 remaining--;
565 }
566 if (f_wait) {
567 if (wait_chyron != nullptr)
568 wait_destroy(wait_chyron);
569 }
570 if (cmd_key == KEY_F(9)) {
571 if (view->f_in_pipe && pid > 0) {
574 kill(pid, SIGKILL);
575 waitpid(pid, nullptr, 0);
576 close(pipe_fd[P_READ]);
577 }
578 Perror("No view input available");
579 return -1;
580 }
581 if (ready == -1) {
582 Perror("Error waiting for view input");
583 if (view->f_in_pipe && pid > 0) {
586 kill(pid, SIGKILL);
587 waitpid(pid, nullptr, 0);
588 close(pipe_fd[P_READ]);
589 }
590 return -1;
591 }
592 if (ready == 0) {
593 Perror("Timeout waiting for view input");
594 if (view->f_in_pipe && pid > 0) {
597 kill(pid, SIGKILL);
598 waitpid(pid, nullptr, 0);
599 close(pipe_fd[P_READ]);
600 }
601 return -1;
602 }
603 if (ready == 1 && !FD_ISSET(STDIN_FILENO, &read_fds)) {
604 Perror("Unexpected error waiting for view input");
605 if (view->f_in_pipe && pid > 0) {
608 kill(pid, SIGKILL);
609 waitpid(pid, nullptr, 0);
610 close(pipe_fd[P_READ]);
611 }
612 return -1;
613 }
614 /*-----------------------------------------------------------------*/
615 while ((bytes_read = read(STDIN_FILENO, buf, sizeof(buf))) > 0) {
616 if (write(view->in_fd, buf, bytes_read) != bytes_read) {
617 abend(-1, "unable to write tmp");
618 exit(EXIT_FAILURE);
619 }
620 bytes_written += bytes_read;
621 }
622 if (bytes_written == 0) {
623 abend(-1, "unable to read stdin");
624 exit(EXIT_FAILURE);
625 }
626 if (fstat(view->in_fd, &sb) == -1) {
627 abend(-1, "fstat failed");
628 exit(EXIT_FAILURE);
629 }
630 view->file_size = sb.st_size;
631 if (view->file_size == 0) {
632 close(view->in_fd);
633 strnz__cpy(tmp_str, "no standard input", MAXLEN - 1);
634 abend(-1, tmp_str);
635 exit(EXIT_FAILURE);
636 }
638 // waitpid(-1, nullptr, 0);
639 }
640 // Memory-map the input file for efficient access.
641 view->buf =
642 mmap(nullptr, view->file_size, PROT_READ, MAP_PRIVATE, view->in_fd, 0);
643 if (view->buf == MAP_FAILED) {
644 ssnprintf(em0, MAXLEN - 1, "%s, line: %d", __FILE__, __LINE__ - 2);
645 ssnprintf(em1, MAXLEN - 1, "mmap %s", file_name);
646 strerror_r(errno, em2, MAXLEN);
647 display_error(em0, em1, em2, nullptr);
648 close(view->in_fd);
649 return -1;
650 }
651 close(view->in_fd);
652 view->file_size = sb.st_size;
653 view->prev_file_pos = NULL_POSITION;
654 view->buf_curr_ptr = view->buf;
655 if (view->cmd_all[0] != '\0')
656 strnz__cpy(view->cmd, view->cmd_all, MAXLEN - 1);
657 for (idx = 0; idx < NMARKS; idx++)
658 view->mark_tbl[idx] = NULL_POSITION;
659 strnz__cpy(view->cur_file_str, file_name, MAXLEN - 1);
660 base_name(view->file_name, view->cur_file_str);
661 return 0;
662}
#define P_READ
Definition common.h:47
#define P_WRITE
Definition common.h:48
#define MAXARGS
Definition cm.h:30
int wait_timeout
Definition futil.c:107
#define NMARKS
Definition view.h:24
#define VBUFSIZ
Definition view.h:28
#define NULL_POSITION
Definition view.h:27
int pipe_fd[2]
Definition pick_engine.c:39
char * file_name[MAXLEN+1]
Definition whence.c:25
unsigned int cmd_key
Definition dwin.c:118
bool waitpid_with_timeout(pid_t pid, int timeout)
Definition dwin.c:1436
bool wait_destroy(Chyron *)
Destroy the waiting message window and chyron.
Definition dwin.c:1208
int wait_continue(WINDOW *, Chyron *, int)
Update the waiting message with remaining time and check for user input.
Definition dwin.c:1220
WINDOW * wait_mk_win(Chyron *, char *)
Display a popup waiting message.
Definition dwin.c:1177
int Perror(char *)
Display a simple error message window or print to stderr.
Definition dwin.c:1115
Chyron * wait_mk_chyron()
Create a Chyron struct for the waiting message.
Definition dwin.c:1166
void destroy_argv(int argc, char **argv)
Deallocates memory allocated for argument strings in argv.
Definition futil.c:230
size_t strnz__cat(char *, const char *, size_t)
safer alternative to strncat
Definition futil.c:307
bool expand_tilde(char *, int)
Replace Leading Tilde With Home Directory.
Definition futil.c:709
bool base_name(char *, char *)
Returns the base name of a file specification.
Definition futil.c:800
int str_to_args(char **, char *, int)
Converts a string into an array of argument strings.
Definition futil.c:176
Definition cm.h:248

References abend(), base_name(), View::buf, View::buf_curr_ptr, View::cmd, View::cmd_all, cmd_key, View::cur_file_str, destroy_argv(), display_error(), em0, em1, em2, expand_tilde(), View::f_in_pipe, View::file_name, View::file_size, View::in_fd, View::mark_tbl, Perror(), View::prev_file_pos, View::provider_cmd, ssnprintf(), str_to_args(), strnz__cat(), strnz__cpy(), wait_continue(), wait_destroy(), wait_mk_chyron(), wait_mk_win(), wait_timeout, and waitpid_with_timeout().

Referenced by view_file().

Here is the call graph for this function:
Here is the caller graph for this function: