diff options
-rw-r--r-- | ihe.c | 45 |
1 files changed, 40 insertions, 5 deletions
@@ -10,6 +10,7 @@ extern cmd_table_t tab[]; #define CMK_KEYMAP1(KEY) (in_buf[0]==(KEY)&&(ret_read==1)) +#define CMK_KEYMAP4(KEY1,KEY2,KEY3,KEY4) ((in_buf[3]==(KEY1))&&(in_buf[2]==(KEY2))&&(in_buf[1]==(KEY3))&&(in_buf[0]==(KEY4))&&(ret_read==4)) #define CMD_IN_BUF_SIZE 32 typedef struct cmd_in_buf_t @@ -467,11 +468,7 @@ int main( int argc, char **argv ) g_file = file_init(); //init basic buffer - //#warning "replace" g_buf = new Buf(DEFAULT_BLK_SIZE); - //g_buf = buf_init(); - //buf_size( g_buf, DEFAULT_BLK_SIZE ); - //buf_zero( g_buf ); struct term_screen ts; memset( &ts, 0, sizeof(ts) ); @@ -514,6 +511,7 @@ int main( int argc, char **argv ) continue; } in_buf[ret_read] = 0; + //printf("ret_read=%02x %02x %02x %02x\n",in_buf[0],in_buf[1],in_buf[2],in_buf[3]); //custom echoing service to ignore some special chars like TAB custom_term_echo( (char *)in_buf ); @@ -612,7 +610,44 @@ int main( int argc, char **argv ) write(1,"$",1); } - + + //if (CMK_KEYMAP1(0x7e365b1b)) + //pagedown + if (CMK_KEYMAP4(0x7e,0x36,0x5b,0x1b)) + { + char local_cmd[] = "pagedown"; + + cmd_buf_clean(&cmd_in); + cmd_buf_add(&cmd_in, local_cmd, strlen(local_cmd)); + err = cmd_mng_exec( &cmd_mng, cmd_in.buf, cmd_in.cur_sz ); + if (err!=CMD_EOK) + { + printf("Unknow command\n"); + } + + cmd_buf_clean( &cmd_in ); + + write(1,"$",1); + } + + //pageup + if (CMK_KEYMAP4(0x7e,0x35,0x5b,0x1b)) + { + char local_cmd[] = "pageup"; + + cmd_buf_clean(&cmd_in); + cmd_buf_add(&cmd_in, local_cmd, strlen(local_cmd)); + err = cmd_mng_exec( &cmd_mng, cmd_in.buf, cmd_in.cur_sz ); + if (err!=CMD_EOK) + { + printf("Unknow command\n"); + } + + cmd_buf_clean( &cmd_in ); + + write(1,"$",1); + } + } cmd_mng_free( &cmd_mng ); |