SayoriOS 0.3.3

System.c
1 #include "kernel.h"
2 #include "eBat.h"
3 #include "eBatRuntime.h"
4
5 int bar_runtime_system_exec(int argc, char** argv){
7 bat_debug("[RUNTIME] [System] [EXEC] Count: %d\n", argc);
8 int ret = cli_handler_ebat(argc, argv);
9 return ret;
10 }
11
17 void bat_runtime_system_echo(char* text, int newline, int endline){
19 bat_debug("[RUNTIME] [System] [ECHO] %s\n", text);
20 if (text == NULL){
21 return;
22 }
23
24 //printf("%s%s%s", (newline == 1?"< ":""), text, (endline == 1?" \n":" "));
25 tty_printf("%s%s%s", (newline == 1?"< ":""), text, (endline == 1?" \n":" "));
26 }
27
33 void bat_runtime_system_set(char* key, char* val){
35 //bat_debug("[RUNTIME] [System] [SET] '%s' => '%s'\n", key, val);
36 //printf("[RUNTIME] [System] [SET] '%s' => '%s'\n", key, val);
37 //bat_toUpper(key);
38 //char* get = bat_runtime_system_get(key);
39
40 int len_key = (key == NULL?0:strlen(key));
41 int len_val = (val == NULL?0:strlen(val));
42
43 if (key == NULL){
44 return;
45 }
46 if (val == NULL || len_val == 0){
47 variable_write(key,"");
48 }
49 }
50
55 char* bat_runtime_system_get(char* key){
57 bat_debug("[RUNTIME] [System] [GET] '%s'\n", key);
58 //bat_toUpper(key);
59 return variable_read(key);
60 }
61
62
63 void bat_runtime_system_pause(){
65 bat_debug("[RUNTIME] [System] [Pause]\n");
66 bat_runtime_system_echo("Please, press button", 1, 1);
67 getIntKeyboardWait();
69 }
strlen
size_t strlen(const char *str)
Возращает длину строки
Definition: string.c:88