diff --git a/programs/system/shell/all.h b/programs/system/shell/all.h index 9a4690f60e..880156e236 100644 --- a/programs/system/shell/all.h +++ b/programs/system/shell/all.h @@ -10,6 +10,7 @@ #include "system/kolibri.h" #include "system/stdlib.h" #include "system/string.h" +#include "system/ctype.h" #include "globals.h" #include "prototypes.h" diff --git a/programs/system/shell/compile_eng.bat b/programs/system/shell/compile_eng.bat index 487349b0dd..1ef184b56e 100644 --- a/programs/system/shell/compile_eng.bat +++ b/programs/system/shell/compile_eng.bat @@ -6,7 +6,8 @@ gcc -c shell.c gcc -c system/kolibri.c gcc -c system/stdlib.c gcc -c system/string.c -ld -nostdlib -T kolibri.ld -o shell start.o kolibri.o stdlib.o string.o shell.o +gcc -c system/ctype.c +ld -nostdlib -T kolibri.ld -o shell start.o kolibri.o stdlib.o string.o ctype.o shell.o objcopy shell -O binary erase lang.h start.o shell.o kolibri.o stdlib.o string.o kpack shell diff --git a/programs/system/shell/compile_rus.bat b/programs/system/shell/compile_rus.bat index 18f63ff2e0..f1b18b94c1 100644 --- a/programs/system/shell/compile_rus.bat +++ b/programs/system/shell/compile_rus.bat @@ -6,7 +6,8 @@ gcc -c shell.c gcc -c system/kolibri.c gcc -c system/stdlib.c gcc -c system/string.c -ld -nostdlib -T kolibri.ld -o shell start.o kolibri.o stdlib.o string.o shell.o +gcc -c system/ctype.c +ld -nostdlib -T kolibri.ld -o shell start.o kolibri.o stdlib.o string.o ctype.o shell.o objcopy shell -O binary erase lang.h start.o shell.o kolibri.o stdlib.o string.o kpack shell diff --git a/programs/system/shell/globals.h b/programs/system/shell/globals.h index ff05cc52c1..a5ce183703 100644 --- a/programs/system/shell/globals.h +++ b/programs/system/shell/globals.h @@ -1,5 +1,5 @@ -#define SHELL_VERSION "0.4.8" +#define SHELL_VERSION "0.4.9" extern char PATH[256]; extern char PARAM[256]; diff --git a/programs/system/shell/modules/module_command.c b/programs/system/shell/modules/module_command.c index 42aff58895..52b1667f51 100644 --- a/programs/system/shell/modules/module_command.c +++ b/programs/system/shell/modules/module_command.c @@ -74,6 +74,13 @@ for (;;) default: if (CMD_POS < 255) { + + if ( kol_key_control() & 0x40 ) // если включён CapsLock + if ( (kol_key_control() & 1) || (kol_key_control() & 2)) // если нажаты шифты + key = tolower(key); + else + key = toupper(key); + CMD[CMD_POS] = key; CMD_POS++; printf("%c", key); diff --git a/programs/system/shell/system/ctype.c b/programs/system/shell/system/ctype.c new file mode 100644 index 0000000000..564eec067c --- /dev/null +++ b/programs/system/shell/system/ctype.c @@ -0,0 +1,39 @@ + +#include "ctype.h" + +int toupper(int c) +{ + +if ( (c >= 97) && (c <= 122) ) + return c-32 ; + +if ( (c >= 160) && (c <= 175) ) + return c-32 ; + +if ( (c >= 224) && (c <= 239) ) + return c-80 ; + +if ( (c == 241) || (c == 243) || (c == 245) || (c == 247) ) + return c-1; + +return c; +} + +int tolower(int c) +{ + +if ( (c >= 65) && (c <= 90) ) + return c+32 ; + +if ( (c >= 128) && (c <= 143) ) + return c+32 ; + +if ( (c >= 144) && (c <= 159) ) + return c+80 ; + +if ( (c == 240) || (c == 242) || (c == 244) || (c == 246) ) + return c+1; + +return c; +} + diff --git a/programs/system/shell/system/ctype.h b/programs/system/shell/system/ctype.h new file mode 100644 index 0000000000..52233ae052 --- /dev/null +++ b/programs/system/shell/system/ctype.h @@ -0,0 +1,3 @@ + +int toupper(int c); +int tolower(int c);