]> rtime.felk.cvut.cz Git - sysless.git/blob - libs4c/cmdproc/cmdio_std_line.c
cmdproc: Make backspace work even in sterm
[sysless.git] / libs4c / cmdproc / cmdio_std_line.c
1 /**
2  * @file   cmdio_std_line.c
3  * @author Michal Sojka <sojkam1@fel.cvut.cz>
4  * @date   Wed Jul 31 16:05:10 2013
5  *
6  * @brief  cmd_io_line implementation for stdin/stdout.
7  *
8  */
9
10 #include <cmd_proc.h>
11 #include <string.h>
12 #include "cmdio_std.h"
13
14 #define ED_LINE_CHARS 80
15
16 char ed_line_in_std[ED_LINE_CHARS+1];
17 char ed_line_in_std_history[10*(ED_LINE_CHARS+1)];
18 char ed_line_out_std[ED_LINE_CHARS+1];
19
20
21 ed_line_buf_t ed_line_buf_in_std={
22     flg:FL_ELB_ECHO,
23     inbuf:0,
24     alloc:sizeof(ed_line_in_std),
25     maxlen:0,
26     lastch:0,
27     buf:ed_line_in_std,
28     hist:ed_line_in_std_history,
29     hist_size:sizeof(ed_line_in_std_history),
30 };
31
32 ed_line_buf_t ed_line_buf_out_std={
33     flg:FL_ELB_NOCRLF,
34     inbuf:0,
35     alloc:sizeof(ed_line_out_std),
36     maxlen:0,
37     lastch:0,
38     buf:ed_line_out_std
39 };
40
41 extern cmd_io_t cmd_io_std;
42 const cmd_io_t cmd_io_std_line={
43     putc:cmd_io_line_putc,
44     getc:NULL,
45     write:cmd_io_write_bychar,
46     read:NULL,
47     priv:{
48         ed_line:{
49             in: &ed_line_buf_in_std,
50             out:&ed_line_buf_out_std,
51             io_stack:&cmd_io_std
52         }
53     }
54 };