diff options
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -12,10 +12,13 @@ char cmd[64]; char *cmdptr=cmd; // Execute command from cmd buffer +// This is a test function which is buggy void exec(){ - if(!strncmp(cmd, "blink", strlen("exit"))) + if(cmd == cmdptr) + return; + else if(!strncmp(cmd, "blink", 5)) gpio_blink_led(1); - else if(!strncmp(cmd, "help", strlen("help"))) + else if(!strncmp(cmd, "help", 4)) tty_putstr(HELP); else if(cmdptr != cmd) tty_putstr("Unknown command (see help)\n\r"); @@ -30,6 +33,8 @@ void main(){ // REPL + // TODO: Handling arrows etc. + // Pressing arrow freezes the shell char c=tty_getchar(); tty_putstr(MOTD); tty_putstr(PROMPT); @@ -47,14 +52,12 @@ void main(){ cmdptr--; } } - else{ + else if(c>=32 && c <= 127){ // Printable char *cmdptr=c; cmdptr++; tty_putchar(c); } } - - return; } |
