From 333addeac3d296a6a24802c329ef75c96263d61e Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Sat, 17 Aug 2019 13:48:50 +0100 Subject: Disabled space token generation --- cmd/cmd_open.c | 8 +++++++- ihe.c | 30 ++++++++++++++++++++++++------ ihe.h | 1 + libcmd/cmd_parse.c | 2 +- libcmd/cmd_parse.ragel | 2 +- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/cmd/cmd_open.c b/cmd/cmd_open.c index bbdfc48..6ecfa8e 100644 --- a/cmd/cmd_open.c +++ b/cmd/cmd_open.c @@ -21,7 +21,7 @@ int c_open( cmd_arg_t *arg ) if ( argc != 1 ) { - printf("Neeed one argument\n"); + printf("Neeed one argument %d\n",argc); return -1; } @@ -36,5 +36,11 @@ int c_open( cmd_arg_t *arg ) + return 0; +} + +int h_open( cmd_arg_t *arg ) +{ + printf("[FILENAME] - open file"); return 0; } \ No newline at end of file diff --git a/ihe.c b/ihe.c index 14d64ff..9dcf124 100644 --- a/ihe.c +++ b/ihe.c @@ -282,13 +282,31 @@ int c_quit( cmd_arg_t *arg ) } -int c_help( cmd_arg_t *arg ) +int c_help( cmd_arg_t *args ) { - int i = 0; - printf("Command list\n"); - while ( tab[i].cmd != NULL ) + int i; + cmd_table_t *iter = &tab[0]; + //printf("0\n"); + i = 0; + while(iter[i].cmd != NULL) { - printf("%s - \n", tab[i].cmd); + + printf("%s ", iter[i].cmd); + if (iter[i].clb) + { + //printf("CLB "); + } + if (iter[i].pre) + { + //printf("PRE "); + } + if (iter[i].hlp) + { + //printf("HLP "); + iter[i].hlp(NULL); + } + + printf("\n"); i++; } return 0; @@ -396,7 +414,7 @@ cmd_table_t tab[] = { //{"quit", c_quit}, {"help", c_help, NULL, NULL, NULL}, {"?", c_help, NULL, NULL, NULL}, - {"open", c_open, NULL, NULL, NULL}, + {"open", c_open, h_open, NULL, NULL}, {"close", c_close, NULL, NULL, NULL}, {"info", c_info, NULL, NULL, NULL}, {"seek", c_seek, NULL, NULL, NULL}, diff --git a/ihe.h b/ihe.h index 8de09c7..de2950f 100644 --- a/ihe.h +++ b/ihe.h @@ -27,6 +27,7 @@ int c_flags( cmd_arg_t *arg ); int c_info( cmd_arg_t *arg ); int c_ls( cmd_arg_t *arg ); int c_open( cmd_arg_t *arg ); +int h_open( cmd_arg_t *arg ); int c_pos( cmd_arg_t *arg ); int c_pwd( cmd_arg_t *arg ); int c_read( cmd_arg_t *arg ); diff --git a/libcmd/cmd_parse.c b/libcmd/cmd_parse.c index 0377e1d..a45412c 100644 --- a/libcmd/cmd_parse.c +++ b/libcmd/cmd_parse.c @@ -244,7 +244,7 @@ _eof_trans: break; case 6: #line 57 "cmd_parse.ragel" - {te = p+1;{PR_TK_DBG("sp = ");TADD(CMDT_SP, ts,te,te-ts);}} + {te = p+1;{PR_TK_DBG("sp = ");/*TADD(CMDT_SP, ts,te,te-ts);*/}} break; case 7: #line 52 "cmd_parse.ragel" diff --git a/libcmd/cmd_parse.ragel b/libcmd/cmd_parse.ragel index 0775802..280d483 100644 --- a/libcmd/cmd_parse.ragel +++ b/libcmd/cmd_parse.ragel @@ -54,7 +54,7 @@ int print_token( char *s, char *e, int tok) binary {PR_TK_DBG("bin = ");TADD(CMDT_BIN, ts,te,te-ts);}; quoted_string {PR_TK_DBG("qstr = ");TADD(CMDT_QSTR, ts,te,te-ts);}; word {PR_TK_DBG("word = ");TADD(CMDT_WORD, ts,te,te-ts);}; - sp {PR_TK_DBG("sp = ");TADD(CMDT_SP, ts,te,te-ts);}; + sp {PR_TK_DBG("sp = ");/*TADD(CMDT_SP, ts,te,te-ts);*/}; float {PR_TK_DBG("float= ");TADD(CMDT_FLOAT, ts,te,te-ts);}; *|; -- cgit v1.2.3