diff options
Diffstat (limited to 'shell.c')
-rw-r--r-- | shell.c | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/shell.c b/shell.c deleted file mode 100644 index b45e2cb..0000000 --- a/shell.c +++ /dev/null @@ -1,42 +0,0 @@ -#include "shell.h" -#include <stddef.h> -#include <string.h> -#include <stdio.h> -#include "tshield/tshield.h" - -#define MAX_ARGS 5 -#define IN_LENGTH 80 - -static int process_command(int argc, char **argv); - -void shell() { - char in[IN_LENGTH]; - int argc; - char *argv[MAX_ARGS]; - - while(1) { - printf ("root@arduino$ "); - - fgets(in, IN_LENGTH, stdin); - printf("got: %d\n", in[0]); - - argc = 0; - char *p = strtok (in," \n\r"); - while (p != NULL && argc < MAX_ARGS) { - argv[argc] = p; - argc += 1; - p = strtok(NULL, " \n\r"); - } - printf("%d\n", process_command(argc, argv)); - } -} - -static int process_command(int argc, char **argv) { - if (argc < 1) return -1; - - if (strcmp(argv[0], "led") == 0) { - return 0; - } - - return -1; -}
\ No newline at end of file |