diff --git a/contrib/kolibri-libc/compile_flags.txt b/contrib/kolibri-libc/compile_flags.txt new file mode 100644 index 0000000000..78f5f15b60 --- /dev/null +++ b/contrib/kolibri-libc/compile_flags.txt @@ -0,0 +1,2 @@ +-I +source/include/ diff --git a/contrib/kolibri-libc/loader/symbols.txt b/contrib/kolibri-libc/loader/symbols.txt index 57cc5d0309..9dba19bb7e 100644 --- a/contrib/kolibri-libc/loader/symbols.txt +++ b/contrib/kolibri-libc/loader/symbols.txt @@ -76,15 +76,6 @@ rename rewind rewinddir seekdir -shell_printf -shell_puts -shell_putc -shell_getc -shell_gets -shell_cls -shell_exit -shell_get_pid -shell_ping setbuf setvbuf sin diff --git a/contrib/kolibri-libc/samples/shell_io.c b/contrib/kolibri-libc/samples/shell_io.c deleted file mode 100644 index 9f50737517..0000000000 --- a/contrib/kolibri-libc/samples/shell_io.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include - -int main(int argc, char**argv) -{ - debug_printf("%u\n", shell_get_pid()); - char string[256]; - shell_cls(); - shell_printf("Number of arguments %d\n",argc); - for(int i=0; i - -#define SHELL_OK 0 -#define SHELL_EXIT 1 -#define SHELL_PUTC 2 -#define SHELL_PUTS 3 -#define SHELL_GETC 4 -#define SHELL_GETS 5 -#define SHELL_CLS 6 -#define SHELL_PID 7 -#define SHELL_PING 8 - -#define SHELL_SHM_MAX 1024*16 - -extern char __shell_shm_name[32]; -extern char *__shell_shm; -extern int __shell_is_init; -extern void __shell_init(); - -#define SHELL_WAIT() while (*__shell_shm) _ksys_delay(5) - - - diff --git a/contrib/kolibri-libc/source/shell_api/shell_cls.c b/contrib/kolibri-libc/source/shell_api/shell_cls.c deleted file mode 100644 index c41a137822..0000000000 --- a/contrib/kolibri-libc/source/shell_api/shell_cls.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "shell.h" - -void shell_cls() -{ - __shell_init(); - *__shell_shm = SHELL_CLS; - SHELL_WAIT(); -} \ No newline at end of file diff --git a/contrib/kolibri-libc/source/shell_api/shell_exit.c b/contrib/kolibri-libc/source/shell_api/shell_exit.c deleted file mode 100644 index d579798a66..0000000000 --- a/contrib/kolibri-libc/source/shell_api/shell_exit.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "shell.h" -#include "ksys.h" - -void shell_exit() -{ - if(__shell_is_init){ - *__shell_shm = SHELL_EXIT; - SHELL_WAIT(); - _ksys_shm_close(__shell_shm_name); - } -} \ No newline at end of file diff --git a/contrib/kolibri-libc/source/shell_api/shell_get_pid.c b/contrib/kolibri-libc/source/shell_api/shell_get_pid.c deleted file mode 100644 index 9b53e25eff..0000000000 --- a/contrib/kolibri-libc/source/shell_api/shell_get_pid.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "shell.h" -#include - -unsigned shell_get_pid() -{ - unsigned pid; - __shell_init(); - *__shell_shm = SHELL_PID; - SHELL_WAIT(); - memcpy(&pid, __shell_shm+1, sizeof(unsigned)); - return pid; -} \ No newline at end of file diff --git a/contrib/kolibri-libc/source/shell_api/shell_getc.c b/contrib/kolibri-libc/source/shell_api/shell_getc.c deleted file mode 100644 index 0eaf63ca54..0000000000 --- a/contrib/kolibri-libc/source/shell_api/shell_getc.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "shell.h" - -char shell_getc() -{ - __shell_init(); - *__shell_shm = SHELL_GETC; - SHELL_WAIT(); - return *(__shell_shm+1); -} \ No newline at end of file diff --git a/contrib/kolibri-libc/source/shell_api/shell_gets.c b/contrib/kolibri-libc/source/shell_api/shell_gets.c deleted file mode 100644 index 40b55dba95..0000000000 --- a/contrib/kolibri-libc/source/shell_api/shell_gets.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "shell.h" - -void shell_gets(char *str) -{ - __shell_init(); - *__shell_shm = SHELL_GETS; - SHELL_WAIT(); - strcpy(str, __shell_shm+1); -} \ No newline at end of file diff --git a/contrib/kolibri-libc/source/shell_api/shell_init.c b/contrib/kolibri-libc/source/shell_api/shell_init.c deleted file mode 100644 index 39dfe17afb..0000000000 --- a/contrib/kolibri-libc/source/shell_api/shell_init.c +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include -#include -#include "shell.h" -#include - -char __shell_shm_name[32]; -char*__shell_shm=NULL; -int __shell_is_init=0; - -int __shell_shm_init() -{ - __shell_is_init=1; - ksys_proc_table_t *proc_info = (ksys_proc_table_t*)malloc(sizeof(ksys_proc_table_t)); - if(proc_info == NULL){ - return -1; - } - unsigned PID; - - _ksys_process_info(proc_info, -1); - PID = proc_info->pid; - free(proc_info); - - itoa(PID, __shell_shm_name); - strcat(__shell_shm_name, "-SHELL"); - return _ksys_shm_open(__shell_shm_name, KSYS_SHM_OPEN_ALWAYS | KSYS_SHM_WRITE, SHELL_SHM_MAX, &__shell_shm); -} - -void __shell_init() -{ - if(!__shell_is_init){ - if(__shell_shm_init()){ - debug_printf("SHELL problems detected!\n"); - _ksys_exit(); - } - - if(!shell_ping()){ - debug_printf("No SHELL found!\n"); - _ksys_exit(); - } - } -} \ No newline at end of file diff --git a/contrib/kolibri-libc/source/shell_api/shell_ping.c b/contrib/kolibri-libc/source/shell_api/shell_ping.c deleted file mode 100644 index 5200b63fa7..0000000000 --- a/contrib/kolibri-libc/source/shell_api/shell_ping.c +++ /dev/null @@ -1,14 +0,0 @@ -#include "shell.h" -#include -#include - -int shell_ping() -{ - __shell_init(); - *__shell_shm = SHELL_PING; - _ksys_delay(10); - if(*__shell_shm==SHELL_OK){ - return 1; - } - return 0; -} \ No newline at end of file diff --git a/contrib/kolibri-libc/source/shell_api/shell_printf.c b/contrib/kolibri-libc/source/shell_api/shell_printf.c deleted file mode 100644 index 66f5594e2c..0000000000 --- a/contrib/kolibri-libc/source/shell_api/shell_printf.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "shell.h" -#include - -void shell_printf(const char *format,...) -{ - va_list ap; - va_start (ap, format); - *__shell_shm=SHELL_PUTS; - vsnprintf(__shell_shm+1, SHELL_SHM_MAX, format, ap); - va_end(ap); - SHELL_WAIT(); -} diff --git a/contrib/kolibri-libc/source/shell_api/shell_putc.c b/contrib/kolibri-libc/source/shell_api/shell_putc.c deleted file mode 100644 index 9ecc2b1e98..0000000000 --- a/contrib/kolibri-libc/source/shell_api/shell_putc.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "shell.h" - -void shell_putc(char c) -{ - __shell_init(); - *__shell_shm = SHELL_PUTC; - *(__shell_shm+1) = c; - SHELL_WAIT(); -} \ No newline at end of file diff --git a/contrib/kolibri-libc/source/shell_api/shell_puts.c b/contrib/kolibri-libc/source/shell_api/shell_puts.c deleted file mode 100644 index a578a6088a..0000000000 --- a/contrib/kolibri-libc/source/shell_api/shell_puts.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "shell.h" -#include "string.h" - -void shell_puts(const char *str) -{ - __shell_init(); - *__shell_shm = SHELL_PUTS; - strcpy(__shell_shm+1, str); - SHELL_WAIT(); -} \ No newline at end of file