SHELL 0.8.2

- big refactoring, now uses libc.obj
- added kfetch command

git-svn-id: svn://kolibrios.org@8827 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Rustem Gimadutdinov (rgimad)
2021-06-12 21:34:41 +00:00
parent 112c948922
commit 68cf3e4293
59 changed files with 1617 additions and 2317 deletions

View File

@@ -1,17 +0,0 @@
all:
fasm start.asm start.o
kos32-gcc -c -fno-builtin shell.c
kos32-gcc -c -fno-builtin system/kolibri.c
kos32-gcc -c -fno-builtin system/stdlib.c
kos32-gcc -c -fno-builtin system/string.c
kos32-gcc -c -fno-builtin system/ctype.c
kos32-ld -nostdlib -T kolibri.ld -o shell start.o kolibri.o stdlib.o string.o ctype.o shell.o
kos32-objcopy shell -O binary
clean:
rm -f *.o
rm -f bin/rus/shell
rm -f bin/eng/shell
install:
cp shell $(DIR)

View File

@@ -1,228 +1,267 @@
Shell 0.8.2 // 13.06.2021 // rgimad
* use libj.obj instead of built-in "libc"
* big refactoring:
- fix indentation
- string constants moved to locale/.../globals.h files
* add new command - kfetch
it is like neofetch for KolibriOS
prints logo and main system information.
* other fixes
Shell 0.8.1 // 14.04.2020 - 01.04.2021 // rgimad, turbocat, Kenshin
rgimad:
* fixed bug with ctrl+v
* added navigation in current string by Home, End
* directory highlighting in ls command output
* Now for incorrect scripts (which doesnt start with #SHS) shell says
that they are incorrect, not "File not found".
Also, translated comments from russian to english in two files.
* added mv command
* added ren command
* now ls works also with relative pathes
* fixed bug in strrchr
* fixed bug with cd ../
* fixed cd . and cd ./ behavior
* added output redirection to file (> >>) for echo command
e.g. echo "<html>">123.txt ; echo a b c >> y.txt
turbocat:
* Added new API: SC_GET_PID
* Fixed data type pid - unsigned int.
* Fixed cmd_ps output pid;
* Added new SC_PING api
* Renamed from SC_GET_PID to SC_PID
* added pkill command
Kenshin:
* shell.inc now suports sc_ping & sc_pid functions
* update docs
Shell 0.7.7 // 06.02.2017 // Leency Shell 0.7.7 // 06.02.2017 // Leency
* help <EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EBA2AE><EFBFBD> ᯨ᮪ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * help теперь выводит список комманд в три колонки
* ps <EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EBA2AE><EFBFBD><><E0A0A7><EFBFBD> <20><><EFBFBD>, <20><EFBFBD><E1AFAE><EFBFBD><EFBFBD><E3A5AC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * ps теперь выводит размер ОЗУ, используемый процессом
* ls <EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EBA2AE><EFBFBD> <20><><EFBFBD><><E4A0A9> <20><> <20> <20><><EFBFBD><EFBFBD>, <20> <20> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * ls теперь выводит все файлы не в одну, а в несколько колонок
<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><><E1A0AC><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><><E4A0A9> <20> <20><><EFBFBD><EFBFBD><EFBFBD> размер колонок расчитывается исходя из самого длинного имени файла в папке
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD> ᯨ᪮<E1AFA8> <20><> <20><EFBFBD><E0A5A6><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><20><><EFBFBD><EFBFBD> '-1' старый вывод списком по прежнему доступен через ключ '-1'
Shell 0.7.6 // 06.02.2017 // Siemargl Shell 0.7.6 // 06.02.2017 // Siemargl
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><20><EFBFBD><E1AFAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 64-bit ࠧ<><E0A0A7><EFBFBD><EFBFBD><><E4A0A9><EFBFBD>. * Файловые операции используют 64-bit размеры файлов.
cp <file> <dest> <EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20> <dest> - <EFBFBD><EFBFBD><EFBFBD><EFBFBD> cp <file> <dest> теперь понимает, если <dest> - каталог
cp <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> 1<><31>, <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1A2AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> cp использует буфер 1Мб, или не более половины свободной памяти
Shell 0.7.5 // 06.01.2017 // Siemargl Shell 0.7.5 // 06.01.2017 // Siemargl
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E4A8AA>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><E0A5AB> <20><><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD>, <20><EFBFBD> <20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD> * Мелкие багфиксы, изменена логика обработки стрелок вверх/вниз, чтобы как у всех
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> waitfor <20> <20><><EFBFBD><E0A8A0> ps <20> <20><><EFBFBD><E0A0AC> Добавлена команда waitfor и вариант ps с параметром
Shell 0.7.4 // 23.01.2014 // Albom Shell 0.7.4 // 23.01.2014 // Albom
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD> Ctrl+C <20> <20><><EFBFBD><E2A0A2> Ctrl+V <20><><EFBFBD><><E6A5AB><EFBFBD><EFBFBD>) * Работа с буфером обмена (копирование Ctrl+C и вставка Ctrl+V строки целиком)
Shell 0.7.3 // 28.11.2013 // Albom Shell 0.7.3 // 28.11.2013 // Albom
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E8A8A1> <20><><E1A8AC><EFBFBD><EFBFBD><EFBFBD> % <20> <20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * Исправлена ошибка с символом % в истории команд
Shell 0.7.2 // 26.10.2013 // Albom Shell 0.7.2 // 26.10.2013 // Albom
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> .shell <EFBFBD><EFBFBD><EFBFBD><20> /sys/settings/ * Файл .shell перенесен в /sys/settings/
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "cd .." * Исправлена команда "cd .."
Shell 0.7.1 // 19.10.2013 // Albom Shell 0.7.1 // 19.10.2013 // Albom
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E8A8A1>, <20><><EFBFBD><EFA7A0><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><E1A0AD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><20><EFBFBD><E2A5AD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><> <20><><EFBFBD><EFBFBD><EFBFBD> Up <EFBFBD> Down) * Исправлена ошибка, связанная с зависанием при попытке чтения пустой истории команд (по клавишам Up и Down)
Shell 0.7.0 // 13.10.2013 // Albom Shell 0.7.0 // 13.10.2013 // Albom
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD>", "<22><><EFBFBD>", Del) * Переработан модуль ввода команды (добавлена обработка клавиш "влево", "вправо", Del)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD> * Мелкие исправления
Shell 0.6.4 // 09.10.2013 // Leency Shell 0.6.4 // 09.10.2013 // Leency
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E2ADAE><EFBFBD><E2A5AB><EFBFBD><EFBFBD> <20><><20> <20><><EFBFBD><E0A8AF><EFBFBD> * Поддержка относительных путей в скриптах
Shell 0.6.3 // 20.09.2013 // Albom Shell 0.6.3 // 20.09.2013 // Albom
* msvc-style <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><EFBFBD><EFBFBD><E7A5AD> <20><><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (ᯠᨡ<E1AFA0> CleverMouse <EFBFBD> Kirakishou!) * msvc-style атрибуты для отключения выравнивания в структурах (спасибо CleverMouse и Kirakishou!)
Shell 0.6.2 // 24.02.2013 // Albom Shell 0.6.2 // 24.02.2013 // Albom
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1A8AC><EFBFBD><EFBFBD><EFBFBD> (\n, \t, \", \', \\, \?) * Добавлена обработка управляющих символов (\n, \t, \", \', \\, \?)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD> * Мелкие исправления
Shell 0.6.1 // 17.02.2013 // Albom Shell 0.6.1 // 17.02.2013 // Albom
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><20><EFBFBD><E8A8A1> <20><><EFBFBD><EFBFBD><EFBFBD><E0A5AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * Простая обработка ошибок внутренних команд
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> killall <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ନ஢<EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><E0A0AC><EFBFBD> all <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> kill * Команда killall трансформирована в параметр all команды kill
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0AEA2><><E4A0A9> History.txt <EFBFBD> 1251 <EFBFBD><EFBFBD> 866 * Изменена кодировка файла History.txt с 1251 на 866
Shell 0.6 // 16.02.2013 // Albom Shell 0.6 // 16.02.2013 // Albom
+ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E1AAA0> <20>ணࠬ<E0AEA3><E0A0AC>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><EFBFBD> <20><EFBFBD><E0AEA1><EFBFBD>. <20><><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD>) <20><><EFBFBD> <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E5AEA4><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>窨. <20>.<2E>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC> <20><> /rd/1/File managers, <EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD> + Добавлена возможность запускать программы, имена которых или путь к которым содержат пробелы. Имя программы (возможно с путём к ней) для этого необходимо заключать в кавычки. Т.е. наконец-то можно запустить программу из /rd/1/File managers, не переходя в неё
+ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E3ADAA><EFBFBD><><E0A0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0AEAA><EFBFBD><EFBFBD> <20><><EFBFBD><E0A5AC><EFBFBD><EFBFBD><EFBFBD> <20><> int argc, char* argv[], <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E8A5AD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><20><><EFBFBD><EFBFBD> <20><><EFBFBD><E0A0AC>) + Добавлена функция разделения строковой переменной на int argc, char* argv[], что означает возможность улучшения команд (обработка нескольких параметров)
+ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> cp (<28><><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD><><E4A0A9>). <20><EFBFBD><E0A8AD><EFBFBD><EFBFBD><EFBFBD> <20><>易⥫쭮 <20><><EFBFBD> <20><><EFBFBD><E0A0AC><EFBFBD><EFBFBD> - <20><><EFBFBD><><E4A0A9>-<2D><><EFBFBD><EFBFBD><EFBFBD><E7ADA8> <20> <20><><EFBFBD><><E4A0A9>-१<><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E2AAA8> (<28><><20><><EFBFBD><E2A0AB><EFBFBD>), ⠪ <20> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E7A8AD><EFBFBD><EFBFBD><EFBFBD> <20> /). <20><><EFBFBD><EFBFBD><E7A5AD> <20><><><E0A0A7><EFBFBD><><E4A0A9> - 4 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> + Добавлена команда cp (копирование файла). Принимает обязательно два параметра - имя файла-источника и имя файла-результата. Имена могут быть краткими (в текущем каталоге), так и с полным путём (должны начинаться с /). Ограничение на размер файла - 4 Гбайта
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0AEA2> <20><><EFBFBD><E9A5AD> <20><> <20><EFBFBD><E8A8A1> <20> <20><><EFBFBD>᮫쭮<E1AEAB> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * Исправлена кодировка в сообщении об ошибке в консольном приложении
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ਨ (<28><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><><E1AEA1> * Клавиши истории (вверх и вниз) поменяны между собой
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>ਨ 㢥<><E3A2A5><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * Количество команд в истории увеличено с пяти до десяти
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><EFBFBD><E0A5A4><EFBFBD><E0A5A6><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * Уменьшено количество предупреждений при компиляции
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ccpuid <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><E0A0AC><EFBFBD> cpu <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ver * Команда ccpuid преобразована в параметр cpu команды ver
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E4A0A9><EFBFBD> ᡮન * Исправления в пакетных файлах сборки
+ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0A8AC> <20><><EFBFBD>᮫쭮<E1AEAB><ECADAE> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><E1A5AC><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><> <20><><EFBFBD> <20><><EFBFBD> ᡮન + Добавлен пример консольного приложения на ассемблере и пакетный файл для его сборки
Shell 0.5.4 // 04.06.2012 // Albom Shell 0.5.4 // 04.06.2012 // Albom
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E1AFAE><EFBFBD><EFA5AC> <20><><EFBFBD><EFBFBD><E1AEAB><EFBFBD><EFBFBD> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1AEA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> pid-SHELL, <EFBFBD><EFBFBD><EFBFBD> pid - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD> * Исправлен интерфейс исполняемых консольных приложений. Теперь они должны создавать буфер с именем pid-SHELL, где pid - идентификатор процесса без заглавных нулей
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ccpuid, free, killall * Реинкарнированы команды ccpuid, free, killall
+ <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> history + Добавлена команда history
Shell 0.5.3 // 19.04.2012 // Albom Shell 0.5.3 // 19.04.2012 // Albom
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> pwd * Исправление в команде pwd
Shell 0.5.2 // 16.04.2012 // Albom Shell 0.5.2 // 16.04.2012 // Albom
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ls * Исправление в команде ls
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD> * Незначительные другие исправления
Shell 0.5.1 // 15.04.2012 // Albom Shell 0.5.1 // 15.04.2012 // Albom
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A5AB><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD> * Некоторые незначительные исправления
Shell 0.5 // 23.03.2012 // Albom Shell 0.5 // 23.03.2012 // Albom
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E1AEAB><EFBFBD><EFBFBD> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><E8A5AB><EFBFBD> <20><><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * Добавлена поддержка консольных приложений, которые общаются с шеллом через именованную область
Shell 0.4.6 // 30.01.2011 // Albom Shell 0.4.6 // 30.01.2011 // Albom
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E3A4A0><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> killall <EFBFBD> ccpuid (<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><E5AEA4><EFBFBD> <20><><EFBFBD><E1AAAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD> 2 <20><><EFBFBD><EFBFBD>) * Временно удалены команды killall и ccpuid (чтобы вернуть, необходимо раскомментировать 2 строчки)
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E2AEA2> <20><><EFBFBD><E0AEAA> * Исправления в текстовых строках
Shell 0.4.52 // 25.10.2010 // Pterox Shell 0.4.52 // 25.10.2010 // Pterox
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "killall" - 㡨<><E3A1A8><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD> OS/IDLE. * Добавлена команда "killall" - убивает все процессы кроме OS/IDLE.
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * Фиксы
Shell 0.4.51 // 21.10.2010 // Pterox Shell 0.4.51 // 21.10.2010 // Pterox
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "turnoff" <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> "shutdown", "kerver" <EFBFBD><EFBFBD><EFBFBD><EFBFBD> - ⥯<><E2A5AF><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "ver kernel"; <EFBFBD><EFBFBD>. * Команда "turnoff" переименована в "shutdown", "kerver" удалена - теперь её заменяет "ver kernel"; фиксы.
Shell 0.4.5 // 19.10.2010 // Pterox Shell 0.4.5 // 19.10.2010 // Pterox
======================================= =======================================
<EFBFBD>ணࠬ<EFBFBD><EFBFBD><><E2A5AF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBAAAE><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>). <20>ணࠬ<E0AEA3><E0A0AC> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2><EFBFBD><EFBFBD>. Программа теперь многоязыковая (английский, и русский язык). Программа полностью русифицированна.
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "free" <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> "memory" - <20><><EFBFBD> <20><><EFBFBD><E7ADAE><EFBFBD>. * Команда "free" переименована в "memory" - для точности.
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> turnoff (<28><EFBFBD><EBAAAB><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>), kerver (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> KolibriOS), uptime; reboot ⥯<><E2A5AF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0A5A7><EFBFBD><EFBFBD><E3A6A0> <20><><EFBFBD><EFBFBD> ("reboot kernel") * Добавлены команды turnoff (выключить компьютер), kerver (версия ядра KolibriOS), uptime; reboot теперь может перезагружать ядро ("reboot kernel")
Shell 0.4.4 // 20.08.2010 // Albom Shell 0.4.4 // 20.08.2010 // Albom
======================================= =======================================
1) <EFBFBD> <20><><EFBFBD>४⭮ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A0A5><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD> 1) шелл корректно завершается при закрытии окна
2) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> 2 <20><EFBFBD><E8A8A1> 2) исправлено ещё 2 ошибки
3) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 3) добавлены 2 команды:
* sleep - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><E0A0AC><EFBFBD> - <20><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᥪ㭤<E1A5AA>. ⮫쪮 楫<><E6A5AB> <20><>. * sleep - ждать. параметр - время в сотых частях секунды. только целое число.
* ccpuid - <EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>樨 (<28><><EFBFBD><EFBFBD> <20><><EFBFBD>) <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> cpuid ࠧ<><E0A0A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><E1ABA5><EFBFBD>饬 ᥬ<><E1A5AC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD>稫 ࠧ<><E0A0A7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20>ணࠬ<E0AEA3><E0A0AC>). * ccpuid - вывод в консоль информации (пока скудно) о процессоре. пользы мало, но давно хотел с командой cpuid разобраться (в следующем семестре буду студентам курс читать, включил разбор команды в программу).
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><><E0A5A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1ABAE><EFBFBD><EFBFBD>. <20><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: есть много идей. некоторые легко реализуются, некоторые сложнее. если интересно:
1) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0A5AC><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD>!), <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E2AEA2> <20><>ଥ (<28><> <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E3ADAA><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0><EFBFBD><EFBFBD>. <20> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><><E0A0A1><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> 1) добавить переменную (одну!), в которую будет результат в текстовой форме (не то что возвращает функция) записываться. с ней можно будет работать из командной строки
2) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E2A5AA><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E1ABA5><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A2A5><20><><EFBFBD><E1ABA0> 2) внедрить простую стековую машину для вычислений с вещественными числами
Shell 0.4.3 // 20.08.2010 // Albom Shell 0.4.3 // 20.08.2010 // Albom
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> 0.4.1 <EFBFBD> 0.4.2. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><E5AEA4><EFBFBD><><E4A0A9>, <20><><EFBFBD><EFBFBD><EFBFBD><E5AEA4><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>樨 (࠭<><E0A0AD><EFBFBD> <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ꥪ⭨<EAA5AA><E2ADA8> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E2AAA0>, <20><><EFBFBD><E5AEA4><EFBFBD><EFBFBD> <20> <20><><E8A5AB><EFBFBD> <20><> <20><EFBFBD><EBAAAB><EFBFBD>) * Смесь версий 0.4.1 и 0.4.2. Теперь в архиве все исходные файлы, необходимые для компиляции (раньше использовались объектники с моими обёртками, исходники я с шеллом не выкладывал)
Shell 0.4.2 // 28.08.2009 // diamond Shell 0.4.2 // 28.08.2009 // diamond
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>४⭮<E0A5AA> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A5AD><><E0A0A1><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>, ࠡ<><EFBFBD> ⮫쪮 <20><><EFBFBD><E7A8AD> <20> <20><><EFBFBD><E1ABA5><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD><EFBFBD> <20><> svn, <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1A1AE><EFBFBD>). <20><><EFBFBD><E0A5AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E0AEA2> <20> VS2008 <EFBFBD> LTCG, <EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E8A0AC><EFBFBD><EFBFBD> <20> <20><><EFBFBD><E2A8AC><EFBFBD><EFBFBD> <20><><><E0A0A7><EFBFBD><EFBFBD> * Добавил корректное завершение работы при закрытии окна консоли, работает только начиная с последней на данный момент версией библиотеки (лежит на svn, включена в ночную сборку). Перекомпилировал в VS2008 с LTCG, ещё пошаманил с оптимизацией по размеру
Shell 0.4.1 // 16.03.2009 // Albom Shell 0.4.1 // 16.03.2009 // Albom
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><E0A0A2><EFBFBD><EFBFBD><20><EFBFBD><E8A8A1><EFBFBD><EFBFBD>. * версия с исправленными ошибками.
* <EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> alias, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> clear. * работает команда alias, добавлена команда clear.
Shell 0.4 // 12.08.2008 // Albom Shell 0.4 // 12.08.2008 // Albom
======================================= =======================================
1) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD> <20><EFBFBD><E1A5A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><> 256 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) 1) Работает схема псевдонимов (до 256 команд)
- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> alias (<28><><EFBFBD> <20><><EFBFBD><E0A0AC>) - просмотр по команде alias (без параметров)
- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E1A5A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> <20><><EFBFBD><E0A8AF> (<28><20><><20> .shell): alias <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - добавление псевдонима команды с клавиатуры или в скрипте (в том числе и .shell): alias новая команда = старая команда
- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E0A5A3><EFBFBD><EFBFBD><E0AEA7><EFBFBD><EFBFBD><E1A8AC>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><EFBFBD><E0A8A4><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> .shell <20><><EFBFBD><><E2A0AA><EFBFBD> <20><><EFBFBD><EFBFBD> - команды регистрозависимые, поэтому поклонникам ДОС придётся внести в .shell строки такого вида
alias dir = ls alias dir = ls
alias DIR = ls alias DIR = ls
alias Dir = ls alias Dir = ls
alias DIr = ls alias DIr = ls
<EFBFBD> <20>.<2E>. и т.д.
- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0A5AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><E0A8AC>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1ABA5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: - встроенные команды переназвать невозможно, например, бессмысленна команда:
alias ls=somecommand alias ls=somecommand
- <EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E2ABA0><EFBFBD> <20><><EFBFBD><EFBFBD><20><><EFBFBD><E0A0AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0ACA0><EFBFBD>, <20><><20><><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - при отладке получал странную информацию, но так как у меня всё работает, то пока изменений вносить не планирую
2) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E1AAA0> <20> <20><><EFBFBD><E0A0AC>஬ (<28><><><E1A0AC><EFBFBD><>, <20><><EFBFBD><EFBFBD><E0A8AC>) 2) Теперь шелл можно запускать с параметром (из самого себя, например)
- ᨭ⠪<EFBFBD><EFBFBD><EFBFBD>: - синтаксис:
shell <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> shell команда
- <EFBFBD><EFBFBD><EFBFBD>: - пример:
shell /sys/somescript shell /sys/somescript
- <EFBFBD><EFBFBD><EFBFBD> <20>⮬ .shell <20><> <20><><EFBFBD><EFBFBD><EFBFBD><E1AAA0><EFBFBD><EFBFBD> - при этом .shell не запускается
3) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> more 3) Реализована команда more
- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><EFBFBD><E2AEA2> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E4A0A9><EFBFBD> (<28><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><> <20><><EFBFBD><EFBFBD><E8ABAE> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><E0A0A2><EFBFBD><EFBFBD><><E1A8AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) - просмотр текстовых и бинарных файлов (вроде бы задача простая, но пришлось повозиться с управляющими символами)
- <EFBFBD><EFBFBD> <20><><><E0A5AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0A8A2><EFBFBD> <20><><EFBFBD><EFBFBD>訥 䠩<><E4A0A9> - очень не рекомендуется просматривать большие файлы
Shell 0.3 // 07.08.2008 // Albom Shell 0.3 // 07.08.2008 // Albom
======================================= =======================================
1) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><20><>ਯ⮢ 1) Возможность запуска скриптов
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><E2A0A2><EFBFBD><EFBFBD><><E1AEA1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * каждая строка должна представляет собой команду
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E2A0A5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><><E1A8AC><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E7A8A2><EFBFBD><EFBFBD><EFBFBD> CR+LF (Windows) <EFBFBD><EFBFBD><EFBFBD> LF(UNIX) <EFBFBD><EFBFBD><EFBFBD> CR(Mac) * строкой считается набор символов, который заканчивается CR+LF (Windows) или LF(UNIX) или CR(Mac)
* <EFBFBD><20><><EFBFBD> <20><><EFBFBD><E7A8AD><EFBFBD><EFBFBD><EFBFBD> <20> #, <20><> <20><><EFBFBD> <20><><EFBFBD> (<28>.<2E>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>਩) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * если строка начинается с #, то вся строка (т.е. комментарий) игнорируется
* <EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> #SHS * скрипт должен начитаться с #SHS
* <EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>᪥ 襫<><E8A5AB> <20><><EFBFBD><E2AEAC><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><E1AAA0><EFBFBD><EFBFBD> <20><><EFBFBD> .shell * при запуске шелла автоматически запускается скрипт .shell
2) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> 5 (<28><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>樨) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2) История из 5 (можно изменить при компиляции) введённых команд
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> - UP/DOWN * перемещение по истории - UP/DOWN
3) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> alias, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1A8AD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3) Команда alias, которая позволяет вводить синонимы для команд
* <EFBFBD><EFBFBD> 256 (<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>樨) ᨭ<><E1A8AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * до 256 (можно изменить при компиляции) синонимов
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><><EFBFBD> ⮫쪮 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><E1ACAE><><E1A8AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20> <20><><EFBFBD><20><><EFBFBD><EFBFBD> <20><><><E0A5A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * пока работает только добавление и просмотр синонимов, а отработка пока не реализована
Shell 0.2 // 04.08.2008 // Albom Shell 0.2 // 04.08.2008 // Albom
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20>㭪樨 * добавил новые функции
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᠫ ᮡ<><EFBFBD><E2A2A5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E6A5A4><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> * написал собственную процедуру ввода команды
Shell 0.11 // 01.08.2008 // Albom Shell 0.11 // 01.08.2008 // Albom
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> free <EFBFBD> reboot, <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><E0A0A2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E8A8A1> * Добавил команды free и reboot, внёс некоторые изменения, исправил найденные ошибки
Shell 0.1 // 29.07.2008 // Albom Shell 0.1 // 29.07.2008 // Albom
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: about, cd, date, echo, exit, help, kill, ls, ps, pwd, ver * Реализованы (не полностью) команды: about, cd, date, echo, exit, help, kill, ls, ps, pwd, ver
* <EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><20>ணࠬ<E0AEA3><E0A0AC> (<28><20><><><E3AAA0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>) <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><E2A0AB><EFBFBD> /rd/1 <20><><20><><EFBFBD><E2A0AB><EFBFBD> * При запуске программы (если не указан полный путь) она ищется в каталоге /rd/1 и текущем каталоге
Shell 0.02 // 27.07.2008 // Albom Shell 0.02 // 27.07.2008 // Albom
======================================= =======================================
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: * Реализовал команды:
exit - <EFBFBD><EFBFBD> exit - выход
ls (<EFBFBD> <20><><EFBFBD><E0A0AC><20> <20><><EFBFBD>) - <20><EFBFBD> ᯨ᪠ <20><><EFBFBD><E0A5AA> ls (с параметром и без) - вывод списка директории
pwd - <EFBFBD><20><><EFBFBD><E2A0AB> pwd - текущий каталог
ps - ᯨ᮪ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20> <20><> PID ps - список процессов и их PID
kill - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> PID kill - завершить процесс по PID
help (<EFBFBD> <20><><EFBFBD><E0A0AC><20> <20><><EFBFBD>) - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> help (с параметром и без) - помощь
Shell 0.01 // 27.07.2008 // Albom Shell 0.01 // 27.07.2008 // Albom
======================================= =======================================
* <EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>㭪樮<E3ADAA><E6A8AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><> <20><> <20><> <20> <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> console.obj * Решил написать функциональный шелл на Си с использованием console.obj
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E1A4A5><EFBFBD> <20><EFBFBD><E3ADAA><EFBFBD> <20><EFBFBD><E2A4A5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><E0A0AC>஢, <20><><E2A0AA><><E0A5A0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> help (<28><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><E0A0AC>), ver <EFBFBD> exit * Пока сделал функцию отделения команды и параметров, а также реализовал команды help (пока без параметров), ver и exit

View File

@@ -1,26 +1,10 @@
if tup.getconfig("NO_FASM") ~= "" or tup.getconfig("NO_GCC") ~= "" then return end if tup.getconfig("NO_TCC") ~= "" then return end
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_gcc.lua")
LDFLAGS = LDFLAGS .. " -T kolibri.ld"
-- compile shell
if tup.getconfig("LANG") == "ru"
then C_LANG = "LANG_RUS"
else C_LANG = "LANG_ENG" -- this includes default case without config
end
if tup.getconfig("TUP_PLATFORM") == "win32" TCC="kos32-tcc"
-- on win32 '#' is not a special character, but backslash and quotes would be printed as is CFLAGS = "-I../../develop/ktcc/trunk/libc.obj/include"
then tup.rule('echo #define ' .. C_LANG .. ' 1 > %o', {"lang.h"}) LDFLAGS = "-nostdlib ../../develop/ktcc/trunk/bin/lib/crt0.o -L../../develop/ktcc/trunk/bin/lib"
-- on unix '#' should be escaped
else tup.rule('echo "#define" ' .. C_LANG .. ' 1 > %o', {"lang.h"})
end
tup.append_table(OBJS, tup.rule("start.asm", "fasm %f %o", "start.o"))
compile_gcc{"shell.c", "system/kolibri.c", "system/stdlib.c", "system/string.c", "system/ctype.c", extra_inputs = {"lang.h"}}
link_gcc("shell")
-- compile ASM test LIBS = "-ltcc -lc.obj"
tup.rule("test.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "asmtest") COMMAND=string.format("%s %s %s %s %s", TCC, CFLAGS, LDFLAGS , "%f -o %o", LIBS)
-- compile C test
OBJS = {"start.o", "kolibri.o", "stdlib.o", "string.o", "ctype.o"} -- remove shell.o tup.rule("shell.c", COMMAND .. tup.getconfig("KPACK_CMD"), "shell")
compile_gcc{"test.c"}
link_gcc("ctest")

View File

@@ -8,9 +8,36 @@
#include "system/boolean.h" #include "system/boolean.h"
#include "system/kolibri.h" #include "system/kolibri.h"
#include "system/stdlib.h" //#include "system/stdlib.h"
#include "system/string.h" //#include "system/string.h"
#include "system/ctype.h" //#include "system/ctype.h"
//#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/ksys.h>
//--------
int strnicmp(const char* string1, const char* string2, unsigned count)
{
int pc = 0;
while (1)
{
if (toupper(*string1)<toupper(*string2))
return -1;
if (toupper(*string1)>toupper(*string2))
return 1;
if (*string1=='\0' || pc == count)
return 0;
string1++;
string2++;
pc++;
}
}
//--------
extern int _FUNC(sprintf)(char* buffer, const char* format, ...);
#include "globals.h" #include "globals.h"
#include "prototypes.h" #include "prototypes.h"
@@ -18,7 +45,31 @@
// from main file (shell.c). TODO - in future move to library // from main file (shell.c). TODO - in future move to library
void get_file_dir_loc(char *filepath, char *dir_path); void get_file_dir_loc(char *filepath, char *dir_path);
#include "system/console.c" //#include "system/console.c"
#include <conio.h>
#define con_exit (*con_exit)
#define con_set_title (*con_set_title)
#define con_write_asciiz (*con_write_asciiz)
#define con_write_string (*con_write_string)
#define con_printf (*con_printf)
#define con_get_flags (*con_get_flags)
#define con_set_flags (*con_set_flags)
#define con_get_font_height (*con_get_font_height)
#define con_get_cursor_height (*con_get_cursor_height)
#define con_set_cursor_height (*con_set_cursor_height)
#define con_getch (*con_getch)
#define con_getch2 (*con_getch2)
#define con_kbhit (*con_kbhit)
#define con_gets (*con_gets)
#define con_gets2_callback (* con_gets2_callback)
#define con_gets2 (*con_gets2)
#define con_cls (*con_cls)
#define con_get_cursor_pos (*con_get_cursor_pos)
#define con_set_cursor_pos (*con_set_cursor_pos)
#define printf con_printf
#define gets con_gets
#define getch con_getch2
#include "cmd/cmd_about.c" #include "cmd/cmd_about.c"
#include "cmd/cmd_help.c" #include "cmd/cmd_help.c"
@@ -45,6 +96,7 @@ void get_file_dir_loc(char *filepath, char *dir_path);
#include "cmd/cmd_shutdown.c" #include "cmd/cmd_shutdown.c"
#include "cmd/cmd_uptime.c" #include "cmd/cmd_uptime.c"
#include "cmd/cmd_history.c" #include "cmd/cmd_history.c"
#include "cmd/cmd_kfetch.c"
#include "cmd/cmd_cp.c" #include "cmd/cmd_cp.c"
#include "cmd/cmd_mv.c" #include "cmd/cmd_mv.c"
#include "cmd/cmd_ren.c" #include "cmd/cmd_ren.c"
@@ -58,6 +110,5 @@ void get_file_dir_loc(char *filepath, char *dir_path);
#include "modules/module_alias.c" #include "modules/module_alias.c"
#include "modules/module_parameters.c" #include "modules/module_parameters.c"
typedef unsigned int size_t; //typedef unsigned int size_t;
/// ===========================================================

2
programs/system/shell/build.sh Executable file
View File

@@ -0,0 +1,2 @@
../../develop/ktcc/trunk/source/kos32-tcc -I../../develop/ktcc/trunk/libc.obj/include -nostdlib ../../develop/ktcc/trunk/bin/lib/crt0.o -L../../develop/ktcc/trunk/bin/lib shell.c system/kolibri.c -o shell -ltcc -lc.obj
../../other/kpack/linux/kpack shell

View File

@@ -1,10 +1,6 @@
int cmd_about(char param[]) int cmd_about(char param[]) {
{ printf(CMD_ABOUT_MSG, SHELL_VERSION);
return TRUE;
char message[] = {"Shell %s\n\r"};
printf(message, SHELL_VERSION);
return TRUE;
} }

View File

@@ -1,20 +1,17 @@
int cmd_alias(char arg[]) int cmd_alias(char arg[]) {
{ int result;
int result; if (NULL == arg || '\0' == arg[0]) {
alias_list();
if (NULL == arg || '\0' == arg[0]) return TRUE;
{
alias_list();
return TRUE;
} }
result = alias_check(arg); result = alias_check(arg);
if ( ( 0 != result ) && ( -1 != result ) ) if ( ( 0 != result ) && ( -1 != result ) )
alias_add(arg); alias_add(arg);
return TRUE; return TRUE;
} }

View File

@@ -1,58 +1,47 @@
int cmd_cd(char dir[]) int cmd_cd(char dir[])
{ {
char temp[256];
unsigned result;
char temp[256]; if (NULL == dir) {
unsigned result; printf(CMD_CD_USAGE);
if (NULL == dir)
{
#if LANG_ENG
printf(" cd <directory>\n\r");
#elif LANG_RUS
printf(" cd <<3C><><EFBFBD><E0A5AA><EFBFBD><EFBFBD><EFBFBD>>\n\r");
#endif
return TRUE;
}
if ( 0 == strcmp(dir, ".") || 0 == strcmp(dir, "./") )
return TRUE;
if ( ( 0 == strcmp(dir, "..") || 0 == strcmp(dir, "../") ) && ( 0 != strcmp(cur_dir, "/")) )
{
cur_dir[strlen(cur_dir)-1]='\0';
dir_truncate(cur_dir);
set_cwd(cur_dir);
return TRUE;
}
if ( '/' == dir[0])
{
if ( dir_check(dir) )
{
strcpy(cur_dir, dir);
set_cwd(cur_dir);
return TRUE; return TRUE;
}
return FALSE;
} }
else
{
strcpy(temp, cur_dir);
if (cur_dir[strlen(cur_dir)-1] != '/')
strcat(temp, "/");
strcat(temp, dir);
if ( dir_check(temp) ) if ( 0 == strcmp(dir, ".") || 0 == strcmp(dir, "./") )
{
strcpy(cur_dir, temp);
set_cwd(cur_dir);
return TRUE; return TRUE;
if ( ( 0 == strcmp(dir, "..") || 0 == strcmp(dir, "../") ) && ( 0 != strcmp(cur_dir, "/")) ) {
cur_dir[strlen(cur_dir)-1]='\0';
dir_truncate(cur_dir);
set_cwd(cur_dir);
return TRUE;
}
if ( '/' == dir[0]) {
if ( dir_check(dir) )
{
strcpy(cur_dir, dir);
set_cwd(cur_dir);
return TRUE;
}
return FALSE;
}
else {
strcpy(temp, cur_dir);
if (cur_dir[strlen(cur_dir)-1] != '/')
strcat(temp, "/");
strcat(temp, dir);
if ( dir_check(temp) ) {
strcpy(cur_dir, temp);
set_cwd(cur_dir);
return TRUE;
} }
return FALSE; return FALSE;
} }
} }

View File

@@ -1,7 +1,6 @@
int cmd_clear(char param[]) int cmd_clear(char param[]) {
{ con_cls();
con_cls(); return TRUE;
return TRUE;
} }

View File

@@ -19,11 +19,7 @@ int cmd_cp(char param[])
if (argc != 2) if (argc != 2)
{ {
#if LANG_ENG printf(CMD_CP_USAGE);
printf(" cp <file_in> <file_out>\n\r");
#elif LANG_RUS
printf(" cp <<3C><><EFBFBD><EFBFBD><EFBFBD>> <१<><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>\n\r");
#endif
parameters_free(argc, argv); parameters_free(argc, argv);
return TRUE; return TRUE;
} }

View File

@@ -1,32 +1,22 @@
int cmd_date(char param[]) int cmd_date(char param[])
{ {
unsigned date; unsigned date;
unsigned time; unsigned time;
date = kol_system_date_get(); date = kol_system_date_get();
#if LANG_ENG printf(CMD_DATE_DATE_FMT,
printf(" Date [dd.mm.yy]: %x%x.%x%x.%x%x", (date&0xf00000)>>20, (date&0xf0000)>>16, // day
#elif LANG_RUS (date&0xf000)>>12, (date&0xf00)>>8, //month
printf(" <20><><EFBFBD><EFBFBD> [<5B><>.<2E><>.<2E><>]: %x%x.%x%x.%x%x", (date&0xf0)>>4, (date&0xf) ); // year
#endif
(date&0xf00000)>>20, (date&0xf0000)>>16, // day
(date&0xf000)>>12, (date&0xf00)>>8, //month
(date&0xf0)>>4, (date&0xf) ); // year
time = kol_system_time_get(); time = kol_system_time_get();
printf(CMD_DATE_TIME_FMT,
(time&0xf0)>>4, (time&0xf), // hours
(time&0xf000)>>12, (time&0xf00)>>8, // minutes
(time&0xf00000)>>20, (time&0xf0000)>>16 ); // seconds
#if LANG_ENG return TRUE;
printf("\n\r Time [hh:mm:ss]: %x%x:%x%x:%x%x\n\r",
#elif LANG_RUS
printf("\n\r <20><EFBFBD> [<5B><>:<3A><>:<3A><>]: %x%x:%x%x:%x%x\n\r",
#endif
(time&0xf0)>>4, (time&0xf), // hours
(time&0xf000)>>12, (time&0xf00)>>8, // minutes
(time&0xf00000)>>20, (time&0xf0000)>>16 ); // seconds
return TRUE;
} }

View File

@@ -1,9 +1,9 @@
int cmd_exit(char param[]) int cmd_exit(char param[])
{ {
free(ALIASES); free(ALIASES);
_exit(1); con_exit(1);
kol_exit(); kol_exit();
return TRUE; return TRUE;
} }

View File

@@ -1,19 +1,15 @@
int cmd_memory(char param[]) int cmd_memory(char param[])
{ {
unsigned total, free, used; unsigned total, free, used;
total = kol_system_mem(); total = kol_system_mem();
free = kol_system_memfree(); free = kol_system_memfree();
used = total - free; used = total - free;
#if LANG_ENG printf (CMD_FREE_FMT,
printf (" Total [kB / MB / %%]: %-7d / %-5d / 100\n\r Free [kB / MB / %%]: %-7d / %-5d / %d\n\r Used [kB / MB / %%]: %-7d / %-5d / %d\n\r",
#elif LANG_RUS
printf (" <20><EFBFBD> [<5B><> / <20><> / %%]: %-7d / %-5d / 100\n\r <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [<5B><> / <20><> / %%]: %-7d / %-5d / %d\n\r <20><EFBFBD><E1AFAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [<5B><> / <20><> / %%]: %-7d / %-5d / %d\n\r",
#endif
total, total/1024, free, free/1024, (free*100)/total, used, total/1024-free/1024, 100-(free*100)/total ); total, total/1024, free, free/1024, (free*100)/total, used, total/1024-free/1024, 100-(free*100)/total );
return TRUE; return TRUE;
} }

View File

@@ -1,46 +1,30 @@
int cmd_help(char cmd[]) int cmd_help(char cmd[]) {
{ int i;
int i; if ( !strlen(cmd) ) {
int columns_max=3;
#if LANG_ENG printf (CMD_HELP_AVAIL, NUM_OF_CMD);
char available[]={" %d commands available:\n\r"}; for (i = 0; i < NUM_OF_CMD; i++) {
#elif LANG_RUS printf(" %-12s", COMMANDS[i].name);
char available[]={" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><E3AFAD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n\r"}; if ((i) && ((i+1)%columns_max == 0)) printf("\n\r");
#endif }
if ((i)%columns_max != 0) printf("\n\r");
if ( !strlen(cmd) ) return TRUE;
{
int columns_max=3;
printf (available, NUM_OF_CMD);
for (i = 0; i < NUM_OF_CMD; i++)
{
printf(" %-12s", COMMANDS[i].name);
if ((i) && ((i+1)%columns_max == 0)) printf("\n\r");
} }
if ((i)%columns_max != 0) printf("\n\r"); else {
return TRUE; for (i=0; i<NUM_OF_CMD; i++)
} if ( !strcmp(cmd, COMMANDS[i].name) ) {
else printf(COMMANDS[i].help);
{ return TRUE;
for (i=0; i<NUM_OF_CMD; i++)
if ( !strcmp(cmd, COMMANDS[i].name) )
{
printf(COMMANDS[i].help);
return TRUE;
} }
#if LANG_ENG printf (CMD_HELP_CMD_NOT_FOUND, cmd);
printf (" Command \'%s\' not found.\n\r", cmd); printf (CMD_HELP_AVAIL, NUM_OF_CMD);
#elif LANG_RUS for (i = 0; i < NUM_OF_CMD; i++)
printf (" <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \'%s\' <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n\r", cmd); printf(" %s\n\r", COMMANDS[i].name);
#endif }
printf (available, NUM_OF_CMD);
for (i = 0; i < NUM_OF_CMD; i++)
printf(" %s\n\r", COMMANDS[i].name);
}
return FALSE; return FALSE;
} }

View File

@@ -1,14 +1,9 @@
int cmd_history(char arg[]) int cmd_history(char arg[]) {
{ int i;
for (i = CMD_HISTORY_NUM_REAL - 1; i >= 0; i--) {
int i; printf("%s\n", CMD_HISTORY[i]);
for (i = CMD_HISTORY_NUM_REAL - 1; i >= 0; i--)
{
printf("%s\n", CMD_HISTORY[i]);
} }
return TRUE;
return TRUE;
} }

View File

@@ -1,106 +0,0 @@
/* turbocat2001 */
#if LANG_ENG
#define HELP "info <object_name>\n"
#define FILE_NOT_FOUND "Object '%s' not found!\n"
#define OBJECT_INFO "Object '%s' information:\n\n"
#define TYPE "Type: "
#define DIR "'Folder'"
#define PART "'Part'"
#define FILE "'File'"
#define CREATED "Created: %02d.%02d.%02d %02d:%02d:%02d\n"
#define MODIFID "Modified: %02d.%02d.%02d %02d:%02d:%02d\n"
#define DATE_TIME " Date Time\n"
#define ATTRIB "Attributes: "
#define RO "'Read only' "
#define HIDDEN "'Hidden' "
#define SYS "'System' "
#define NOT_ARCHIV "'Not archived' "
#define FILE_SIZE "\nFile size: %u KB (%u B)\n"
#elif LANG_RUS
#define HELP "info <<3C><><EFBFBD>_<EFBFBD><5F><EFBFBD><EAA5AA>>\n"
#define FILE_NOT_FOUND "<22><><EFBFBD> '%s' <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n"
#define OBJECT_INFO "<22><><EFBFBD><EFBFBD><EFBFBD><E0ACA0><EFBFBD> <20><> <20><><EFBFBD><EAA5AA> '%s':\n\n"
#define TYPE "<22><><EFBFBD>: "
#define DIR "'<27><><EFBFBD><EFBFBD><EFBFBD>'"
#define PART "'<27><><EFBFBD>'"
#define FILE "'<27><><EFBFBD><EFBFBD>'"
#define CREATED "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %02d.%02d.%02d %02d:%02d:%02d\n"
#define MODIFID "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %02d.%02d.%02d %02d:%02d:%02d\n"
#define DATE_TIME " <20><><EFBFBD><EFBFBD> <20><EFBFBD>\n"
#define ATTRIB "<22><><EFBFBD><E0A8A1><EFBFBD>: "
#define RO "'<27><><EFBFBD><20><><EFBFBD> <20><EFBFBD><E2A5AD>' "
#define HIDDEN "'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' "
#define SYS "'<27><><EFBFBD><EFBFBD><E2A5AC><EFBFBD>' "
#define NOT_ARCHIV "'<27><> <20><><EFBFBD><E5A8A2><EFBFBD>' "
#define FILE_SIZE "\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E4A0A9>: %u K<> (%u <20>)\n"
#endif
int cmd_info(char param[])
{
byte is_dir=0, is_part=0; // Folder or part?
char* argv[100];
if(1 != parameters_prepare(param, argv)) //get number of parameters
{
printf(HELP);
return TRUE;
}
FS_struct_BDVK *info=NULL; // BDVK struct define
info=get_bdvk(argv[0]); // Get file info (BDVK)
if(info==NULL)
{
printf(FILE_NOT_FOUND, argv[0]);
return TRUE;
}
printf(OBJECT_INFO, argv[0]);
printf(TYPE);
if (info->attrib & (1 << 4))
{
printf(DIR);
is_dir=1;
}
else if (info->attrib & (1 << 3))
{
printf(PART);
is_part=1;
}
else
{
printf(FILE);
}
printf("\n\n");
printf(DATE_TIME); // Show date and time
printf(CREATED, info->c_date.d, info->c_date.m, info->c_date.y, info->c_time.h, info->c_time.m, info->c_time.s);
printf(MODIFID, info->m_date.d, info->m_date.m, info->m_date.y, info->m_time.h, info->m_time.m, info->m_time.s);
printf("\n");
printf(ATTRIB); // Show Attributes
if (info->attrib & (1 << 0))
{
printf(RO);
}
if (info->attrib & (1 << 1))
{
printf(HIDDEN);
}
if (info->attrib & (1 << 2))
{
printf(SYS);
}
if (info->attrib & (1 << 5))
{
printf(NOT_ARCHIV);
}
printf("\n");
if (!is_dir && (info->size)>=0 && !is_part) // If dir or part then not show file size
{
printf(FILE_SIZE, info->size/1024, info->size);
}
return TRUE;
}

View File

@@ -0,0 +1,53 @@
void get_str_meminfo(char *str) {
unsigned mem_all_mib = kol_system_mem() / 1024;
unsigned mem_free_mib = kol_system_memfree() / 1024;
sprintf(str, "%uMiB / %uMiB", mem_all_mib - mem_free_mib, mem_all_mib);
}
int cmd_kfetch(char param[]) {
char *str_krnl_ver = malloc(64);
get_str_kernel_version(str_krnl_ver, "%d.%d.%d.%d. SVN-rev.: %d");
char *str_uptime = malloc(64);
get_str_uptime(str_uptime, "%d day(s), %d:%d:%d.%d");
char *str_resolution = malloc(24);
ksys_pos_t resol = _ksys_screen_size();
sprintf(str_resolution, "%u x %u", resol.x + 1, resol.y + 1);
char *str_cpu_info = malloc(16);
get_str_cpu_info(str_cpu_info);
char *str_meminfo = malloc(24);
get_str_meminfo(str_meminfo);
printf(/*"\033[0;34;40m \033[0m\n\r"*/
/*"\033[0;34;40m \033[0m\n\r"*/
/*"\033[0;34;40m \033[0m\n\r"*/
"\033[0;34;40m .\033[0;31;40m \033[0;34;40m \033[0m\n\r"
"\033[0;34;40m t\033[0;1;30;40m@\033[0;34;40m.\033[0;31;40m \033[0;34;40m \033[0m\n\r"
"\033[0;34;40m ;8\033[0;1;30;40m8\033[0;34;40m8\033[0;1;30;40m8\033[0;32;40m.\033[0;34;40m.\033[0;32;40m \033[0;34;40m \033[0;31;40m.\033[0;34;40mS\033[0;1;30;46m88\033[0;1;35;47m8\033[0;35;44mX\033[0;34;40m;\033[0;32;40m.:\033[0;5;30;40mX\033[0;1;30;46mX8\033[0;34;40m8\033[0m\n\r"
"\033[0;34;40m \033[0;32;40m \033[0;34;40m t\033[0;5;36;40m8\033[0;5;36;46m@ \033[0;5;37;46m%%\033[0;5;37;47m.\033[0;5;37;46m@\033[0;34;46m8\033[0;31;40mt\033[0;34;40m.\033[0;32;40m.\033[0;34;40m \033[0;31;40m \033[0;1;30;40m8\033[0;1;36;46m%%\033[0;5;37;46m8\033[0;5;1;35;44m8\033[0;1;34;45m8\033[0;30;44m8\033[0;32;40m;;\033[0;5;36;40m8\033[0;37;46m@\033[0;5;37;44m8\033[0;5;35;44m:\033[0;1;30;45m8\033[0;5;34;40m8\033[0m\n\r"
"\033[0;34;40m@\033[0;5;35;40m8\033[0;1;30;44m8\033[0;5;35;40m8\033[0;35;44m8\033[0;1;30;45m@\033[0;35;44m8\033[0;1;30;45m8\033[0;34;45m8\033[0;1;30;45m8\033[0;1;34;45m8\033[0;1;37;47mt\033[0;5;37;46m@\033[0;1;30;46m8S\033[0;5;37;46m8X\033[0;5;36;46m.t\033[0;1;30;44m8\033[0;31;40m \033[0;32;40m \033[0;34;40m:\033[0;5;36;40m8\033[0;1;30;46m@\033[0;1;34;47m8\033[0;5;37;45m8\033[0;5;35;44m \033[0;1;30;45m8\033[0;1;30;46m88\033[0;36;47m@\033[0;5;37;44m8\033[0;5;35;44m \033[0;5;35;45m;\033[0;5;35;44m.\033[0;37;45m8\033[0;1;30;44mX\033[0;32;40m \033[0m %s\n\r"
"\033[0;34;40m \033[0;31;40m \033[0;32;40m \033[0;34;40m.\033[0;32;40m.\033[0;34;40m;S@\033[0;5;30;40m8\033[0;33;41m8\033[0;1;33;43m;\033[0;5;33;43m \033[0;1;33;47m8\033[0;5;33;43m \033[0;1;33;43mt\033[0;36;47m8\033[0;5;36;46m \033[0;1;36;46m%%\033[0;5;34;40m8\033[0;1;30;46m%%8\033[0;5;37;46mX\033[0;5;36;46m%%\033[0;5;35;45m.\033[0;5;36;44m.\033[0;37;46m8\033[0;1;34;47m@\033[0;1;36;47mX\033[0;5;1;35;44m8\033[0;5;37;44m8\033[0;5;1;34;45m8\033[0;1;35;45m:\033[0;1;34;47m8\033[0;1;30;45m8\033[0;5;34;40m8\033[0;31;40m: \033[0m %s%s\n\r"
"\033[0;34;40m \033[0;31;40m \033[0;32;40m \033[0;34;40m \033[0;32;40m.::\033[0;34;40m.\033[0;31;40m;\033[0;1;30;43m8\033[0;5;1;33;41m8\033[0;5;33;43m \033[0;5;33;41m \033[0;5;37;43mX\033[0;5;36;46m8:\033[0;1;36;46mS.\033[0;5;36;46m;@\033[0;1;34;45m88\033[0;1;34;46m8\033[0;1;37;47m.\033[0;5;1;34;45m8\033[0;5;37;45m8\033[0;5;1;34;45m8\033[0;1;35;47m8\033[0;5;1;35;44m8\033[0;5;35;44m \033[0;35;47m8\033[0;35;44m%%\033[0;34;40m;. \033[0;31;40m \033[0m %s%s\n\r"
"\033[0;34;40m \033[0;31;40m \033[0;32;40m \033[0;34;40m .\033[0;31;40m;\033[0;1;30;41m@\033[0;5;31;41mS\033[0;5;33;41m \033[0;5;1;31;43m8\033[0;1;30;43m8\033[0;5;36;46m88\033[0;5;37;46mX\033[0;1;36;47m@\033[0;1;36;46mS\033[0;1;34;47m@\033[0;1;35;47m@\033[0;5;37;44m8\033[0;5;1;34;45m8\033[0;5;35;44m;\033[0;1;34;45m8\033[0;5;35;44m;\033[0;35;47m8\033[0;5;1;35;44m8\033[0;1;30;45m8\033[0;5;35;40m8\033[0;34;40m%%\033[0;32;40m \033[0;34;40m \033[0;31;40m \033[0m %s%s\n\r"
"\033[0;34;40m \033[0;31;40m \033[0;32;40m \033[0;34;40m \033[0;32;40m \033[0;34;40m \033[0;32;40m:\033[0;5;33;40mS\033[0;1;32;46m8\033[0;37;43mS\033[0;1;32;47m8\033[0;37;46mS\033[0;5;37;42m8\033[0;5;36;46mX\033[0;36;47m8\033[0;1;30;46m8\033[0;5;35;44mX\033[0;1;34;45m88\033[0;1;30;45m8\033[0;37;45m@\033[0;1;34;45m8\033[0;1;30;45m8\033[0;1;30;44m@\033[0;34;40m8\033[0;32;40m%%\033[0;34;40m; \033[0;32;40m \033[0;34;40m \033[0;31;40m \033[0m %s%s\n\r"
"\033[0;34;40m \033[0;32;40m \033[0;34;40m .\033[0;32;40m.@\033[0;1;36;46m%%\033[0;5;36;42m;\033[0;1;33;47mX\033[0;5;37;46m8\033[0;5;37;42m8\033[0;5;33;43m \033[0;5;36;46m8\033[0;1;34;46m8\033[0;1;30;45m8\033[0;34;45m8\033[0;1;30;45m8\033[0;5;34;44m.\033[0;1;30;45m8\033[0;5;34;40m@\033[0;34;40mS:\033[0;32;40m;\033[0;34;40m: \033[0;32;40m \033[0m %s%s\n\r"
"\033[0;34;40m \033[0;32;40m \033[0;34;40m \033[0;32;40m \033[0;34;40m.\033[0;31;40m;\033[0;5;36;40m8\033[0;1;36;46mt\033[0;5;36;42m.\033[0;1;33;47m@\033[0;5;36;42m \033[0;1;36;46m@X\033[0;5;36;46mX\033[0;1;36;46mS\033[0;1;30;46mX\033[0;5;34;44m8\033[0;5;35;40m;\033[0;1;30;44mS\033[0;34;40m \033[0;32;40m.\033[0;34;40m.\033[0;31;40m \033[0;34;40m \033[0;32;40m \033[0m\n\r"
"\033[0;34;40m \033[0;32;40m \033[0;34;40m \033[0;32;40m .\033[0;1;30;40mX\033[0;1;30;46m@\033[0;1;36;46m%%\033[0;5;36;42mt\033[0;5;37;43m@\033[0;1;32;47m8\033[0;5;36;46m;\033[0;1;36;46m%%S\033[0;1;30;46m@t\033[0;5;36;40m8\033[0;34;40m. \033[0;31;40m \033[0;34;40m \033[0;32;40m \033[0;34;40m \033[0m\n\r"
"\033[0;34;40m \033[0;32;40m \033[0;34;40m \033[0;32;40m :;\033[0;5;32;40m8\033[0;1;30;46mS\033[0;32;46m8\033[0;5;32;42m.\033[0;1;32;43m8\033[0;5;37;42m88\033[0;1;36;46mX\033[0;1;30;46m.\033[0;5;36;40mX\033[0;30;44m8\033[0;31;40m:\033[0;34;40m \033[0m\n\r"
"\033[0;34;40m \033[0;32;40m \033[0;34;40m \033[0;32;40m \033[0;34;40m \033[0;32;40m \033[0;31;40m \033[0;34;40m \033[0;32;40m;\033[0;5;32;40m8\033[0;5;36;40m8\033[0;32;46m8\033[0;5;36;40mt \033[0;1;30;46m8\033[0;5;35;44m8\033[0;37;45m@\033[0;5;35;44m%%\033[0;5;35;40m8\033[0;32;40m \033[0;34;40m \033[0m\n\r"
"\033[0;34;40m \033[0;32;40m \033[0;34;40m \033[0;32;40m \033[0;34;40m \033[0;32;40m \033[0;31;40m \033[0;34;40m .\033[0;31;40m \033[0;5;34;40mX\033[0;1;30;45m8\033[0;34;45m8\033[0;1;30;45m8\033[0;5;34;44m8\033[0;1;30;45m8\033[0;1;35;47m8\033[0;5;36;44m8\033[0;1;30;40m8\033[0;31;40m \033[0;34;40m \033[0m\n\r"
"\033[0;34;40m \033[0;32;40m \033[0;34;40m \033[0;31;40m \033[0;30;44m8\033[0;1;34;45m88\033[0;1;30;45m8\033[0;5;35;44m%%\033[0;1;34;45m8\033[0;5;35;44m;\033[0;5;37;45m8\033[0;34;45m@\033[0;34;40m@\033[0;32;40m.\033[0;31;40m.\033[0;34;40m \033[0m\n\r"
"\033[0;34;40m \033[0;32;40m \033[0;34;40m \033[0;31;40m :\033[0;5;35;40m8\033[0;1;34;45m8\033[0;1;30;45m8\033[0;5;35;44m%%\033[0;37;45m@\033[0;5;35;44m:\033[0;5;35;45mS\033[0;5;35;44m%%\033[0;35;47m8\033[0;1;30;44m8\033[0;31;40m.\033[0;34;40m.\033[0;32;40m \033[0;34;40m \033[0m\n\r"
"\033[0;34;40m \033[0;31;40m \033[0;34;40m \033[0;30;44m8\033[0;1;34;45m888\033[0;5;37;45m@\033[0;35;47m8\033[0;5;35;44mt\033[0;35;47m8\033[0;5;35;44mt\033[0;5;35;45m;\033[0;30;44m8\033[0;32;40m;\033[0;31;40m \033[0;32;40m \033[0;34;40m \033[0m\n\r"
"\033[0;34;40m \033[0;31;40m \033[0;34;40m \033[0;31;40m.\033[0;1;30;40m8\033[0;5;37;45m@\033[0;5;35;44m:\033[0;1;30;45m8\033[0;5;34;44m \033[0;5;35;45m \033[0;1;34;44m8\033[0;1;35;45m.\033[0;5;34;40mX\033[0;34;40m@\033[0;32;40mS\033[0;31;40m \033[0;34;40m \033[0m\n\r"
"\033[0;34;40m \033[0;31;40m \033[0;34;40m \033[0;31;40m \033[0;34;40m.;\033[0;1;30;40m8\033[0;1;30;44m8\033[0;34;40m8\033[0;5;34;40m8\033[0;32;40m%%\033[0;34;40m8;\033[0;32;40m;\033[0;31;40m.\033[0;32;40m \033[0;31;40m \033[0;34;40m \033[0m\n\r"
"\033[0;34;40m \033[0;31;40m \033[0;34;40m \033[0;32;40m .\033[0;31;40m .:\033[0;32;40m.\033[0;31;40m.\033[0;32;40m.\033[0;31;40m.\033[0;32;40m.\033[0;31;40m \033[0;32;40m \033[0;34;40m \033[0m\n\r",
"\033[0;36mOS\033[0m: KolibriOS", "\033[0;36mKernel\033[0m: ", str_krnl_ver, "\033[0;36mUptime\033[0m: ", str_uptime, "\033[0;36mResolution\033[0m: ", str_resolution, "\033[0;36mCPU\033[0m: ", str_cpu_info, "\033[0;36mMemory\033[0m: ", str_meminfo);
free(str_krnl_ver);
free(str_uptime);
free(str_resolution);
free(str_cpu_info);
free(str_meminfo);
return TRUE;
}

View File

@@ -1,36 +1,29 @@
int cmd_kill(char param[]) int cmd_kill(char param[])
{ {
unsigned process;
int result;
int i;
unsigned process; if ( strlen(param) == 0 ) {
int result; printf(CMD_KILL_USAGE);
int i; return TRUE;
if ( strlen(param) == 0 )
{
printf(" kill <PID>\n\r");
return TRUE;
} }
if (!strcmp(param, "all")) if (!strcmp(param, "all")) {
{ for (i = 2;i<256;i++) {
for (i = 2;i<256;i++) kol_kill_process(i);
{
kol_kill_process(i);
} }
return TRUE; return TRUE;
} }
else else {
{ process = atoi(param);
process = _atoi(param); if ( 0 != process ) {
if ( 0 != process ) result = kol_process_kill_pid(process);
{ if (result < 0)
result = kol_process_kill_pid(process); return FALSE;
if (result < 0) else
return FALSE; return TRUE;
else
return TRUE;
} }
} }

View File

@@ -1,127 +1,126 @@
int cmd_ls(char dir[]) int cmd_ls(char dir[]) {
{
kol_struct70 k70; kol_struct70 k70;
unsigned *n; unsigned *n;
unsigned num_of_file; // number of files in directory unsigned num_of_file; // number of files in directory
unsigned *t; unsigned *t;
unsigned type_of_file; // check is this a file or a folder unsigned type_of_file; // check is this a file or a folder
int i, result; int i, result;
char tmp[FILENAME_MAX]; char tmp[FILENAME_MAX];
bool single_column_mode = FALSE; bool single_column_mode = FALSE;
k70.p00 = 1; k70.p00 = 1;
k70.p04 = 0; k70.p04 = 0;
//k70.p08 = 0; //k70.p08 = 0;
k70.p12 = 2; // just for test exist & read number of entries k70.p12 = 2; // just for test exist & read number of entries
k70.p16 = (unsigned) malloc(32+k70.p12*560); k70.p16 = (unsigned) malloc(32+k70.p12*560);
k70.p20 = 0; k70.p20 = 0;
if (!strnicmp(dir,"-1",1)) if (!strnicmp(dir,"-1",1))
{
single_column_mode = TRUE;
dir += 3;
}
if ( !strlen(dir) ) // if argument is empty, list current directory
k70.p21 = cur_dir;
else
{
if (dir[0] != '/') // if given directory is relative path, then append cur_dir on left side
{
strcpy(tmp, cur_dir);
if (tmp[strlen(tmp)-1] != '/')
{
strcat(tmp, "/"); // add slash
}
strcat(tmp, dir);
k70.p21 = tmp;
} else // if given directory is an absolute path
{
k70.p21 = dir;
}
}
result = kol_file_70(&k70);
if ( !((result==0) || (result==6)) ) // check does the directory exists
{
free( (void*) k70.p16);
return FALSE;
}
n = (unsigned*) (k70.p16+8);
num_of_file = *n;
// now read full directory
k70.p12 = num_of_file;
free( (void*) k70.p16);
k70.p16 = (unsigned) malloc(32+k70.p12*560);
if ( !k70.p16 )
return FALSE;
result = kol_file_70(&k70);
if ( !((result==0) || (result==6)) )
{
free( (void*) k70.p16);
return FALSE;
}
// if there was '-1' param, then show single column mode
// otherwise show files in several columns
if (single_column_mode == TRUE)
{
_SINGLE_COLUMN_MODE:
for (i = 0; i < num_of_file; i++)
{
printf (" %s", k70.p16+32+40+(264+40)*i);
t = (unsigned*) (k70.p16+32+(264+40)*i);
type_of_file = *t;
if ( (0x10 == (type_of_file&0x10)) || (8 == (type_of_file&8)) )
printf ("/");
printf ("\n\r");
}
}
else
{
int longest_name_len = 0;
int console_window_width = 78; //need to get this value from console.obj if it's possible
for (i = 0; i < num_of_file; i++)
{ {
int current_name_len; single_column_mode = TRUE;
current_name_len = strlen( (char*)k70.p16+32+40+(264+40)*i); dir += 3;
if (current_name_len > longest_name_len) longest_name_len = current_name_len;
} }
longest_name_len+=2; //consider space separator and '/' symbol for folders if ( !strlen(dir) ) // if argument is empty, list current directory
int columns_max = console_window_width / longest_name_len; k70.p21 = cur_dir;
else
if (longest_name_len >= console_window_width) goto _SINGLE_COLUMN_MODE; //there was too long filename {
if (dir[0] != '/') // if given directory is relative path, then append cur_dir on left side
for (i = 0; i < num_of_file; i++)
{ {
char cur_file[2048]; strcpy(tmp, cur_dir);
strncpy(cur_file, (char*)k70.p16+32+40+(304)*i, sizeof(cur_file)-2); if (tmp[strlen(tmp)-1] != '/')
{
strcat(tmp, "/"); // add slash
}
strcat(tmp, dir);
k70.p21 = tmp;
} else // if given directory is an absolute path
{
k70.p21 = dir;
}
}
t = (unsigned*) (k70.p16+32+(304)*i); result = kol_file_70(&k70);
if ( !((result==0) || (result==6)) ) // check does the directory exists
{
free( (void*) k70.p16);
return FALSE;
}
n = (unsigned*) (k70.p16+8);
num_of_file = *n;
// now read full directory
k70.p12 = num_of_file;
free( (void*) k70.p16);
k70.p16 = (unsigned) malloc(32+k70.p12*560);
if ( !k70.p16 )
return FALSE;
result = kol_file_70(&k70);
if ( !((result==0) || (result==6)) )
{
free( (void*) k70.p16);
return FALSE;
}
// if there was '-1' param, then show single column mode
// otherwise show files in several columns
if (single_column_mode == TRUE)
{
_SINGLE_COLUMN_MODE:
for (i = 0; i < num_of_file; i++)
{
printf (" %s", k70.p16+32+40+(264+40)*i);
t = (unsigned*) (k70.p16+32+(264+40)*i);
type_of_file = *t; type_of_file = *t;
if ( (0x10 == (type_of_file&0x10)) || (8 == (type_of_file&8)) )
int is_folder = 0; printf ("/");
if ( (0x10 == (type_of_file&0x10)) || (8 == (type_of_file&8)) ) { is_folder = 1; strcat(cur_file, "/"); } printf ("\n\r");
}
}
else
{
int longest_name_len = 0;
int console_window_width = 78; //need to get this value from console.obj if it's possible
for (i = 0; i < num_of_file; i++)
{
int current_name_len;
current_name_len = strlen( (char*)k70.p16+32+40+(264+40)*i);
if (current_name_len > longest_name_len) longest_name_len = current_name_len;
}
if (is_folder) { printf("\033[0;36m"); } // set cyan for folder longest_name_len+=2; //consider space separator and '/' symbol for folders
printf ("%*s", -longest_name_len, cur_file); int columns_max = console_window_width / longest_name_len;
if (is_folder) { printf("\033[0m"); } // is had been set, reset
if ((i>0) && ((i+1)%columns_max == 0)) printf ("\n\r"); if (longest_name_len >= console_window_width) goto _SINGLE_COLUMN_MODE; //there was too long filename
}
if ((i)%columns_max != 0) printf("\n\r"); for (i = 0; i < num_of_file; i++)
} {
char cur_file[2048];
free((void*)k70.p16); strncpy(cur_file, (char*)k70.p16+32+40+(304)*i, sizeof(cur_file)-2);
return TRUE;
t = (unsigned*) (k70.p16+32+(304)*i);
type_of_file = *t;
int is_folder = 0;
if ( (0x10 == (type_of_file&0x10)) || (8 == (type_of_file&8)) ) { is_folder = 1; strcat(cur_file, "/"); }
if (is_folder) { printf("\033[0;36m"); } // set cyan for folder
printf ("%*s", -longest_name_len, cur_file);
if (is_folder) { printf("\033[0m"); } // is had been set, reset
if ((i>0) && ((i+1)%columns_max == 0)) printf ("\n\r");
}
if ((i)%columns_max != 0) printf("\n\r");
}
free((void*)k70.p16);
return TRUE;
} }

View File

@@ -1,51 +1,41 @@
int cmd_mkdir(char dir[]) int cmd_mkdir(char dir[]) {
{ char temp[FILENAME_MAX];
kol_struct70 k70;
unsigned result;
char temp[FILENAME_MAX]; if (NULL == dir) {
kol_struct70 k70; printf(CMD_MKDIR_USAGE);
unsigned result; return TRUE;
if (NULL == dir)
{
#if LANG_ENG
printf(" mkdir <directory>\n\r");
#elif LANG_RUS
printf(" mkdir <<3C><><EFBFBD><E0A5AA><EFBFBD><EFBFBD><EFBFBD>>\n\r");
#endif
return TRUE;
} }
if ( 0 == strcmp(dir, ".") || ( 0 == strcmp(dir, "..") ) || ( 0 == strcmp(cur_dir, "/")) ) {
if ( 0 == strcmp(dir, ".") || ( 0 == strcmp(dir, "..") ) || ( 0 == strcmp(cur_dir, "/")) ) return FALSE;
{
return FALSE;
} }
k70.p00 = 9; k70.p00 = 9;
k70.p04 = 0; k70.p04 = 0;
//k70.p08 = 0; //k70.p08 = 0;
k70.p12 = 0; k70.p12 = 0;
k70.p16 = 0; k70.p16 = 0;
k70.p20 = 0; k70.p20 = 0;
if ( '/' == dir[0]) if ( '/' == dir[0])
k70.p21 = dir; k70.p21 = dir;
else else {
{ strcpy(temp, cur_dir);
strcpy(temp, cur_dir); if (temp[strlen(temp)-1] != '/')
if (temp[strlen(temp)-1] != '/') strcat(temp, "/"); // add slash
strcat(temp, "/"); // add slash strcat(temp, dir);
strcat(temp, dir); k70.p21 = temp;
k70.p21 = temp;
} }
result = kol_file_70(&k70); result = kol_file_70(&k70);
if (0 == result) if (0 == result)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
} }

View File

@@ -1,98 +1,92 @@
int cmd_more(char file[]) int cmd_more(char file[]) {
{
kol_struct70 k70; kol_struct70 k70;
kol_struct_BDVK bdvk; kol_struct_BDVK bdvk;
unsigned result, i; unsigned result, i;
unsigned long long filesize, pos; unsigned long long filesize, pos;
char buf[81]; //<2F><><EFBFBD><EFBFBD><EFBFBD> char buf[81]; //<2F><><EFBFBD><EFBFBD>
char temp[FILENAME_MAX]; char temp[FILENAME_MAX];
unsigned flags; unsigned flags;
if (strlen(file)<1) if (strlen(file)<1) {
{ printf (CMD_MORE_USAGE);
#if LANG_ENG return TRUE;
printf (" more <filename>\n\r");
#elif LANG_RUS
printf (" more <<3C><><EFBFBD><><E4A0A9>>\n\r");
#endif
return TRUE;
} }
if ( '/' == file[0]) if ( '/' == file[0])
{
strcpy(temp, file);
if ( !file_check(temp) )
{ {
file_not_found(file); strcpy(temp, file);
return FALSE;
if ( !file_check(temp) )
{
file_not_found(file);
return FALSE;
}
} }
} else
else
{
strcpy(temp, cur_dir);
if (temp[strlen(temp)-1] != '/')
strcat(temp, "/"); // add slash
strcat(temp, file);
if ( !file_check(temp) )
{ {
file_not_found(file); strcpy(temp, cur_dir);
return FALSE; if (temp[strlen(temp)-1] != '/')
strcat(temp, "/"); // add slash
strcat(temp, file);
if ( !file_check(temp) )
{
file_not_found(file);
return FALSE;
}
} }
}
k70.p00 = 5; k70.p00 = 5;
k70.p04 = k70.p12 = 0; k70.p04 = k70.p12 = 0;
//k70.p08 = 0; //k70.p08 = 0;
k70.p16 = (unsigned) &bdvk; k70.p16 = (unsigned) &bdvk;
k70.p20 = 0;
k70.p21 = temp;
result = kol_file_70(&k70); // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0ACA0><EFBFBD> <20><><E4A0A9>
if ( 0 != result )
return FALSE;
filesize = bdvk.p32; // <20><><EFBFBD><EFBFBD><EFBFBD><><E0A0A7><EFBFBD><><E4A0A9>
buf[80]=0;
flags = con_get_flags();
for (pos=0;pos<filesize;pos+=80)
{
memset(buf, 0, 80);
k70.p00 = 0;
k70.p04 = pos;
// k70.p08 = 0; // bug for over 4Gb files, but "more" is unusable there
k70.p12 = 80;
k70.p16 = (unsigned) buf;
k70.p20 = 0; k70.p20 = 0;
k70.p21 = temp; k70.p21 = temp;
result = kol_file_70(&k70); // <20><EFBFBD><EFBFBD> 80 ᨬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> result = kol_file_70(&k70); // <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><E0ACA0> <20><EFBFBD><EFBFBD>
for (i=0; i<80; i++)
{
if (27 == buf[i])
con_set_flags(flags|0x100);
else con_set_flags(flags);
printf ("%c", buf[i]);
}
if ( 0 != result ) if ( 0 != result )
{ return FALSE;
con_set_flags(flags);
printf ("\n\r");
return TRUE;
}
} filesize = bdvk.p32; // <20><><EFBFBD><EFBFBD><EFBFBD><><E0A0A7><EFBFBD><><E4A0A9>
con_set_flags(flags);
printf ("\n\r"); buf[80]=0;
return TRUE; flags = con_get_flags();
for (pos=0;pos<filesize;pos+=80)
{
memset(buf, 0, 80);
k70.p00 = 0;
k70.p04 = pos;
// k70.p08 = 0; // bug for over 4Gb files, but "more" is unusable there
k70.p12 = 80;
k70.p16 = (unsigned) buf;
k70.p20 = 0;
k70.p21 = temp;
result = kol_file_70(&k70); // <20><EFBFBD><E2A5AD> 80 ᨬ<><E1A8AC><EFBFBD><EFBFBD><EFBFBD>
for (i=0; i<80; i++)
{
if (27 == buf[i])
con_set_flags(flags|0x100);
else con_set_flags(flags);
printf ("%c", buf[i]);
}
if ( 0 != result )
{
con_set_flags(flags);
printf ("\n\r");
return TRUE;
}
}
con_set_flags(flags);
printf ("\n\r");
return TRUE;
} }

View File

@@ -24,11 +24,7 @@ int cmd_mv(char param[])
if (argc != 2) if (argc != 2)
{ {
#if LANG_ENG printf(CMD_MV_USAGE);
printf(" mv <file_in> <file_out>\n\r");
#elif LANG_RUS
printf(" mv <<3C><><EFBFBD><EFBFBD><EFBFBD>> <१<><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>\n\r");
#endif
parameters_free(argc, argv); parameters_free(argc, argv);
return TRUE; return TRUE;
} }

View File

@@ -1,40 +1,28 @@
int cmd_pkill(char param[]) int cmd_pkill(char param[])
{ {
int i=1, n=0; int process_count=0; int i = 1, n = 0; int process_count = 0;
char *buf1k=NULL; char *buf1k = NULL;
unsigned PID=0; unsigned PID=0;
#ifdef LANG_RUS
#define PKILL_HELP " pkill <<3C><><EFBFBD>_<EFBFBD><5F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>\n\r"
#define PKILL_KILL " PID: %u - 㡨<>\n"
#define PKILL_NOT_KILL " PID: %u - <20><><>\n"
#define PKILL_NOT_FOUND " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><E2A0AA> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n"
#else
#define PKILL_HELP " pkill <process_name>\n\r"
#define PKILL_KILL " PID: %u - killed\n"
#define PKILL_NOT_KILL " PID: %u - not killed\n"
#define PKILL_NOT_FOUND " No processes with this name were found!\n"
#endif
if(!strlen(param)){ if(!strlen(param)){
printf(PKILL_HELP); printf(CMD_PKILL_HELP);
return TRUE; return TRUE;
} }
buf1k = malloc(1024); buf1k = malloc(1024);
if(buf1k==NULL){ if (buf1k == NULL){
return FALSE; return FALSE;
} }
while(i!=n){ while (i != n) {
n = kol_process_info(i, buf1k); n = kol_process_info(i, buf1k);
if(!strnicmp(buf1k+10, param, 10)){ if(!strnicmp(buf1k+10, param, 10)){
memcpy(&PID, buf1k+30 ,sizeof(unsigned)); memcpy(&PID, buf1k+30 ,sizeof(unsigned));
if(kol_process_kill_pid(PID)){ if(kol_process_kill_pid(PID)){
printf(PKILL_NOT_KILL, PID); printf(CMD_PKILL_NOT_KILL, PID);
}else{ }else{
printf(PKILL_KILL, PID); printf(CMD_PKILL_KILL, PID);
} }
process_count++; process_count++;
} }
@@ -42,7 +30,7 @@ int cmd_pkill(char param[])
} }
if(!process_count){ if(!process_count){
printf(PKILL_NOT_FOUND); printf(CMD_PKILL_NOT_FOUND);
} }
free(buf1k); free(buf1k);

View File

@@ -2,43 +2,39 @@
int cmd_ps(char param[]) int cmd_ps(char param[])
{ {
int i, n, sel; int i, n, sel;
char *buf1k; char *buf1k;
unsigned PID; unsigned PID;
short STATE; short STATE;
buf1k = malloc(1024); buf1k = malloc(1024);
if (NULL == buf1k) if (NULL == buf1k)
return FALSE; return FALSE;
sel = param && strlen(param) > 0; sel = param && strlen(param) > 0;
printf (" PID NAME RAM KB\n\r", PID, buf1k+10); printf (" PID NAME RAM KB\n\r", PID, buf1k+10);
for (i = 1;;i++) for (i = 1;;i++) {
{ n = kol_process_info(i, buf1k);
n = kol_process_info(i, buf1k); memcpy(&PID, buf1k+30 ,sizeof(unsigned));
memcpy(&PID, buf1k+30 ,sizeof(unsigned)); STATE = *(buf1k+50);
STATE = *(buf1k+50); if (9 != STATE) {
if (9 != STATE) if (!sel || 0 == strnicmp(param, buf1k+10, 10)) {
{ printf (" %7u %11s %d\n\r", PID, buf1k+10, (*(int*)(buf1k+26)+1)/1024);
if (!sel || 0 == strnicmp(param, buf1k+10, 10)) if (sel) {
{
printf (" %7u %11s %d\n\r", PID, buf1k+10, (*(int*)(buf1k+26)+1)/1024);
if (sel)
{
LAST_PID = PID; LAST_PID = PID;
int cpu_tck = kol_system_cpufreq() / 100; int cpu_tck = kol_system_cpufreq() / 100;
printf (" CPU %d%% RAM %d\n\r", *(int*)buf1k / cpu_tck , *(int*)(buf1k+26)+1); printf (" CPU %d%% RAM %d\n\r", *(int*)buf1k / cpu_tck , *(int*)(buf1k+26)+1);
} }
} }
} }
if (i == n) if (i == n)
break; break;
} }
free(buf1k); free(buf1k);
return TRUE; return TRUE;
} }

View File

@@ -1,7 +1,6 @@
int cmd_pwd(char param[]) int cmd_pwd(char param[]) {
{ printf (" %s%c\n\r", cur_dir, cur_dir[strlen(cur_dir)-1]=='/'?' ':'/' );
printf (" %s%c\n\r", cur_dir, cur_dir[strlen(cur_dir)-1]=='/'?' ':'/' ); return TRUE;
return TRUE;
} }

View File

@@ -1,10 +1,9 @@
int cmd_reboot(char param[]) int cmd_reboot(char param[]) {
{ if (!strcmp(param, "kernel"))
if (!strcmp(param, "kernel")) kol_system_end(4);
kol_system_end(4); else
else kol_system_end(3);
kol_system_end(3); return TRUE;
return TRUE;
} }

View File

@@ -1,6 +1,5 @@
int cmd_ren(char param[]) int cmd_ren(char param[]) {
{
char* argv[100]; char* argv[100];
int argc; int argc;
/* /*
@@ -9,19 +8,14 @@ int cmd_ren(char param[])
*/ */
argc = parameters_prepare(param, argv); argc = parameters_prepare(param, argv);
if (argc != 2) if (argc != 2) {
{ printf(CMD_REN_USAGE);
#if LANG_ENG
printf(" ren <file> <new_name>\n\r");
#elif LANG_RUS
printf(" ren <䠩<>> <<3C><><EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><5F><EFBFBD>>\n\r");
#endif
parameters_free(argc, argv); parameters_free(argc, argv);
return TRUE; return TRUE;
} }
char *x; //char *x;
if (x = strrchr(argv[1], '/') != 0) // argv[1] must be file name, not path // argv[1] must be file name, not path
{ if (strrchr(argv[1], '/') != NULL) {
//printf("%d %s", x, argv[1]); //printf("%d %s", x, argv[1]);
return FALSE; return FALSE;
} }

View File

@@ -1,57 +1,51 @@
int cmd_rm(char file[]) int cmd_rm(char file[]) {
{
kol_struct70 k70; kol_struct70 k70;
char temp[FILENAME_MAX]; char temp[FILENAME_MAX];
unsigned result; unsigned result;
if (NULL == file || strlen(file) == 0) if (NULL == file || strlen(file) == 0) {
{ printf (CMD_RM_USAGE);
#if LANG_ENG return TRUE;
printf (" rm <filename>\n\r");
#elif LANG_RUS
printf (" rm <<3C><><EFBFBD><><E4A0A9>>\n\r");
#endif
return TRUE;
} }
if ( '/' == file[0]) if ( '/' == file[0])
{
strcpy(temp, file);
if ( !file_check(temp) )
{ {
return FALSE; strcpy(temp, file);
if ( !file_check(temp) )
{
return FALSE;
}
} }
} else
else
{
strcpy(temp, cur_dir);
if (temp[strlen(temp)-1] != '/')
strcat(temp, "/"); // add slash
strcat(temp, file);
if ( !file_check(temp) )
{ {
return FALSE; strcpy(temp, cur_dir);
if (temp[strlen(temp)-1] != '/')
strcat(temp, "/"); // add slash
strcat(temp, file);
if ( !file_check(temp) )
{
return FALSE;
}
} }
}
k70.p00 = 8; k70.p00 = 8;
k70.p04 = 0; k70.p04 = 0;
//k70.p08 = 0; //k70.p08 = 0;
k70.p12 = 0; k70.p12 = 0;
k70.p16 = 0; k70.p16 = 0;
k70.p20 = 0; k70.p20 = 0;
k70.p21 = temp; k70.p21 = temp;
result = kol_file_70(&k70); result = kol_file_70(&k70);
if (0 == result) if (0 == result)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
} }

View File

@@ -1,53 +1,44 @@
int cmd_rmdir(char dir[]) int cmd_rmdir(char dir[]) {
{ char temp[FILENAME_MAX];
kol_struct70 k70;
unsigned result;
char temp[FILENAME_MAX]; if (NULL == dir || strlen(dir) == 0) {
kol_struct70 k70; printf(CMD_RMDIR_USAGE);
unsigned result; return TRUE;
if (NULL == dir || strlen(dir) == 0)
{
#if LANG_ENG
printf(" rmdir <directory>\n\r");
#elif LANG_RUS
printf(" rmdir <<3C><><EFBFBD><E0A5AA><EFBFBD><EFBFBD><EFBFBD>>\n\r");
#endif
return TRUE;
} }
if ( ( 0 == strcmp(dir, ".") ) || ( 0 == strcmp(dir, "..") ) || ( 0 == strcmp(cur_dir, "/")) ) if ( ( 0 == strcmp(dir, ".") ) || ( 0 == strcmp(dir, "..") ) || ( 0 == strcmp(cur_dir, "/")) ) {
{ return FALSE;
return FALSE;
} }
k70.p00 = 8; k70.p00 = 8;
k70.p04 = 0; k70.p04 = 0;
//k70.p08 = 0; //k70.p08 = 0;
k70.p12 = 0; k70.p12 = 0;
k70.p16 = 0; k70.p16 = 0;
k70.p20 = 0; k70.p20 = 0;
if ( '/' == dir[0]) if ( '/' == dir[0])
k70.p21 = dir; k70.p21 = dir;
else else {
{ strcpy(temp, cur_dir);
strcpy(temp, cur_dir); if (temp[strlen(temp)-1] != '/')
if (temp[strlen(temp)-1] != '/') strcat(temp, "/"); // add slash
strcat(temp, "/"); // add slash strcat(temp, dir);
strcat(temp, dir); k70.p21 = temp;
k70.p21 = temp;
} }
if ( !dir_check(temp) ) if ( !dir_check(temp) )
return FALSE; return FALSE;
result = kol_file_70(&k70); result = kol_file_70(&k70);
if (0 == result) if (0 == result)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
} }

View File

@@ -1,7 +1,6 @@
int cmd_shutdown(char param[]) int cmd_shutdown(char param[]) {
{ kol_system_end(2);
kol_system_end(2); return TRUE;
return TRUE;
} }

View File

@@ -1,20 +1,12 @@
int cmd_sleep(char param[]) int cmd_sleep(char param[]) {
{ int delay;
int delay; if (!strlen(param)) {
printf(CMD_SLEEP_USAGE);
if (!strlen(param)) return TRUE;
{
#if LANG_ENG
printf(" sleep <time in the 1/100 of second>\n\r");
#elif LANG_RUS
printf(" sleep <<3C><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>x ᥪ㭤<E1A5AA>>\n\r");
#endif
return TRUE;
} }
delay = atoi(param);
delay = _atoi(param); kol_sleep((unsigned)delay);
kol_sleep((unsigned)delay); return TRUE;
return TRUE;
} }

View File

@@ -1,61 +1,51 @@
int cmd_touch(char file[]) int cmd_touch(char file[])
{ {
kol_struct70 k70;
char temp[FILENAME_MAX];
unsigned result;
kol_struct70 k70; if (NULL == file || strlen(file) == 0) {
char temp[FILENAME_MAX]; printf(CMD_TOUCH_USAGE);
unsigned result; return TRUE;
if (NULL == file || strlen(file) == 0)
{
#if LANG_ENG
printf(" touch <filename>\n\r");
#elif LANG_RUS
printf(" touch <<3C><><EFBFBD><><E4A0A9>>\n\r");
#endif
return TRUE;
} }
if ( ( 0 == strcmp(file, ".") ) || ( 0 == strcmp(file, "..") ) || ( 0 == strcmp(cur_dir, "/")) ) if ( ( 0 == strcmp(file, ".") ) || ( 0 == strcmp(file, "..") ) || ( 0 == strcmp(cur_dir, "/")) ) {
{ return FALSE;
return FALSE;
} }
if ( '/' == file[0]) if ( '/' == file[0]) {
{ strcpy(temp, file);
strcpy(temp, file);
if ( !file_check(temp) ) if ( !file_check(temp) )
k70.p00 = 2; k70.p00 = 2;
else else
k70.p00 = 3; k70.p00 = 3;
} } else {
else strcpy(temp, cur_dir);
{ if (temp[strlen(temp)-1] != '/')
strcpy(temp, cur_dir); strcat(temp, "/"); // add slash
if (temp[strlen(temp)-1] != '/') strcat(temp, file);
strcat(temp, "/"); // add slash if ( !file_check(temp) )
strcat(temp, file); k70.p00 = 2;
if ( !file_check(temp) ) else
k70.p00 = 2; k70.p00 = 3;
else
k70.p00 = 3;
} }
k70.p04 = 0; k70.p04 = 0;
//k70.p08 = 0; //k70.p08 = 0;
k70.p12 = 0; k70.p12 = 0;
k70.p16 = 0; k70.p16 = 0;
k70.p20 = 0; k70.p20 = 0;
k70.p21 = temp; k70.p21 = temp;
//printf("try to touch [%s], fn70(%d)\n\r", temp, k70.p00); //printf("try to touch [%s], fn70(%d)\n\r", temp, k70.p00);
result = kol_file_70(&k70); result = kol_file_70(&k70);
if (0 == result) if (0 == result)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
} }

View File

@@ -1,20 +1,20 @@
int cmd_uptime(char param[]) void get_str_uptime(char *str, const char *fmt) {
{ unsigned time_tick, up_days, up_hours, up_minutes, up_seconds, up_millisecs;
unsigned time_tick, up_days, up_hours, up_minutes, up_seconds, up_millisecs;
time_tick = kol_time_tick(); time_tick = kol_time_tick();
up_days = (time_tick/(24*60*60*100)); up_days = (time_tick/(24*60*60*100));
up_hours = (time_tick/(60*60*100))%24; up_hours = (time_tick/(60*60*100))%24;
up_minutes = (time_tick/(60*100))%60; up_minutes = (time_tick/(60*100))%60;
up_seconds = (time_tick/100)%60; up_seconds = (time_tick/100)%60;
up_millisecs = (time_tick*10)%100; up_millisecs = (time_tick*10)%100;
#if LANG_ENG sprintf (str, fmt, up_days, up_hours, up_minutes, up_seconds, up_millisecs);
printf (" Uptime: %d day(s), %d:%d:%d.%d\n\r", up_days, up_hours, up_minutes, up_seconds, up_millisecs); }
#elif LANG_RUS
printf (" Uptime: %d <20><><EFBFBD><EFBFBD>, %d:%d:%d.%d\n\r", up_days, up_hours, up_minutes, up_seconds, up_millisecs); int cmd_uptime(char param[]) {
#endif get_str_uptime(tmpstr, CMD_UPTIME_FMT);
return TRUE; printf(tmpstr);
return TRUE;
} }

View File

@@ -1,45 +1,31 @@
int cmd_ver(char param[]) void get_str_kernel_version(char *str, const char *fmt) {
{ char *kvbuf;
char *vA, *vB, *vC, *vD;
unsigned *Rev;
if (!strcmp(param, "kernel")) kvbuf = malloc(16);
{ kol_get_kernel_ver(kvbuf);
char *kvbuf; vA = kvbuf+0;
char *vA, *vB, *vC, *vD; vB = kvbuf+1;
unsigned *Rev; vC = kvbuf+2;
vD = kvbuf+3;
Rev = (unsigned*)(kvbuf + 5);
kvbuf = malloc(16); sprintf (str, fmt, *vA, *vB, *vC, *vD, *Rev);
kol_get_kernel_ver(kvbuf);
vA = kvbuf+0;
vB = kvbuf+1;
vC = kvbuf+2;
vD = kvbuf+3;
Rev = (unsigned*)(kvbuf + 5);
#if LANG_ENG free(kvbuf);
printf (" KolibriOS v%d.%d.%d.%d. Kernel SVN-rev.: %d\n\r", *vA, *vB, *vC, *vD, *Rev); }
#elif LANG_RUS
printf (" KolibriOS v%d.%d.%d.%d. SVN-ॢ. <20><><EFBFBD><EFBFBD>: %d\n\r", *vA, *vB, *vC, *vD, *Rev);
#endif
free(kvbuf); void get_str_cpu_info(char *str) {
unsigned a, b, c, d;
return TRUE; asm ("cpuid" :
} "=a" (a),
"=b" (b),
if (!strcmp(param, "cpu")) "=c" (c),
{ "=d" (d):
unsigned a, b, c, d; "a"(0));
char str[13];
str[12] = '\0';
asm ("cpuid" :
"=a" (a),
"=b" (b),
"=c" (c),
"=d" (d):
"a"(0));
str[0] = (b&0x000000ff) >> 0; str[0] = (b&0x000000ff) >> 0;
str[1] = (b&0x0000ff00) >> 8; str[1] = (b&0x0000ff00) >> 8;
@@ -55,13 +41,24 @@ if (!strcmp(param, "cpu"))
str[9] = (c&0x0000ff00) >> 8; str[9] = (c&0x0000ff00) >> 8;
str[10] = (c&0x00ff0000) >> 16; str[10] = (c&0x00ff0000) >> 16;
str[11] = (c&0xff000000) >> 24; str[11] = (c&0xff000000) >> 24;
str[12] = '\0';
printf("%s\n\r", str); }
return TRUE;
} int cmd_ver(char param[]) {
if (!strcmp(param, "kernel")) {
get_str_kernel_version(tmpstr, CMD_VER_FMT1);
printf (" Shell v%s\n\r", SHELL_VERSION); printf(tmpstr);
return TRUE; return TRUE;
}
if (!strcmp(param, "cpu")) {
char str[13];
get_str_cpu_info(str);
printf("%s\n\r", str);
return TRUE;
}
printf (" Shell v%s\n\r", SHELL_VERSION);
return TRUE;
} }

View File

@@ -1,52 +1,42 @@
int cmd_waitfor(char param[]) /* waits for LASTPID or pid in param */
// waits for LASTPID or pid in param int cmd_waitfor(char param[]) {
{ int i, n, sel, sel_pid;
char *buf1k;
unsigned PID;
short STATE;
int i, n, sel, sel_pid; sel = param && strlen(param) > 0;
char *buf1k; sel_pid = LAST_PID;
unsigned PID; if (sel) {
short STATE; sel_pid = atoi(param);
sel = param && strlen(param) > 0;
sel_pid = LAST_PID;
if (sel)
{
sel_pid = _atoi(param);
} }
if (0 == sel_pid) if (0 == sel_pid) return FALSE;
return FALSE;
#if LANG_ENG printf(CMD_WAITFOR_FMT, sel_pid);
printf(" Awaing finish PID %d\n\r", sel_pid);
#elif LANG_RUS
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A5AD> PID %d\n\r", sel_pid);
#endif
buf1k = malloc(1024); buf1k = malloc(1024);
if (NULL == buf1k) if (NULL == buf1k)
return FALSE; return FALSE;
while(1) while(1) {
{ for (i = 1;;i++) {
for (i = 1;;i++) n = kol_process_info(i, buf1k);
{ PID = *(buf1k+30);
n = kol_process_info(i, buf1k); STATE = *(buf1k+50);
PID = *(buf1k+30); if (PID == sel_pid)
STATE = *(buf1k+50); if(9 == STATE)
if (PID == sel_pid) goto exit_normal;
if(9 == STATE) else break;
if (i == n)
goto exit_normal; goto exit_normal;
else break;
if (i == n)
goto exit_normal;
} }
kol_sleep(10); // 100ms kol_sleep(10); // 100ms
} }
exit_normal: exit_normal:
free(buf1k); free(buf1k);
return TRUE; return TRUE;
} }

View File

@@ -1,15 +0,0 @@
@echo off
echo #define LANG_ENG 1 > lang.h
fasm start.asm start.o
gcc -c -fno-builtin shell.c
gcc -c -fno-builtin system/kolibri.c
gcc -c -fno-builtin system/stdlib.c
gcc -c -fno-builtin system/string.c
gcc -c -fno-builtin 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
move shell bin\eng\
copy locale\eng\.shell bin\eng\
pause

View File

@@ -1,15 +0,0 @@
@echo off
echo #define LANG_RUS 1 > lang.h
fasm start.asm start.o
gcc -c -fno-builtin shell.c
gcc -c -fno-builtin system/kolibri.c
gcc -c -fno-builtin system/stdlib.c
gcc -c -fno-builtin system/string.c
gcc -c -fno-builtin 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 ctype.o
kpack shell
move shell bin\rus\
copy locale\rus\.shell bin\rus\
pause

View File

@@ -1,14 +0,0 @@
@echo off
fasm start.asm start.o
gcc -c -fno-builtin test.c
gcc -c -fno-builtin system/kolibri.c
gcc -c -fno-builtin system/stdlib.c
gcc -c -fno-builtin system/string.c
gcc -c -fno-builtin system/ctype.c
ld -nostdlib -T kolibri.ld -o test start.o kolibri.o stdlib.o string.o ctype.o test.o
objcopy test -O binary
erase start.o kolibri.o stdlib.o string.o ctype.o test.o
kpack test
copy test bin\eng\
move test bin\rus\
pause

View File

@@ -1,6 +0,0 @@
@echo off
fasm test.asm test_asm
kpack test_asm
copy test_asm bin\eng\
move test_asm bin\rus\
pause

View File

@@ -1,8 +1,9 @@
#define SHELL_VERSION "0.8.1" #define SHELL_VERSION "0.8.2"
extern char PATH[256]; char cmdline[256];
extern char PARAM[256];
char tmpstr[64];
char title[64]; char title[64];
char cur_dir[FILENAME_MAX]; char cur_dir[FILENAME_MAX];
@@ -67,6 +68,7 @@ int cmd_shutdown(char arg[]);
int cmd_uptime(char param[]); int cmd_uptime(char param[]);
int cmd_killall(char process_name[]); int cmd_killall(char process_name[]);
int cmd_history(char arg[]); int cmd_history(char arg[]);
int cmd_kfetch(char param[]);
int cmd_cp(char param[]); int cmd_cp(char param[]);
int cmd_mv(char param[]); int cmd_mv(char param[]);
int cmd_ren(char param[]); int cmd_ren(char param[]);

View File

@@ -14,6 +14,7 @@ const command_t COMMANDS[]=
{"free", " Displays total, free and used memory\n\r", &cmd_memory}, {"free", " Displays total, free and used memory\n\r", &cmd_memory},
{"help", " Gives help on commands. Usage:\n\r help ;it lists all builtins\n\r help <command> ;help on command\n\r", &cmd_help}, {"help", " Gives help on commands. Usage:\n\r help ;it lists all builtins\n\r help <command> ;help on command\n\r", &cmd_help},
{"history", " Lists used commands\n\r", &cmd_history}, {"history", " Lists used commands\n\r", &cmd_history},
{"kfetch", " Prints logo and information about system.\n\r", &cmd_kfetch},
{"kill", " Stops a running process. Usage:\n\r kill <PID of process>\n\r kill all\n\r", &cmd_kill}, {"kill", " Stops a running process. Usage:\n\r kill <PID of process>\n\r kill all\n\r", &cmd_kill},
{"pkill", " Kills all processes by name. Usage:\n\r pkill <process_name>\n\r", &cmd_pkill}, {"pkill", " Kills all processes by name. Usage:\n\r pkill <process_name>\n\r", &cmd_pkill},
{"ls", " Lists the files in a directory. Usage:\n\r ls ;lists the files in current directory\n\r ls <directory> ;lists the files at specified folder\n\r ls -1 ;lists the files in a single column\n\r", &cmd_ls}, {"ls", " Lists the files in a directory. Usage:\n\r ls ;lists the files in current directory\n\r ls <directory> ;lists the files at specified folder\n\r ls -1 ;lists the files in a single column\n\r", &cmd_ls},
@@ -32,3 +33,35 @@ const command_t COMMANDS[]=
{"waitfor", " Stops console waiting while process finish. Usage:\n\r waitfor ;waiting previous started executable LASTPID\n\r waitfor <PID>;awaiting PID finish\n\r", &cmd_waitfor}, {"waitfor", " Stops console waiting while process finish. Usage:\n\r waitfor ;waiting previous started executable LASTPID\n\r waitfor <PID>;awaiting PID finish\n\r", &cmd_waitfor},
}; };
#define CMD_ABOUT_MSG "Shell %s\n\r"
#define CMD_CD_USAGE " cd <directory>\n\r"
#define CMD_CP_USAGE " cp <file_in> <file_out>\n\r"
#define CMD_DATE_DATE_FMT " Date [dd.mm.yy]: %x%x.%x%x.%x%x"
#define CMD_DATE_TIME_FMT "\n\r Time [hh:mm:ss]: %x%x:%x%x:%x%x\n\r"
#define CMD_FREE_FMT " Total [kB / MB / %%]: %-7d / %-5d / 100\n\r Free [kB / MB / %%]: %-7d / %-5d / %d\n\r Used [kB / MB / %%]: %-7d / %-5d / %d\n\r"
#define CMD_HELP_AVAIL " %d commands available:\n\r"
#define CMD_HELP_CMD_NOT_FOUND " Command \'%s\' not found.\n\r"
#define CMD_KILL_USAGE " kill <PID>\n\r"
#define CMD_MKDIR_USAGE " mkdir <directory>\n\r"
#define CMD_MORE_USAGE " more <filename>\n\r"
#define CMD_MV_USAGE " mv <file_in> <file_out>\n\r"
#define CMD_PKILL_HELP " pkill <process_name>\n\r"
#define CMD_PKILL_KILL " PID: %u - killed\n"
#define CMD_PKILL_NOT_KILL " PID: %u - not killed\n"
#define CMD_PKILL_NOT_FOUND " No processes with this name were found!\n"
#define CMD_REN_USAGE " ren <file> <new_name>\n\r"
#define CMD_RM_USAGE " rm <filename>\n\r"
#define CMD_RMDIR_USAGE " rmdir <directory>\n\r"
#define CMD_SLEEP_USAGE " sleep <time in the 1/100 of second>\n\r"
#define CMD_TOUCH_USAGE " touch <filename>\n\r"
#define CMD_UPTIME_FMT " Uptime: %d day(s), %d:%d:%d.%d\n\r"
#define CMD_VER_FMT1 " KolibriOS v%d.%d.%d.%d. Kernel SVN-rev.: %d\n\r"
#define CMD_WAITFOR_FMT " Awaing finish PID %d\n\r"
#define EXEC_STARTED_FMT " '%s' started. PID = %d\n\r"
#define EXEC_SCRIPT_ERROR_FMT "Error in '%s' : script must start with #SHS line\n\r"
#define UNKNOWN_CMD_ERROR " Error!\n\r"
#define CON_APP_ERROR " Error in console application.\n\r"
#define FILE_NOT_FOUND_ERROR " File '%s' not found.\n\r"

View File

@@ -1,34 +1,67 @@
/* WARNING: SAVE ONLY IN CP866 ENCODING! */
const command_t COMMANDS[]= const command_t COMMANDS[]=
{ {
{"about", " <20><EFBFBD><EBA2AE><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0ACA0><EFBFBD> <20> <20>ணࠬ<E0AEA3><E0A0AC> Shell\n\r", &cmd_about}, {"about", " <20><EFBFBD><EBA2AE><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E0ACA0><EFBFBD> <20> <20>ணࠬ<E0AEA3><E0A0AC> Shell\n\r", &cmd_about},
{"alias", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᯨ᮪ ᨭ<><E1A8AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r", &cmd_alias}, {"alias", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᯨ᮪ ᨭ<><E1A8AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r", &cmd_alias},
{"cd", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E2A5AA><EFBFBD><EFBFBD> <20><><EFBFBD><E0A8AA><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r cd <<3C><><EFBFBD><E0A5AA><EFBFBD><EFBFBD><EFBFBD>>\n\r", &cmd_cd}, {"cd", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E2A5AA><EFBFBD><EFBFBD> <20><><EFBFBD><E0A8AA><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r cd <<3C><><EFBFBD><E0A5AA><EFBFBD><EFBFBD><EFBFBD>>\n\r", &cmd_cd},
{"clear", " <20><><EFBFBD><EFBFBD> <20><>\n\r", &cmd_clear}, {"clear", " <20><><EFBFBD><EFBFBD> <20><>\n\r", &cmd_clear},
{"cp", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>\n\r", &cmd_cp}, {"cp", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><>\n\r", &cmd_cp},
{"mv", " <20><><EFBFBD><EFBFBD><>\n\r", &cmd_mv}, {"mv", " <20><><EFBFBD><EFBFBD><>\n\r", &cmd_mv},
{"ren", " <20><><EFBFBD><E0A5A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0><>\n\r", &cmd_ren}, {"ren", " <20><><EFBFBD><E0A5A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0><>\n\r", &cmd_ren},
{"date", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0><><E2A5AA><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><EFBFBD>\n\r", &cmd_date}, {"date", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0><><E2A5AA><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <20><EFBFBD>\n\r", &cmd_date},
{"echo", " <20><EFBFBD><EBA2AE><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><>࠭. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r echo <<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>\n\r", &cmd_echo}, {"echo", " <20><EFBFBD><EBA2AE><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><>࠭. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r echo <<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>\n\r", &cmd_echo},
{"exit", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A5AD><><E0A0A1><EFBFBD> Shell\n\r", &cmd_exit}, {"exit", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A5AD><><E0A0A1><EFBFBD> Shell\n\r", &cmd_exit},
{"free", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A8A2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20>ᥩ, ᢮<><E1A2AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><EFBFBD><E1AFAE><EFBFBD><EFBFBD><E3A5AC>\n\r", &cmd_memory}, {"free", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2A8A2><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20>ᥩ, ᢮<><E1A2AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><EFBFBD><E1AFAE><EFBFBD><EFBFBD><E3A5AC>\n\r", &cmd_memory},
{"help", " <20><><EFBFBD><E0A0A2> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r help ;ᯨ᮪ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r help <<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>> ;<3B><><EFBFBD><E0A0A2> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r", &cmd_help}, {"help", " <20><><EFBFBD><E0A0A2> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r help ;ᯨ᮪ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r help <<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>> ;<3B><><EFBFBD><E0A0A2> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r", &cmd_help},
{"history", " <20><><EFBFBD><20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r", &cmd_history}, {"history", " <20><><EFBFBD><20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r", &cmd_history},
{"kill", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n\r kill <PID <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>\n\r kill all\n\r", &cmd_kill}, {"kfetch", " <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>.\n\r", &cmd_kfetch},
{"pkill", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r pkill <<EFBFBD><EFBFBD><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>\n\r", &cmd_pkill}, {"kill", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r kill <PID <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>\n\r kill all\n\r", &cmd_kill},
{"ls", " <20><EFBFBD><EFBFBD><EFBFBD> ᯨ᮪ 䠩<EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n\r ls ;ᯨ᮪ 䠩<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r ls <<3C><><EFBFBD><E0A5AA><EFBFBD><EFBFBD><EFBFBD>> ;ᯨ᮪ 䠩<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E0A5AA>\n\r", &cmd_ls}, {"pkill", " <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n\r pkill <<3C><><EFBFBD>_<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>\n\r", &cmd_pkill},
{"mkdir", " <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r mkdir <<3C><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>> ;ᮧ<><E1AEA7><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><20><><EFBFBD><E2A0AB><EFBFBD>\n\r mkdir <<3C><><EFBFBD><EFBFBD>><<3C><><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>> ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>\n\r", &cmd_mkdir}, {"ls", " <20><EFBFBD><EFBFBD><EFBFBD> ᯨ᮪ 䠩<EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r ls ;ᯨ᮪ 䠩<EFBFBD><EFBFBD><EFBFBD> <20><><20><><EFBFBD><E2A0AB><EFBFBD>\n\r ls <<3C><><EFBFBD><E0A5AA><EFBFBD><EFBFBD><EFBFBD>> ;ᯨ᮪ 䠩<EFBFBD><EFBFBD><EFBFBD> <20><> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>\n\r", &cmd_ls},
{"more", " <20><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E4A0A9> <20><> <20><>࠭. <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n\r more <<3C><><EFBFBD><><EFBFBD>>\n\r", &cmd_more}, {"mkdir", " <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r mkdir <<3C><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>> ;ᮧ<><E1AEA7><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><20><><EFBFBD><E2A0AB><EFBFBD>\n\r mkdir <<3C><><EFBFBD><EFBFBD>><<3C><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>> ;ᮧ<><E1AEA7><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><><E3AAA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>\n\r", &cmd_mkdir},
{"ps", " <20><EFBFBD><EBA2AE><EFBFBD> ᯨ᮪ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r <20>᫨ 㪠<><E3AAA0><EFBFBD><EFBFBD> <<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><E0A0AD><EFBFBD> LASTPID\n\r", &cmd_ps}, {"more", " <20><EFBFBD><EBA2AE><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E4A0A9> <20><> <20><>࠭. <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:\n\r more <<3C><><EFBFBD><><E4A0A9>>\n\r", &cmd_more},
{"pwd", " <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><><20><><EFBFBD><E0A5AA>\n\r", &cmd_pwd}, {"ps", " <20><EFBFBD><EFBFBD><EFBFBD> ᯨ᮪ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r <20>᫨ 㪠<><E3AAA0><EFBFBD><EFBFBD> <<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><E0A0AD><EFBFBD> LASTPID\n\r", &cmd_ps},
{"reboot", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> KolibriOS. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r reboot ;<3B><><EFBFBD><E0A5A7><EFBFBD><EFBFBD><E3A7A8> <20><>\n\r reboot kernel ;<3B><><EFBFBD><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> Kolibri\n\r", &cmd_reboot}, {"pwd", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><><20><><EFBFBD><E0A5AA>\n\r", &cmd_pwd},
{"rm", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r rm <<3C><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>>\n\r", &cmd_rm}, {"reboot", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> KolibriOS. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r reboot ;<3B><><EFBFBD><E0A5A7><EFBFBD><EFBFBD><EFBFBD> <20><>\n\r reboot kernel ;<3B><><EFBFBD><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> Kolibri\n\r", &cmd_reboot},
{"rmdir", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r rmdir <<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>\n\r", &cmd_rmdir}, {"rm", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r rm <<3C><><EFBFBD><EFBFBD><EFBFBD>>\n\r", &cmd_rm},
{"shutdown"," <20><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r", &cmd_shutdown}, {"rmdir", " <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r rmdir <<3C><><EFBFBD><E0A5AA><EFBFBD><EFBFBD><EFBFBD>>\n\r", &cmd_rmdir},
{"sleep", " <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> Shell'<27> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r sleep <<3C><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ᥪ㭤<E1A5AA>>\n\r <20><EFBFBD><E0A8AC>:\n\r sleep 500 ;<3B><><20><> 5 ᥪ.\n\r", &cmd_sleep}, {"shutdown"," <20><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r", &cmd_shutdown},
{"touch", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>⮩ 䠩<> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>/<2F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r touch <<3C><><EFBFBD><><E4A0A9>>\n\r", &cmd_touch}, {"sleep", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD> Shell'<27> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r sleep <<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ᥪ㭤<E1A5AA>>\n\r <20><EFBFBD><E0A8AC>:\n\r sleep 500 ;<3B><><20><> 5 ᥪ.\n\r", &cmd_sleep},
{"uptime", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> uptime\n\r", &cmd_uptime}, {"touch", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>⮩ 䠩<> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>/<2F><EFBFBD><><E1AEA7><EFBFBD><EFBFBD><EFBFBD><><E4A0A9>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r touch <<3C><><EFBFBD><><E4A0A9>>\n\r", &cmd_touch},
{"ver", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r ver ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Shell\n\r ver kernel ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><><E0A5A2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> KolibriOS\n\r ver cpu ;<3B><><EFBFBD><EFBFBD><EFBFBD><E0ACA0><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r", &cmd_ver}, {"uptime", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBA2A0> uptime\n\r", &cmd_uptime},
{"waitfor", " <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r waitfor ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LASTPID\n\r waitfor <PID>;<3B><><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> PID\n\r", &cmd_waitfor}, {"ver", " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r ver ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Shell\n\r ver kernel ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EFBFBD><EFBFBD> KolibriOS\n\r ver cpu ;<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n\r", &cmd_ver},
{"waitfor", " <20><EFBFBD><EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><EBAFAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><EFBFBD><EFBFBD><ECA7AE><EFBFBD><EFBFBD><EFBFBD>:\n\r waitfor ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0A5A4><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><E9A5AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LASTPID\n\r waitfor <PID>;<3B><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A5AD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><E3AAA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD> PID\n\r", &cmd_waitfor},
}; };
#define CMD_ABOUT_MSG "Shell %s\n\r"
#define CMD_CD_USAGE " cd <<3C><><EFBFBD><E0A5AA><EFBFBD><EFBFBD><EFBFBD>>\n\r"
#define CMD_CP_USAGE " cp <<3C><><EFBFBD><EFBFBD><EFBFBD>> <१<><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>\n\r"
#define CMD_DATE_DATE_FMT " <20><><EFBFBD><EFBFBD> [<5B><>.<2E><>.<2E><>]: %x%x.%x%x.%x%x"
#define CMD_DATE_TIME_FMT "\n\r <20><EFBFBD> [<5B><>:<3A><>:<3A><>]: %x%x:%x%x:%x%x\n\r"
#define CMD_FREE_FMT " <20><EFBFBD> [<5B><> / <20><> / %%]: %-7d / %-5d / 100\n\r <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [<5B><> / <20><> / %%]: %-7d / %-5d / %d\n\r <20><EFBFBD><E1AFAE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [<5B><> / <20><> / %%]: %-7d / %-5d / %d\n\r"
#define CMD_HELP_AVAIL " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><E3AFAD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n\r"
#define CMD_HELP_CMD_NOT_FOUND " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \'%s\' <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n\r"
#define CMD_KILL_USAGE " kill <PID>\n\r"
#define CMD_MKDIR_USAGE " mkdir <<3C><><EFBFBD><E0A5AA><EFBFBD><EFBFBD><EFBFBD>>\n\r"
#define CMD_MORE_USAGE " more <<3C><><EFBFBD><><E4A0A9>>\n\r"
#define CMD_MV_USAGE " mv <<3C><><EFBFBD><EFBFBD><EFBFBD>> <१<><E0A5A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>\n\r"
#define CMD_PKILL_HELP " pkill <<3C><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>\n\r"
#define CMD_PKILL_KILL " PID: %u - 㡨<>\n"
#define CMD_PKILL_NOT_KILL " PID: %u - <20><><>\n"
#define CMD_PKILL_NOT_FOUND " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><20><><E2A0AA> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n"
#define CMD_REN_USAGE " ren <䠩<>> <<3C><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>>\n\r"
#define CMD_RM_USAGE " rm <<3C><><EFBFBD><><E4A0A9>>\n\r"
#define CMD_RMDIR_USAGE " rmdir <<3C><><EFBFBD><E0A5AA><EFBFBD><EFBFBD><EFBFBD>>\n\r"
#define CMD_SLEEP_USAGE " sleep <<3C><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>x ᥪ㭤<E1A5AA>>\n\r"
#define CMD_TOUCH_USAGE " touch <<3C><><EFBFBD><><E4A0A9>>\n\r"
#define CMD_UPTIME_FMT " Uptime: %d <20><><EFBFBD><EFBFBD>, %d:%d:%d.%d\n\r"
#define CMD_VER_FMT1 " KolibriOS v%d.%d.%d.%d. SVN-ॢ. <20><><EFBFBD><EFBFBD>: %d\n\r"
#define CMD_WAITFOR_FMT " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A5AD> PID %d\n\r"
#define EXEC_STARTED_FMT " '%s' <20><><EFBFBD><EFBFBD>饭. PID = %d\n\r"
#define EXEC_SCRIPT_ERROR_FMT "<22><EFBFBD><E8A8A1> <20> '%s' : <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E7A8AD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>窨 #SHS\n\r"
#define UNKNOWN_CMD_ERROR " <20><EFBFBD><E8A8A1>!\n\r"
#define CON_APP_ERROR " <20><EFBFBD><E8A8A1> <20> <20><><EFBFBD>᮫쭮<E1AEAB> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n\r"
#define FILE_NOT_FOUND_ERROR " <20><><EFBFBD><EFBFBD> '%s' <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n\r"

View File

@@ -1,29 +1,25 @@
/// =========================================================== void command_history_add() {
int i;
void command_history_add() if ('\0' == CMD[0]) return;
{
int i; CMD_NUM = -1;
if ('\0' == CMD[0]) return; for (i = 0; i < CMD_HISTORY_NUM_REAL; i++)
if ( 0 == strcmp( CMD_HISTORY[i], CMD ) )
return;
CMD_NUM = -1; for (i = CMD_HISTORY_NUM_REAL; i > 0 ; i--)
strcpy(CMD_HISTORY[i], CMD_HISTORY[i-1]);
for (i = 0; i < CMD_HISTORY_NUM_REAL; i++) strcpy(CMD_HISTORY[0], CMD);
if ( 0 == strcmp( CMD_HISTORY[i], CMD ) )
return;
for (i = CMD_HISTORY_NUM_REAL; i > 0 ; i--) if (CMD_HISTORY_NUM_REAL < CMD_HISTORY_NUM-1)
strcpy(CMD_HISTORY[i], CMD_HISTORY[i-1]); CMD_HISTORY_NUM_REAL++;
strcpy(CMD_HISTORY[0], CMD);
if (CMD_HISTORY_NUM_REAL < CMD_HISTORY_NUM-1)
CMD_HISTORY_NUM_REAL++;
} }
// ============================================================
char * insert_string( char s1[], unsigned int pos, const char s2[] ) char * insert_string( char s1[], unsigned int pos, const char s2[] )
{ {
@@ -48,362 +44,346 @@ char * insert_string( char s1[], unsigned int pos, const char s2[] )
return s1; return s1;
} }
/// ===========================================================
void command_get() void command_get()
{ {
unsigned key; unsigned key;
unsigned i; unsigned i;
unsigned cmdLen = 0; unsigned cmdLen = 0;
unsigned cmdPos = 0; unsigned cmdPos = 0;
CMD[0] = '\0'; CMD[0] = '\0';
int clipNum; // number of clipboard slots int clipNum; // number of clipboard slots
char* clipBuf; // clipboard buffer char* clipBuf; // clipboard buffer
char clipCopy[255+12]; char clipCopy[255+12];
for (;;) for (;;) {
{ key = getch();
key = getch(); if ( 0 != (key & 0xff) ) {
if ( 0 != (key & 0xff) ) key &= 0xff;
{ switch (key) {
key &= 0xff; case 27: // ESC
switch (key) for (i = cmdPos; i < cmdLen; i++)
{ printf(" ");
case 27: // ESC for (i = cmdLen; i > 0; i--)
for (i = cmdPos; i < cmdLen; i++) printf("%c %c", 8, 8);
printf(" "); cmdLen = 0;
for (i = cmdLen; i > 0; i--) cmdPos = 0;
printf("%c %c", 8, 8); CMD[0] = '\0';
cmdLen = 0; break;
cmdPos = 0;
CMD[0] = '\0';
break;
case 13: // ENTER case 13: // ENTER
printf("\n\r"); printf("\n\r");
command_history_add(); command_history_add();
return; return;
case 8: // BACKSPACE case 8: // BACKSPACE
if (cmdPos > 0) if (cmdPos > 0)
{ {
for (i = cmdPos-1; i < cmdLen; i++) for (i = cmdPos-1; i < cmdLen; i++)
CMD[i] = CMD[i+1]; CMD[i] = CMD[i+1];
for (i = 0; i < cmdLen-cmdPos; i++) for (i = 0; i < cmdLen-cmdPos; i++)
printf (" "); printf (" ");
for (i = 0; i < cmdLen; i++) for (i = 0; i < cmdLen; i++)
printf ("%c %c", 8, 8); printf ("%c %c", 8, 8);
printf("%s", CMD); printf("%s", CMD);
for (i = 0; i < cmdLen-cmdPos; i++) for (i = 0; i < cmdLen-cmdPos; i++)
printf("%c", 8); printf("%c", 8);
cmdPos--; cmdPos--;
cmdLen--; cmdLen--;
} }
break; break;
case 9: // TAB case 9: // TAB
break; break;
case 22: // Ctrl+V case 22: // Ctrl+V
clipNum = kol_clip_num(); clipNum = _ksys_clip_num();
if (clipNum > 0) if (clipNum > 0)
{ {
clipBuf = kol_clip_get(clipNum-1); clipBuf = _ksys_clip_get(clipNum-1);
// printf("Length: %d, Type: %d, Encoding: %d\n", (int) *clipBuf, (int)*(clipBuf+4), (int)*(clipBuf+8)); // printf("Length: %d, Type: %d, Encoding: %d\n", (int) *clipBuf, (int)*(clipBuf+4), (int)*(clipBuf+8));
if ( (int) *clipBuf > 0 ) // is clipboard empty? if ( (int) *clipBuf > 0 ) // is clipboard empty?
{ {
if ((int)*(clipBuf+4)==0) // text? if ((int)*(clipBuf+4)==0) // text?
{ {
if ((int)*(clipBuf+8)==1) // 866 encoding? if ((int)*(clipBuf+8)==1) // 866 encoding?
{ {
// clear previous text // clear previous text
for (i = cmdPos; i < cmdLen; i++) for (i = cmdPos; i < cmdLen; i++)
printf(" "); printf(" ");
for (i = cmdLen; i > 0; i--) for (i = cmdLen; i > 0; i--)
printf("%c %c", 8, 8); printf("%c %c", 8, 8);
char *pasteText = clipBuf + 12; char *pasteText = clipBuf + 12;
int pasteLen = strlen(pasteText); int pasteLen = strlen(pasteText);
insert_string(CMD, cmdPos, pasteText); insert_string(CMD, cmdPos, pasteText);
cmdLen = strlen(CMD); cmdLen = strlen(CMD);
cmdPos += pasteLen; cmdPos += pasteLen;
printf("%s", CMD); printf("%s", CMD);
for (i = 0; i < cmdLen-cmdPos; i++) printf("%c", 8); // rewind the internal console cursor for (i = 0; i < cmdLen-cmdPos; i++) printf("%c", 8); // rewind the internal console cursor
} }
} }
} }
} }
break; break;
case 3: // Ctrl+C case 3: // Ctrl+C
if ( cmdLen > 0 ) if ( cmdLen > 0 )
{ {
*clipCopy = 12 + cmdLen; *clipCopy = 12 + cmdLen;
*(clipCopy+4)=0; *(clipCopy+4)=0;
*(clipCopy+8)=1; *(clipCopy+8)=1;
for (i = 0; i <= cmdLen; i++) for (i = 0; i <= cmdLen; i++)
*(clipCopy+12+i) = CMD[i]; *(clipCopy+12+i) = CMD[i];
kol_clip_set(12+cmdLen, clipCopy); _ksys_clip_set(12+cmdLen, clipCopy);
} }
break; break;
default: default:
if (cmdLen < 255) if (cmdLen < 255)
{ {
if ( kol_key_control() & 0x40 ) // <20><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CapsLock if ( kol_key_control() & 0x40 ) // <20><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CapsLock
if ( (kol_key_control() & 1) || (kol_key_control() & 2)) // <20><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> if ( (kol_key_control() & 1) || (kol_key_control() & 2)) // <20><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
key = tolower(key); key = tolower(key);
else else
key = toupper(key); key = toupper(key);
for (i = cmdLen+1; i > cmdPos; i--) for (i = cmdLen+1; i > cmdPos; i--)
CMD[i] = CMD[i-1]; CMD[i] = CMD[i-1];
CMD[cmdPos] = key; CMD[cmdPos] = key;
for (i = cmdPos; i > 0; i--) for (i = cmdPos; i > 0; i--)
printf("%c %c", 8, 8); printf("%c %c", 8, 8);
printf("%s", CMD); printf("%s", CMD);
for (i = 0; i < cmdLen-cmdPos; i++) for (i = 0; i < cmdLen-cmdPos; i++)
printf("%c", 8); printf("%c", 8);
cmdPos++; cmdPos++;
cmdLen++; cmdLen++;
} }
break; break;
} }
} }
else else
{ {
key = (key>>8)&0xff; key = (key>>8)&0xff;
switch (key) switch (key)
{ {
case 83: // Del case 83: // Del
if (cmdPos < cmdLen) if (cmdPos < cmdLen)
{ {
for (i = cmdPos; i < cmdLen; i++) for (i = cmdPos; i < cmdLen; i++)
CMD[i] = CMD[i+1]; CMD[i] = CMD[i+1];
for (i = 0; i < cmdLen-cmdPos; i++) for (i = 0; i < cmdLen-cmdPos; i++)
printf(" "); printf(" ");
for (i = 0; i < cmdLen-cmdPos; i++) for (i = 0; i < cmdLen-cmdPos; i++)
printf("%c", 8); printf("%c", 8);
for (i = cmdPos; i < cmdLen; i++) for (i = cmdPos; i < cmdLen; i++)
printf("%c", CMD[i]); printf("%c", CMD[i]);
for (i = 0; i < cmdLen-cmdPos; i++) for (i = 0; i < cmdLen-cmdPos; i++)
printf("%c", 8); printf("%c", 8);
cmdLen--; cmdLen--;
} }
break; break;
case 0x47: // Home case 0x47: // Home
// move internal cursor and cmdPos to the beginning of the line // move internal cursor and cmdPos to the beginning of the line
for (;cmdPos > 0; cmdPos--) {printf("%c", 8);} for (;cmdPos > 0; cmdPos--) {printf("%c", 8);}
break; break;
case 0x4F: // End case 0x4F: // End
// move internal cursor and cmdPos to the end of the line // move internal cursor and cmdPos to the end of the line
for (;cmdPos < cmdLen; cmdPos++) {printf("%c", CMD[cmdPos]);} for (;cmdPos < cmdLen; cmdPos++) {printf("%c", CMD[cmdPos]);}
break; break;
case 75: // Left case 75: // Left
if (cmdPos > 0) if (cmdPos > 0)
{ {
printf("%c", 8); printf("%c", 8);
cmdPos--; cmdPos--;
} }
break; break;
case 77: // Right case 77: // Right
if (cmdPos < cmdLen) if (cmdPos < cmdLen)
{ {
printf("%c", CMD[cmdPos]); printf("%c", CMD[cmdPos]);
cmdPos++; cmdPos++;
} }
break; break;
case 72: // Up case 72: // Up
if (CMD_HISTORY_NUM_REAL > 0 && CMD_NUM >= -1) if (CMD_HISTORY_NUM_REAL > 0 && CMD_NUM >= -1)
{ {
for (i = cmdPos; i < cmdLen; i++) for (i = cmdPos; i < cmdLen; i++)
printf(" "); printf(" ");
for (i = cmdLen; i > 0; i--) for (i = cmdLen; i > 0; i--)
printf("%c %c", 8, 8); printf("%c %c", 8, 8);
if (CMD_NUM < CMD_HISTORY_NUM_REAL-1) if (CMD_NUM < CMD_HISTORY_NUM_REAL-1)
CMD_NUM++; CMD_NUM++;
/* else /* else
CMD_NUM = 0; CMD_NUM = 0;
*/ */
printf("%s", CMD_HISTORY[CMD_NUM]); printf("%s", CMD_HISTORY[CMD_NUM]);
strcpy(CMD, CMD_HISTORY[CMD_NUM]); strcpy(CMD, CMD_HISTORY[CMD_NUM]);
cmdLen = strlen(CMD); cmdLen = strlen(CMD);
cmdPos = strlen(CMD); cmdPos = strlen(CMD);
} }
break; break;
case 80: // Down case 80: // Down
if (CMD_HISTORY_NUM_REAL > 0 && CMD_NUM >= 0) if (CMD_HISTORY_NUM_REAL > 0 && CMD_NUM >= 0)
{ {
for (i = cmdPos; i < cmdLen; i++) for (i = cmdPos; i < cmdLen; i++)
printf(" "); printf(" ");
for (i = cmdLen; i > 0; i--) for (i = cmdLen; i > 0; i--)
printf("%c %c", 8, 8); printf("%c %c", 8, 8);
if (CMD_NUM > 0) if (CMD_NUM > 0)
CMD_NUM--; CMD_NUM--;
/* else /* else
CMD_NUM = CMD_HISTORY_NUM_REAL-1; CMD_NUM = CMD_HISTORY_NUM_REAL-1;
*/ */
printf("%s", CMD_HISTORY[CMD_NUM]); printf("%s", CMD_HISTORY[CMD_NUM]);
strcpy(CMD, CMD_HISTORY[CMD_NUM]); strcpy(CMD, CMD_HISTORY[CMD_NUM]);
cmdLen = strlen(CMD); cmdLen = strlen(CMD);
cmdPos = strlen(CMD); cmdPos = strlen(CMD);
} }
break; break;
case 0: // console window closed case 0: // console window closed
cmd_exit(NULL); cmd_exit(NULL);
} } // switch end
} // if end
} } // for end
}
} }
/// ===========================================================
int command_get_cmd(char cmd[]) int command_get_cmd(char cmd[])
{ {
unsigned i, len; unsigned i, len;
int quote = 0; int quote = 0;
if (CMD[0]=='"') if (CMD[0]=='"')
quote = 1; quote = 1;
if (quote == 0) if (quote == 0)
{ {
for (i=0;;i++) for (i=0;;i++)
{ {
cmd[i] = CMD[i]; cmd[i] = CMD[i];
if (0 == cmd[i]) if (0 == cmd[i])
return i; return i;
if ( iswhite(cmd[i]) ) if ( iswhite(cmd[i]) )
{ {
cmd[i] = '\0'; cmd[i] = '\0';
break; break;
} }
} }
return i+1; return i+1;
} }
else else
{ {
len = 0; len = 0;
for (i=1;;i++) for (i=1;;i++)
{ {
cmd[len] = CMD[i]; cmd[len] = CMD[i];
if (0 == cmd[len]) if (0 == cmd[len])
{ {
i--; i--;
break; break;
} }
if ( cmd[len] == '"' ) if ( cmd[len] == '"' )
{ {
cmd[len] = '\0'; cmd[len] = '\0';
break; break;
} }
len++; len++;
} }
trim(cmd); trim(cmd);
return i+1; return i+1;
} }
} }
/// ===========================================================
typedef int (*handler1_t)(char* arg); typedef int (*handler1_t)(char* arg);
/// ===========================================================
void command_execute() void command_execute()
{ {
char cmd[256]; char cmd[256];
char args[256]; char args[256];
unsigned arg; unsigned arg;
int i; int i;
int result; int result;
trim(CMD); trim(CMD);
arg = command_get_cmd(cmd); arg = command_get_cmd(cmd);
if ( !strlen(cmd) ) if ( !strlen(cmd) )
return; return;
strcpy(args, CMD+arg); strcpy(args, CMD+arg);
trim(args); trim(args);
for (i = 0; i < NUM_OF_CMD; i++) for (i = 0; i < NUM_OF_CMD; i++) {
{ if (!strcmp(cmd, COMMANDS[i].name)) {
if (!strcmp(cmd, COMMANDS[i].name)) result = ((handler1_t)COMMANDS[i].handler)(args);
{ if (result == FALSE) {
result = ((handler1_t)COMMANDS[i].handler)(args); printf(UNKNOWN_CMD_ERROR);
if (result == FALSE) }
{ return;
#if LANG_ENG }
printf(" Error!\n\r"); }
#elif LANG_RUS
printf(" <20><EFBFBD><E8A8A1>!\n\r");
#endif
}
return;
}
}
if ( -1 != alias_search(CMD) ) {
strcpy(CMD, ALIASES+64*1024+256*alias_search(CMD));
command_execute();
return;
}
if ( -1 != alias_search(CMD) ) executable_run(cmd, args);
{
strcpy(CMD, ALIASES+64*1024+256*alias_search(CMD));
command_execute();
return;
}
executable_run(cmd, args);
} }
/// ===========================================================

View File

@@ -1,74 +1,54 @@
/// =========================================================== int executable_run(char cmd[], char args[]) {
char exec[FILENAME_MAX];
int result;
int executable_run(char cmd[], char args[]) if ( '/' == cmd[0]) // if path is absolute
{ {
strcpy(exec, cmd);
if (!file_check(exec) ) // check file existense
{
file_not_found(cmd);
return FALSE;
}
} else {
strcpy(exec, cur_dir); // check file in current directory
if (exec[strlen(exec)-1] != '/')
strcat(exec, "/"); // add slash
strcat(exec, cmd);
if ( !file_check(exec) ) // check file existense
{
strcpy(exec, "/rd/1/"); // check file on virtual disk
strcat(exec, cmd);
if ( !file_check(exec) ) // check file existense
{
file_not_found(cmd);
return FALSE;
}
}
}
char exec[FILENAME_MAX]; // if file exists:
int result;
if ( '/' == cmd[0]) // if path is absolute // try to run as a program
{ result = program_run(exec, args);
strcpy(exec, cmd); if (result > 0) {
if (!file_check(exec) ) // check file existense if ( !program_console(result) ) {
{ LAST_PID = result;
file_not_found(cmd); printf (EXEC_STARTED_FMT, cmd, result);
return FALSE; }
} return TRUE;
} } else {
else if ( script_check(exec) ) // if file is a valid script
{ {
strcpy(exec, cur_dir); // check file in current directory return script_run(exec, args);
if (exec[strlen(exec)-1] != '/') } else
strcat(exec, "/"); // add slash {
strcat(exec, cmd); printf (EXEC_SCRIPT_ERROR_FMT, cmd);
return FALSE;
if ( !file_check(exec) ) // check file existense }
{ }
strcpy(exec, "/rd/1/"); // check file on virtual disk
strcat(exec, cmd);
if ( !file_check(exec) ) // check file existense
{
file_not_found(cmd);
return FALSE;
}
}
}
// if file exists:
// try to run as a program
result = program_run(exec, args);
if (result > 0)
{
if ( !program_console(result) )
{
LAST_PID = result;
#if LANG_ENG
printf (" '%s' started. PID = %d\n\r", cmd, result);
#elif LANG_RUS
printf (" '%s' <20><><EFBFBD><EFBFBD>饭. PID = %d\n\r", cmd, result);
#endif
}
return TRUE;
}
else
{
if ( script_check(exec) ) // if file is a valid script
{
return script_run(exec, args);
} else
{
#if LANG_ENG
printf ("Error in '%s' : script must start with #SHS line\n\r", cmd);
#elif LANG_RUS
printf ("<EFBFBD><EFBFBD><EFBFBD> <20> '%s' : <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E7A8AD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>窨 #SHS\n\r", cmd);
#endif
return FALSE;
}
}
} }
/// ===========================================================

View File

@@ -1,63 +1,53 @@
/// =========================================================== int parameters_prepare(char *param, char* argv[]) {
int i, param_len;
int argc = 1;
int quote = 0;
int argv_len;
int parameters_prepare(char *param, char* argv[]) param_len = strlen(param);
{ if ( param_len == 0 )
return 0;
int i, param_len; argv[0] = (char*) malloc(4096);
int argc = 1;
int quote = 0;
int argv_len;
param_len = strlen(param); argv_len = 0;
if ( param_len == 0 ) for (i = 0; i < param_len; i++) {
return 0; switch (param[i]) {
case '\\':
if (param[i+1]!='\0') {
switch(param[i+1]) {
argv[0] = (char*) malloc(4096); case 'n':
argv[argc-1][argv_len] = '\n';
argv_len++;
i++;
break;
argv_len = 0; case 't':
for (i = 0; i < param_len; i++) argv[argc-1][argv_len] = '\t';
{ argv_len++;
switch (param[i]) i++;
{
case '\\': case '\\':
if (param[i+1]!='\0') case '\'':
{ case '"':
switch(param[i+1]) case '?':
{ argv[argc-1][argv_len] = param[i+1];
argv_len++;
i++;
break;
case 'n': default:
argv[argc-1][argv_len] = '\n'; i++;
argv_len++; };
i++; }
break; break;
case 't': case '"':
argv[argc-1][argv_len] = '\t'; if (quote == 0)
argv_len++;
i++;
case '\\':
case '\'':
case '"':
case '?':
argv[argc-1][argv_len] = param[i+1];
argv_len++;
i++;
break;
default:
i++;
};
}
break;
case '"':
if (quote == 0)
quote = 1; quote = 1;
else else {
{
quote = 0; quote = 0;
argv[argc-1][argv_len] = '\0'; argv[argc-1][argv_len] = '\0';
argc++; argc++;
@@ -65,62 +55,46 @@ for (i = 0; i < param_len; i++)
argv[argc-1][argv_len] = '\0'; argv[argc-1][argv_len] = '\0';
argv_len = 0; argv_len = 0;
} }
break; break;
case 9: case 9:
case 32: case 32:
if (quote == 0) if (quote == 0) {
{ if ( ( param[i+1] != 32) || ( param[i+1] != 9) ) {
if ( ( param[i+1] != 32) || ( param[i+1] != 9) ) if (argv_len != 0) {
{ argv[argc-1][argv_len] = '\0';
if (argv_len != 0) argc++;
{ argv[argc-1] = (char*) malloc(4096);
argv[argc-1][argv_len] = '\0'; argv[argc-1][argv_len] = '\0';
argc++; argv_len = 0;
argv[argc-1] = (char*) malloc(4096);
argv[argc-1][argv_len] = '\0';
argv_len = 0;
} }
} }
} } else {
else
{
argv[argc-1][argv_len] = param[i]; argv[argc-1][argv_len] = param[i];
argv_len++; argv_len++;
} }
break;
default:
argv[argc-1][argv_len] = param[i];
argv_len++;
break;
break; }; // switch end
} // for end
default: argv[argc-1][argv_len] = '\0';
argv[argc-1][argv_len] = param[i];
argv_len++;
break;
}; if ( strlen(argv[argc-1]) == 0 ) {
} free(argv[argc-1]);
argc--;
}
argv[argc-1][argv_len] = '\0'; return argc;
if ( strlen(argv[argc-1]) == 0 )
{
free(argv[argc-1]);
argc--;
}
return argc;
} }
/// ===========================================================
void parameters_free(int argc, char* argv[])
{
int i;
for (i = 0; i < argc; i++)
free(argv[i]);
void parameters_free(int argc, char* argv[]) {
int i;
for (i = 0; i < argc; i++) free(argv[i]);
} }
/// ===========================================================

View File

@@ -2,107 +2,95 @@
#include "../program_console.h" #include "../program_console.h"
int program_console(int pid) int program_console(int pid) {
{ char name[32];
char *buffer;
char *buf1k;
int result;
int i;
char command;
int size;
int is_end;
char name[32]; itoa(pid, name);
char *buffer; strcat(name, "-SHELL");
char *buf1k;
int result;
int i;
char command;
int size;
int is_end;
itoa(pid, name); buffer = NULL;
strcat(name, "-SHELL"); buf1k = NULL;
buffer = NULL; for (i = 0; i < 30; i++) {
buf1k = NULL; result = kol_buffer_open(name, SHM_OPEN | SHM_WRITE, 0, &buffer);
if (buffer != NULL)
break;
for (i = 0; i < 30; i++) kol_sleep(2);
{ }
result = kol_buffer_open(name, SHM_OPEN | SHM_WRITE, 0, &buffer);
if (buffer != NULL)
break;
kol_sleep(2); if (buffer == NULL)
} return 0;
else
size = result;
if (buffer == NULL) is_end = 0;
return 0; for (;;) {
else command = *(buffer);
size = result;
switch (command) {
case SC_EXIT:
*buffer = SC_OK;
is_end = 1;
break;
case SC_OK:
kol_sleep(5);
break;
is_end = 0; case SC_CLS:
for (;;) con_cls();
{ *buffer = SC_OK;
break;
case SC_PUTC:
printf("%c", *(buffer+1));
*buffer = SC_OK;
break;
command = *(buffer); case SC_PUTS:
printf("%s", buffer+1 );
switch (command) *buffer = SC_OK;
{ break;
case SC_EXIT:
*buffer = SC_OK;
is_end = 1;
break;
case SC_OK:
kol_sleep(5);
break;
case SC_CLS:
con_cls();
*buffer = SC_OK;
break;
case SC_PUTC:
printf("%c", *(buffer+1));
*buffer = SC_OK;
break;
case SC_PUTS:
printf("%s", buffer+1 );
*buffer = SC_OK;
break;
case SC_GETC: case SC_GETC:
*(buffer+1) = (char) getch() ; *(buffer+1) = (char) getch() ;
*buffer = SC_OK; *buffer = SC_OK;
break; break;
case SC_GETS: case SC_GETS:
gets(buffer+1, size-2); gets(buffer+1, size-2);
*buffer = SC_OK; *buffer = SC_OK;
break; break;
case SC_PID: case SC_PID:
buf1k=malloc(1024); buf1k=malloc(1024);
kol_process_info(-1, buf1k); kol_process_info(-1, buf1k);
memcpy(buffer+1, buf1k+30, sizeof(unsigned)); memcpy(buffer+1, buf1k+30, sizeof(unsigned));
*buffer = SC_OK; *buffer = SC_OK;
free(buf1k); free(buf1k);
break; break;
case SC_PING: case SC_PING:
*buffer = SC_OK; *buffer = SC_OK;
break; break;
default: default:
#if LANG_ENG printf (CON_APP_ERROR);
printf (" Error in console application.\n\r"); return 0;
#elif LANG_RUS };
printf (" <20><EFBFBD><E8A8A1> <20> <20><><EFBFBD>᮫쭮<E1AEAB> <20><EFBFBD><E0A8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n\r"); if (is_end) {
#endif printf("\n\r");
return 0; return 1;
}; }
if (is_end) } // for end
{ return 9;
printf("\n\r");
return 1;
}
}
return 9;
} }

View File

@@ -1,106 +1,96 @@
/// ===========================================================
int script_check(char file[]) int script_check(char file[]) {
{ kol_struct70 k70;
char buf[4];
kol_struct70 k70; k70.p00 = 0;
char buf[4]; k70.p04 = 0;
//k70.p08 = 0;
k70.p12 = 4; // read 4 bytes
k70.p16 = (unsigned) buf;
k70.p20 = 0;
k70.p21 = file;
k70.p00 = 0; kol_file_70(&k70);
k70.p04 = 0;
//k70.p08 = 0;
k70.p12 = 4; // read 4 bytes
k70.p16 = (unsigned) buf;
k70.p20 = 0;
k70.p21 = file;
kol_file_70(&k70); if ( !strcmp(buf, script_sign) ) // if we found the script signature
return TRUE;
if ( !strcmp(buf, script_sign) ) // if we found the script signature else
return TRUE; return FALSE;
else
return FALSE;
} }
/// ===========================================================
int script_run(char exec[], char args[]) int script_run(char exec[], char args[]) {
{ kol_struct70 k70;
kol_struct_BDVK bdvk;
unsigned result, i;
unsigned long long filesize, pos;
char *buf; // buffer, where script is copied
kol_struct70 k70; k70.p00 = 5;
kol_struct_BDVK bdvk; k70.p04 = k70.p12 = 0;
unsigned result, i; //k70.p08 = 0;
unsigned long long filesize, pos; k70.p16 = (unsigned) &bdvk;
char *buf; // buffer, where script is copied k70.p20 = 0;
k70.p21 = exec;
k70.p00 = 5; result = kol_file_70(&k70); // get file info
k70.p04 = k70.p12 = 0; if ( 0 != result )
//k70.p08 = 0; return FALSE;
k70.p16 = (unsigned) &bdvk;
k70.p20 = 0;
k70.p21 = exec;
result = kol_file_70(&k70); // get file info filesize = bdvk.p32; // get file size
if ( 0 != result )
return FALSE;
filesize = bdvk.p32; // get file size buf = malloc(filesize+256); // may fail for over 4Gb file, but impossible case
if (NULL == buf)
return FALSE;
buf = malloc(filesize+256); // may fail for over 4Gb file, but impossible case buf[filesize]=0;
if (NULL == buf)
return FALSE;
buf[filesize]=0; k70.p00 = 0;
k70.p04 = 0;
//k70.p08 = 0;
k70.p12 = filesize;
k70.p16 = (unsigned) buf;
k70.p20 = 0;
k70.p21 = exec;
k70.p00 = 0; result = kol_file_70(&k70); // read file to the buffer
k70.p04 = 0; if ( 0 != result )
//k70.p08 = 0; {
k70.p12 = filesize; free(buf);
k70.p16 = (unsigned) buf; return FALSE;
k70.p20 = 0; }
k70.p21 = exec;
result = kol_file_70(&k70); // read file to the buffer pos = 0;
if ( 0 != result )
{
free(buf);
return FALSE;
}
pos = 0; for (;;) // script processing
{
if (pos > filesize)
break;
for (;;) // script processing for (i=0;;i++) // reading a string
{ {
if ((0x0A == buf[pos])||(0x0D == buf[pos])||(0 == buf[pos]))
{
pos++;
CMD[i] = '\0';
break;
}
CMD[i] = buf[pos];
pos++;
}
if (pos > filesize) if ( 0 == strlen(CMD) ) // empty string
break; continue;
for (i=0;;i++) // reading a string if ('#' == CMD[0]) // comment
{ continue;
if ((0x0A == buf[pos])||(0x0D == buf[pos])||(0 == buf[pos]))
{
pos++;
CMD[i] = '\0';
break;
}
CMD[i] = buf[pos];
pos++;
}
if ( 0 == strlen(CMD) ) // empty string command_execute();
continue;
if ('#' == CMD[0]) // comment }
continue;
command_execute(); free(buf);
return TRUE;
}
free(buf);
return TRUE;
} }
/// ===========================================================

View File

@@ -8,7 +8,6 @@ void dir_truncate(char dir[]);
int iswhite(char c); int iswhite(char c);
void trim(char string[]); void trim(char string[]);
void execute(); void execute();
void kol_main();
int executable_run(char cmd[], char args[]); int executable_run(char cmd[], char args[]);

View File

@@ -1,188 +1,170 @@
#include "all.h" #include "all.h"
/// ===========================================================
int dir_check(char dir[]) int dir_check(char dir[])
/// just checks, if dir[] is really a directory /// just checks, if dir[] is really a directory
{ {
kol_struct70 k70; kol_struct70 k70;
int result; int result;
k70.p00 = 1; k70.p00 = 1;
k70.p04 = 0; k70.p04 = 0;
//k70.p08 = 0; //k70.p08 = 0;
k70.p12 = 2; // enough to read . & .. k70.p12 = 2; // enough to read . & ..
k70.p16 = (unsigned)malloc(32+k70.p12*560); k70.p16 = (unsigned)malloc(32+k70.p12*560);
k70.p20 = 0; k70.p20 = 0;
k70.p21 = dir; k70.p21 = dir;
result = kol_file_70(&k70); result = kol_file_70(&k70);
free((void*)k70.p16); free((void*)k70.p16);
if ( (0 == result)||(6 == result) ) // 6 is possible ??? if ( (0 == result)||(6 == result) ) // 6 is possible ???
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
} }
/// ===========================================================
void dir_truncate(char dir[]) void dir_truncate(char dir[])
{ {
int i; int i;
i = strlen(dir)-1; i = strlen(dir)-1;
for (;;i--) for (;;i--)
if ('/' == dir[i]) if ('/' == dir[i])
{ {
dir[i+1] = 0; dir[i+1] = 0;
break; break;
} }
} }
/// ===========================================================
void get_file_dir_loc(char *filepath, char *dir_path) void get_file_dir_loc(char *filepath, char *dir_path)
{ {
char *res = strrchr(filepath, '/'); char *res = strrchr(filepath, '/');
if (res == 0) if (res == 0)
{ {
dir_path = '\0'; dir_path = '\0';
return; return;
} }
size_t pos = res - filepath; size_t pos = res - filepath;
strncpy(dir_path, filepath, pos); strncpy(dir_path, filepath, pos);
dir_path[pos] = '\0'; dir_path[pos] = '\0';
} }
/// ===========================================================
int file_check(char file[]) int file_check(char file[])
{ {
kol_struct70 k70; kol_struct70 k70;
int result; int result;
k70.p00 = 0; k70.p00 = 0;
k70.p04 = 0; k70.p04 = 0;
//k70.p08 = 0; //k70.p08 = 0;
k70.p12 = 0; k70.p12 = 0;
k70.p16 = 0; k70.p16 = 0;
k70.p20 = 0; k70.p20 = 0;
k70.p21 = file; k70.p21 = file;
result = kol_file_70(&k70); result = kol_file_70(&k70);
if (0 == result) if (0 == result)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
} }
/// ===========================================================
void file_not_found(char file[]) void file_not_found(char file[]) {
{ printf (FILE_NOT_FOUND_ERROR, file);
#if LANG_ENG
printf (" File '%s' not found.\n\r", file);
#elif LANG_RUS
printf (" <20><><EFBFBD><EFBFBD> '%s' <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n\r", file);
#endif
} }
/// ===========================================================
int iswhite(char c) int iswhite(char c) {return ((' ' == c) || ('\t' == c) || (13 == c) || (10 == c)); }
{
return ((' ' == c) || ('\t' == c) || (13 == c) || (10 == c));
}
/// ===========================================================
void trim(char string[]) void trim(char string[])
{ {
int i, j; int i, j;
for (i=0; ;i++) for (i=0; ;i++)
if ( !iswhite(string[i]) ) if ( !iswhite(string[i]) )
break; break;
j = 0; j = 0;
for (;;i++, j++) for (;;i++, j++)
{ {
string[j] = string[i]; string[j] = string[i];
if ('\0' == string[i] ) if ('\0' == string[i] )
break; break;
} }
for (i=0; ;i++) for (i=0; ;i++)
if ('\0' == string[i]) if ('\0' == string[i])
break; break;
i--; i--;
for (;i>0;--i) for (;i>0;--i)
if ( iswhite(string[i]) ) if ( iswhite(string[i]) )
string[i] = '\0'; string[i] = '\0';
else else
break; break;
} }
/// ===========================================================
void kol_main() // entry point
int main(int argc, char **argv)
{ {
int i; for (i = 1; i < argc; i++) {
strcat(cmdline, argv[i]);
if (i != argc - 1) {
strcat(cmdline, " ");
}
}
NUM_OF_CMD = sizeof(COMMANDS)/sizeof(COMMANDS[0]); NUM_OF_CMD = sizeof(COMMANDS)/sizeof(COMMANDS[0]);
strcpy(title, "SHELL ");
strcat(title, SHELL_VERSION);
con_init_opt(-1, -1, -1, -1, title);
strcpy(title, "SHELL "); //printf("argc = %d\ncmdline = '%s'\n", argc, cmdline);
strcat(title, SHELL_VERSION);
CONSOLE_INIT(title);
if (sizeof (kol_struct70) != 25) if (sizeof (kol_struct70) != 25) {
{ printf("Invalid struct align kol_struct70, need to fix compile options\n\r");
printf("Invalid struct align kol_struct70, need to fix compile options\n\r"); kol_exit();
kol_exit(); }
//strcpy(cur_dir, PATH);
//dir_truncate(cur_dir);
getcwd(cur_dir, sizeof cur_dir);
//printf("curdir %s\n", cur_dir);
con_set_cursor_height(con_get_font_height()-1);
ALIASES = malloc(128*1024);
if (!cmdline || cmdline[0] == 0) {
strcpy(CMD, argv[0]);
dir_truncate(CMD);
strcat(CMD, ".shell");
if ( !file_check(CMD) )
strcpy(CMD, "/sys/settings/.shell");
}
else {
if (cmdline[0] == '/')
{
strcpy(cur_dir, cmdline);
*(strrchr(cur_dir, '/')+1)=0;
}
strcpy(CMD, cmdline);
}
command_execute();
for (;;) {
//printf("\033[32;1m");
printf ("# ");
//printf("\033[0m");
command_get();
command_execute();
}
con_exit(0);
kol_exit();
} }
//strcpy(cur_dir, PATH);
//dir_truncate(cur_dir);
getcwd(cur_dir, sizeof cur_dir);
//printf("curdir %s\n", cur_dir);
con_set_cursor_height(con_get_font_height()-1);
ALIASES = malloc(128*1024);
if (!PARAM || PARAM[0] == 0)
{
strcpy(CMD, PATH);
dir_truncate(CMD);
strcat(CMD, ".shell");
if ( !file_check(CMD) )
strcpy(CMD, "/sys/settings/.shell");
}
else
{
if (PARAM[0] == '/')
{
strcpy(cur_dir, PARAM);
*(strrchr(cur_dir, '/')+1)=0;
}
strcpy(CMD, PARAM);
}
command_execute();
for (;;)
{
//printf("\033[32;1m");
printf ("# ");
//printf("\033[0m");
command_get();
command_execute();
}
_exit(0);
kol_exit();
}
/// ===========================================================

View File

@@ -1,41 +0,0 @@
format MS COFF
public Start
public _PATH
public _PARAM
extrn Memory
extrn hEnd
extrn _kol_main
section ".text" code
db "MENUET01"
dd 1, Start, hEnd, Memory, hStack, _PARAM, _PATH
Start:
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
mov eax, 68
mov ebx, 11
int 0x40
; <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov eax, _kol_main
call eax
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
mov eax, -1
int 0x40
section ".bss"
_PARAM:
rb 256
_PATH:
rb 256
rb 8*1024
hStack:

View File

@@ -1,88 +0,0 @@
///===========================
#define CON_COLOR_BLUE 1
#define CON_COLOR_GREEN 2
#define CON_COLOR_RED 4
#define CON_COLOR_BRIGHT 8
/* <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
#define CON_BGR_BLUE 0x10
#define CON_BGR_GREEN 0x20
#define CON_BGR_RED 0x40
#define CON_BGR_BRIGHT 0x80
///===========================
void (* _stdcall con_init)(unsigned w_w, unsigned w_h, unsigned s_w, unsigned s_h, const char* t);
void (* _cdecl printf)(const char* format,...);
void (* _stdcall _exit)(char bCloseWindow);
void (* __stdcall gets)(char* str, int n);
int (* __stdcall getch)(void);
int (* __stdcall con_get_font_height)(void);
int (* __stdcall con_set_cursor_height)(int new_height);
unsigned (*__stdcall con_get_flags)(void);
unsigned (*__stdcall con_set_flags)(unsigned new_flags);
void (*__stdcall con_cls)(void);
///===========================
void CONSOLE_INIT(char title[])
{
kol_struct_import *imp;
imp = kol_cofflib_load("/sys/lib/console.obj");
if (imp == NULL)
kol_exit();
con_init = ( _stdcall void (*)(unsigned, unsigned, unsigned, unsigned, const char*))
kol_cofflib_procload (imp, "con_init");
if (con_init == NULL)
kol_exit();
printf = ( _cdecl void (*)(const char*,...))
kol_cofflib_procload (imp, "con_printf");
if (printf == NULL)
kol_exit();
_exit = ( _stdcall void (*)(char))
kol_cofflib_procload (imp, "con_exit");
if (_exit == NULL)
kol_exit();
gets = ( _stdcall void (*)(char*, int))
kol_cofflib_procload (imp, "con_gets");
if (gets == NULL)
kol_exit();
getch = ( _stdcall int (*)(void))
kol_cofflib_procload (imp, "con_getch2");
if (getch == NULL)
kol_exit();
con_get_font_height = ( _stdcall int (*)(void))
kol_cofflib_procload (imp, "con_get_font_height");
if (con_get_font_height == NULL)
kol_exit();
con_set_cursor_height = ( _stdcall int (*)(int))
kol_cofflib_procload (imp, "con_set_cursor_height");
if (con_set_cursor_height == NULL)
kol_exit();
con_get_flags = ( _stdcall unsigned (*)(void))
kol_cofflib_procload (imp, "con_get_flags");
if (con_get_flags == NULL)
kol_exit();
con_set_flags = ( _stdcall unsigned (*)(unsigned))
kol_cofflib_procload (imp, "con_set_flags");
if (con_set_flags == NULL)
kol_exit();
con_cls = ( _stdcall void (*)(void))
kol_cofflib_procload (imp, "con_cls");
if (con_cls == NULL)
kol_exit();
con_init(-1, -1, -1, -1, title);
}

View File

@@ -1,39 +0,0 @@
#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;
}

View File

@@ -1,3 +0,0 @@
int toupper(int c);
int tolower(int c);

View File

@@ -354,13 +354,13 @@ asm volatile ("int $0x40"::"a"(18), "b"(14));
void kol_screen_get_size(unsigned *w, unsigned *h) /*void kol_screen_get_size(unsigned *w, unsigned *h)
{ {
unsigned size; unsigned size;
asm volatile ("int $0x40":"=a"(size):"a"(14)); asm volatile ("int $0x40":"=a"(size):"a"(14));
*w = size / 65536; *w = size / 65536;
*h = size % 65536; *h = size % 65536;
} }*/
@@ -422,7 +422,7 @@ void kol_buffer_close(char name[])
asm volatile ("int $0x40"::"a"(68), "b"(23), "c"(name)); asm volatile ("int $0x40"::"a"(68), "b"(23), "c"(name));
} }
int kol_clip_num() /*int kol_clip_num()
{ {
asm volatile ("int $0x40"::"a"(54), "b"(0)); asm volatile ("int $0x40"::"a"(54), "b"(0));
} }
@@ -435,7 +435,7 @@ asm volatile ("int $0x40"::"a"(54), "b"(1), "c"(n));
int kol_clip_set(int n, char buffer[]) int kol_clip_set(int n, char buffer[])
{ {
asm volatile ("int $0x40"::"a"(54), "b"(2), "c"(n), "d"(buffer)); asm volatile ("int $0x40"::"a"(54), "b"(2), "c"(n), "d"(buffer));
} }*/
void set_cwd(const char* cwd) void set_cwd(const char* cwd)
{ {

View File

@@ -100,7 +100,7 @@ unsigned kol_system_date_get();
void kol_path_file2dir(char *dir, char *fname); void kol_path_file2dir(char *dir, char *fname);
void kol_path_full(char *full, char *fname); void kol_path_full(char *full, char *fname);
void kol_screen_wait_rr(); void kol_screen_wait_rr();
void kol_screen_get_size(unsigned *w, unsigned *h); //void kol_screen_get_size(unsigned *w, unsigned *h);
unsigned kol_skin_height(); unsigned kol_skin_height();
unsigned kol_thread_start(unsigned start, unsigned stack); unsigned kol_thread_start(unsigned start, unsigned stack);
unsigned kol_time_tick(); unsigned kol_time_tick();
@@ -111,9 +111,9 @@ void kol_get_kernel_ver(char buff16b[]);
int kol_kill_process(unsigned process); int kol_kill_process(unsigned process);
int kol_buffer_open(char name[], int mode, int size, char **buf); int kol_buffer_open(char name[], int mode, int size, char **buf);
void kol_buffer_close(char name[]); void kol_buffer_close(char name[]);
int kol_clip_num(); //int kol_clip_num();
char* kol_clip_get(int n); //char* kol_clip_get(int n);
int kol_clip_set(int n, char buffer[]); //int kol_clip_set(int n, char buffer[]);
void set_cwd(const char* cwd); void set_cwd(const char* cwd);
int getcwd(char *buf, unsigned size); int getcwd(char *buf, unsigned size);

View File

@@ -1,33 +0,0 @@
unsigned int seed_o = 0x45168297;
void srand (unsigned seed)
{
seed_o = seed;
}
int rand (void)
{
seed_o = seed_o * 0x15a4e35 + 1;
return(seed_o >> 16);
}
void* malloc(unsigned s)
{
asm ("int $0x40"::"a"(68), "b"(12), "c"(s) );
}
void free(void *p)
{
asm ("int $0x40"::"a"(68), "b"(13), "c"(p) );
}
void* realloc(void *p, unsigned s)
{
asm ("int $0x40"::"a"(68), "b"(20), "c"(p), "d"(s) );
}

View File

@@ -1,14 +0,0 @@
#define RAND_MAX 0x7FFFU
#define isspace(c) ((c)==' ')
#define abs(i) (((i)<0)?(-(i)):(i))
#define random(num) ((rand()*(num))/((RAND_MAX+1)))
void* malloc(unsigned size);
void free(void* pointer);
void* realloc(void* pointer, unsigned size);
void srand (unsigned seed);
int rand (void);

View File

@@ -1,221 +0,0 @@
#include "string.h"
#include "ctype.h"
void* memset(void *mem, int c, unsigned size)
{
unsigned i;
for ( i = 0; i < size; i++ )
*((char *)mem+i) = (char) c;
return NULL;
}
void* memcpy(void *dst, const void *src, unsigned size)
{
unsigned i;
for ( i = 0; i < size; i++)
*(char *)(dst+i) = *(char *)(src+i);
return NULL;
}
int memcmp(const void* buf1, const void* buf2, int count)
{
int i;
for (i=0;i<count;i++)
{
if (*(unsigned char*)buf1<*(unsigned char*)buf2)
return -1;
if (*(unsigned char*)buf1>*(unsigned char*)buf2)
return 1;
}
return 0;
}
void strcat(char strDest[], char strSource[])
{
int i, j;
i = j = 0;
while (strDest[i] != '\0')
i++;
while ((strDest[i++] = strSource[j++]) != '\0')
;
}
int strcmp(const char* string1, const char* string2)
{
while (1)
{
if (*string1<*string2)
return -1;
if (*string1>*string2)
return 1;
if (*string1=='\0')
return 0;
string1++;
string2++;
}
}
int strnicmp(const char* string1, const char* string2, unsigned count)
{
int pc = 0;
while (1)
{
if (toupper(*string1)<toupper(*string2))
return -1;
if (toupper(*string1)>toupper(*string2))
return 1;
if (*string1=='\0' || pc == count)
return 0;
string1++;
string2++;
pc++;
}
}
void strcpy(char strDest[], const char strSource[])
{
unsigned i;
i = 0;
while ((strDest[i] = strSource[i]) != '\0')
i++;
}
char* strncpy(char *strDest, const char *strSource, unsigned n)
{
unsigned i;
if (! n )
return strDest;
i = 0;
while ((strDest[i] = strSource[i]) != '\0')
if ( (n-1) == i )
break;
else
i++;
return strDest;
}
int strlen(const char* string)
{
int i;
i=0;
while (*string++) i++;
return i;
}
char* strchr(const char* string, int c)
{
while (*string)
{
if (*string==c)
return (char*)string;
string++;
}
return (char*)0;
}
char* strrchr(const char* string, int c)
{
char* last_found = 0; // !
while (*string)
{
if (*string==c)
{
last_found = (char*)string;
}
string++;
}
return last_found;
}
void _itoa(int i, char *s)
{
int a, b, c, d;
a = (i - i%1000)/1000;
b = (i - i%100)/100 - a*10;
c = (i - i%10)/10 - a*100 - b*10;
d = i%10;
s[0] = a + '0';
s[1] = b + '0';
s[2] = c + '0';
s[3] = d + '0';
s[4] = 0;
}
/* reverse: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> s <20><> <20><><EFBFBD><EFBFBD><EFBFBD> */
void reverse(char s[])
{
int i, j;
char c;
for (i = 0, j = strlen(s)-1; i<j; i++, j--) {
c = s[i];
s[i] = s[j];
s[j] = c;
}
}
/* itoa: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> n <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> s */
void itoa(int n, char s[])
{
int i, sign;
if ((sign = n) < 0)
n = -n;
i = 0;
do {
s[i++] = n % 10 + '0';
} while ((n /= 10) > 0);
if (sign < 0)
s[i++] = '-';
s[i] = '\0';
reverse(s);
}
int _atoi ( char *s )
{
int i, n;
n = 0;
for ( i = 0; s[i]!= '\0'; ++i)
if ((s[i]<'0') || (s[i]>'9'))
return 0;
else
n = 10 * n + s[i] - '0';
return n;
}

View File

@@ -1,21 +0,0 @@
#ifndef NULL
#define NULL ((void*)0)
#endif
void* memset(void *mem, int c, unsigned size);
void* memcpy(void *dst, const void *src, unsigned size);
int memcmp(const void* buf1, const void* buf2, int count);
void strcat(char strDest[], char strSource[]);
int strcmp(const char* string1, const char* string2);
void strcpy(char strDest[], const char strSource[]);
char* strncpy(char *strDest, const char *strSource, unsigned n);
int strlen(const char* string);
char* strchr(const char* string, int c);
char* strrchr(const char* string, int c);
void _itoa(int i, char *s);
void reverse(char *s);
void itoa(int i, char *s);
int _atoi( char *s );
int strnicmp(const char* string1, const char* string2, unsigned count);