From 99bb0c8af2a0da1caacdd0f15a25f22b359a12a3 Mon Sep 17 00:00:00 2001 From: Nasarus Date: Thu, 7 Oct 2010 13:43:56 +0000 Subject: [PATCH] 1. Shell updated to 0.4.4. Author: Albom 2. @SS [ScreenSaver] now reacts to key pressing git-svn-id: svn://kolibrios.org@1647 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/system/shell/all.h | 60 ++-- programs/system/shell/cmd_about.c | 9 - programs/system/shell/cmd_alias.c | 17 -- programs/system/shell/cmd_cd.c | 47 --- programs/system/shell/cmd_date.c | 22 -- programs/system/shell/cmd_echo.c | 6 - programs/system/shell/cmd_exit.c | 7 - programs/system/shell/cmd_free.c | 12 - programs/system/shell/cmd_help.c | 31 -- programs/system/shell/cmd_kill.c | 43 --- programs/system/shell/cmd_ls.c | 41 --- programs/system/shell/cmd_mkdir.c | 44 --- programs/system/shell/cmd_more.c | 87 ------ programs/system/shell/cmd_ps.c | 32 --- programs/system/shell/cmd_pwd.c | 5 - programs/system/shell/cmd_reboot.c | 5 - programs/system/shell/cmd_rm.c | 50 ---- programs/system/shell/cmd_rmdir.c | 46 --- programs/system/shell/cmd_touch.c | 54 ---- programs/system/shell/cmd_ver.c | 5 - programs/system/shell/compile.bat | 6 +- programs/system/shell/console.c | 82 ------ programs/system/shell/globals.h | 109 ++++--- programs/system/shell/kolibri.h | 90 ------ programs/system/shell/module_alias.c | 133 --------- programs/system/shell/module_command.c | 336 ---------------------- programs/system/shell/module_executable.c | 60 ---- programs/system/shell/module_program.c | 16 -- programs/system/shell/module_script.c | 102 ------- programs/system/shell/readme.txt | 27 -- programs/system/shell/shell.c | 4 + programs/system/shell/stdlib.h | 14 - programs/system/shell/string.h | 12 - programs/system/ss/trunk/@SS.ASM | 10 + 34 files changed, 112 insertions(+), 1512 deletions(-) delete mode 100644 programs/system/shell/cmd_about.c delete mode 100644 programs/system/shell/cmd_alias.c delete mode 100644 programs/system/shell/cmd_cd.c delete mode 100644 programs/system/shell/cmd_date.c delete mode 100644 programs/system/shell/cmd_echo.c delete mode 100644 programs/system/shell/cmd_exit.c delete mode 100644 programs/system/shell/cmd_free.c delete mode 100644 programs/system/shell/cmd_help.c delete mode 100644 programs/system/shell/cmd_kill.c delete mode 100644 programs/system/shell/cmd_ls.c delete mode 100644 programs/system/shell/cmd_mkdir.c delete mode 100644 programs/system/shell/cmd_more.c delete mode 100644 programs/system/shell/cmd_ps.c delete mode 100644 programs/system/shell/cmd_pwd.c delete mode 100644 programs/system/shell/cmd_reboot.c delete mode 100644 programs/system/shell/cmd_rm.c delete mode 100644 programs/system/shell/cmd_rmdir.c delete mode 100644 programs/system/shell/cmd_touch.c delete mode 100644 programs/system/shell/cmd_ver.c delete mode 100644 programs/system/shell/console.c delete mode 100644 programs/system/shell/kolibri.h delete mode 100644 programs/system/shell/module_alias.c delete mode 100644 programs/system/shell/module_command.c delete mode 100644 programs/system/shell/module_executable.c delete mode 100644 programs/system/shell/module_program.c delete mode 100644 programs/system/shell/module_script.c delete mode 100644 programs/system/shell/readme.txt delete mode 100644 programs/system/shell/stdlib.h delete mode 100644 programs/system/shell/string.h diff --git a/programs/system/shell/all.h b/programs/system/shell/all.h index 116da9c41c..7b91a967a8 100644 --- a/programs/system/shell/all.h +++ b/programs/system/shell/all.h @@ -1,39 +1,43 @@ /// =========================================================== -#include "kolibri.h" -#include "stdlib.h" -#include "string.h" +#include "system/boolean.h" +#include "system/kolibri.h" +#include "system/stdlib.h" +#include "system/string.h" #include "globals.h" #include "prototypes.h" -#include "console.c" +#include "system/console.c" -#include "cmd_about.c" -#include "cmd_help.c" -#include "cmd_ver.c" -#include "cmd_pwd.c" -#include "cmd_ls.c" -#include "cmd_ps.c" -#include "cmd_kill.c" -#include "cmd_echo.c" -#include "cmd_date.c" -#include "cmd_exit.c" -#include "cmd_cd.c" -#include "cmd_free.c" -#include "cmd_reboot.c" -#include "cmd_mkdir.c" -#include "cmd_rmdir.c" -#include "cmd_rm.c" -#include "cmd_touch.c" -#include "cmd_alias.c" -#include "cmd_more.c" +#include "cmd/cmd_about.c" +#include "cmd/cmd_help.c" +#include "cmd/cmd_ver.c" +#include "cmd/cmd_pwd.c" +#include "cmd/cmd_ls.c" +#include "cmd/cmd_ps.c" +#include "cmd/cmd_kill.c" +#include "cmd/cmd_echo.c" +#include "cmd/cmd_date.c" +#include "cmd/cmd_exit.c" +#include "cmd/cmd_cd.c" +#include "cmd/cmd_free.c" +#include "cmd/cmd_reboot.c" +#include "cmd/cmd_mkdir.c" +#include "cmd/cmd_rmdir.c" +#include "cmd/cmd_rm.c" +#include "cmd/cmd_touch.c" +#include "cmd/cmd_alias.c" +#include "cmd/cmd_more.c" +#include "cmd/cmd_clear.c" +#include "cmd/cmd_ccpuid.c" +#include "cmd/cmd_sleep.c" -#include "module_command.c" -#include "module_program.c" -#include "module_script.c" -#include "module_executable.c" -#include "module_alias.c" +#include "modules/module_command.c" +#include "modules/module_program.c" +#include "modules/module_script.c" +#include "modules/module_executable.c" +#include "modules/module_alias.c" /// =========================================================== diff --git a/programs/system/shell/cmd_about.c b/programs/system/shell/cmd_about.c deleted file mode 100644 index a97850e701..0000000000 --- a/programs/system/shell/cmd_about.c +++ /dev/null @@ -1,9 +0,0 @@ - -void cmd_about() -{ -printf("\n\rShell for KolibriOS\n\r"); -printf(" version %s\n\r", SHELL_VERSION); -printf("\n\r author: Oleksandr Bogomaz aka Albom"); -printf("\n\r e-mail: albom85@yandex.ru"); -printf("\n\r site: http://albom06.boom.ru/\n\r\n\r"); -} diff --git a/programs/system/shell/cmd_alias.c b/programs/system/shell/cmd_alias.c deleted file mode 100644 index c8fe128903..0000000000 --- a/programs/system/shell/cmd_alias.c +++ /dev/null @@ -1,17 +0,0 @@ - -void cmd_alias(char arg[]) -{ - -int result; - -if (NULL == arg) - { - alias_list(); - return; - } - -result = alias_check(arg); -if ( ( 0 != result ) && ( -1 != result ) ) - alias_add(arg); - -} diff --git a/programs/system/shell/cmd_cd.c b/programs/system/shell/cmd_cd.c deleted file mode 100644 index 8a2322f384..0000000000 --- a/programs/system/shell/cmd_cd.c +++ /dev/null @@ -1,47 +0,0 @@ - -int cmd_cd(char dir[]) -{ - -char temp[256]; -unsigned result; - -if (NULL == dir) - { - printf(" cd directory\n\r"); - return FALSE; - } - -if ( 0 == strcmp(dir, ".") ) - return FALSE; - -if ( ( 0 == strcmp(dir, "..") ) && ( 0 != strcmp(cur_dir, "/")) ) - { - cur_dir[strlen(cur_dir)-1]='\0'; - dir_truncate(cur_dir); - return FALSE; - } - -if ( '/' == dir[0]) - { - if ( dir_check(dir) ) - { - strcpy(cur_dir, dir); - return TRUE; - } - return FALSE; - } -else - { - strcpy(temp, cur_dir); - strcat(temp, dir); - - if ( dir_check(temp) ) - { - strcpy(cur_dir, temp); - return TRUE; - } - - return FALSE; - } - -} diff --git a/programs/system/shell/cmd_date.c b/programs/system/shell/cmd_date.c deleted file mode 100644 index 8ec8c37ab9..0000000000 --- a/programs/system/shell/cmd_date.c +++ /dev/null @@ -1,22 +0,0 @@ - - -void cmd_date() -{ -unsigned date; -unsigned time; - -date = kol_system_date_get(); -printf(" date [dd.mm.yy]: %x%x.%x%x.%x%x", - (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(); - -printf("\n\r time [hh:mm:ss]: %x%x:%x%x:%x%x\n\r", - (time&0xf0)>>4, (time&0xf), // hours - (time&0xf000)>>12, (time&0xf00)>>8, // minutes - (time&0xf00000)>>20, (time&0xf0000)>>16 ); // seconds - -} diff --git a/programs/system/shell/cmd_echo.c b/programs/system/shell/cmd_echo.c deleted file mode 100644 index ae1a69e115..0000000000 --- a/programs/system/shell/cmd_echo.c +++ /dev/null @@ -1,6 +0,0 @@ - - -void cmd_echo(char text[]) -{ -printf("%s\n\r", text); -} diff --git a/programs/system/shell/cmd_exit.c b/programs/system/shell/cmd_exit.c deleted file mode 100644 index 4aa66da509..0000000000 --- a/programs/system/shell/cmd_exit.c +++ /dev/null @@ -1,7 +0,0 @@ - -void cmd_exit() -{ -free(ALIASES); -_exit(1); -kol_exit(); -} diff --git a/programs/system/shell/cmd_free.c b/programs/system/shell/cmd_free.c deleted file mode 100644 index 2811aca64a..0000000000 --- a/programs/system/shell/cmd_free.c +++ /dev/null @@ -1,12 +0,0 @@ - -void cmd_free() -{ -unsigned total, free, used; - -total = kol_system_mem(); -free = kol_system_memfree(); -used = total - free; - -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", - total, total/1024, free, free/1024, (free*100)/total, used, total/1024-free/1024, 100-(free*100)/total ); -} diff --git a/programs/system/shell/cmd_help.c b/programs/system/shell/cmd_help.c deleted file mode 100644 index 9972e90ae7..0000000000 --- a/programs/system/shell/cmd_help.c +++ /dev/null @@ -1,31 +0,0 @@ - -int cmd_help(char cmd[]) -{ - -int i; - -char available[]={" %d commands available:\n\r"}; - -if (NULL == cmd) - { - printf (available, NUM_OF_CMD); - for (i = 0; i < NUM_OF_CMD; i++) - printf(" %s\n\r", HELP_COMMANDS[i]); - } -else - { - for (i=0; i'9')) - return 0; - else - n = 10 * n + s[i] - '0'; - -return n; -} - - - -int cmd_kill(char process[]) -{ - -unsigned proc; -int result; - -if (NULL == process) - { - printf(" kill PID\n\r"); - return FALSE; - } -else - { - proc = _atoi(process); - if ( 0 != proc ) - { - result = kol_process_kill_pid(proc); - if (result < 0) - return FALSE; - else - return TRUE; - } - } - -} diff --git a/programs/system/shell/cmd_ls.c b/programs/system/shell/cmd_ls.c deleted file mode 100644 index bc3c10abd3..0000000000 --- a/programs/system/shell/cmd_ls.c +++ /dev/null @@ -1,41 +0,0 @@ - -int cmd_ls(char dir[]) -{ - -kol_struct70 k70; -unsigned *n; -unsigned num_of_file; -unsigned *t; -unsigned type_of_file; -int i; - -k70.p00 = 1; -k70.p04 = 0; -k70.p08 = 0; -k70.p12 = 2*1024*1024; // 2 MB -k70.p16 = malloc(2*1024*1024); -k70.p20 = 0; -k70.p21 = dir; - -if ( !kol_file_70(&k70) ) // проверяем существование каталога - { - free(k70.p16); - return FALSE; - } - -n = k70.p16+8; -num_of_file = *n; // число файлов в каталоге - -for (i = 0; i < num_of_file; i++) - { - printf (" %s", k70.p16+32+40+(264+40)*i); - t = 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"); - } - -free(k70.p16); -return TRUE; -} diff --git a/programs/system/shell/cmd_mkdir.c b/programs/system/shell/cmd_mkdir.c deleted file mode 100644 index b2d2533eee..0000000000 --- a/programs/system/shell/cmd_mkdir.c +++ /dev/null @@ -1,44 +0,0 @@ - -int cmd_mkdir(char dir[]) -{ - -char temp[256]; -kol_struct70 k70; -unsigned result; - -if (NULL == dir) - { - printf(" mkdir directory\n\r"); - return FALSE; - } - - -if ( 0 == strcmp(dir, ".") || ( 0 == strcmp(dir, "..") ) || ( 0 == strcmp(cur_dir, "/")) ) - { - return FALSE; - } - -k70.p00 = 9; -k70.p04 = 0; -k70.p08 = 0; -k70.p12 = 0; -k70.p16 = 0; -k70.p20 = 0; - -if ( '/' == dir[0]) - k70.p21 = dir; -else - { - strcpy(temp, cur_dir); - strcat(temp, dir); - k70.p21 = temp; - } - -result = kol_file_70(&k70); - -if (0 == result) - return TRUE; -else - return FALSE; - -} diff --git a/programs/system/shell/cmd_more.c b/programs/system/shell/cmd_more.c deleted file mode 100644 index 8fdee45820..0000000000 --- a/programs/system/shell/cmd_more.c +++ /dev/null @@ -1,87 +0,0 @@ - -int cmd_more(char file[]) -{ - -kol_struct70 k70; -kol_struct_BDVK bdvk; -unsigned result, filesize, pos, i; -char buf[81]; //буфер -char temp[256]; -unsigned flags; - -if (NULL == file) - { - printf (" less filename\n\r"); - return FALSE; - } - -if ( '/' == file[0]) - { - strcpy(temp, file); - - if ( !file_check(temp) ) - { - return FALSE; - } - } -else - { - strcpy(temp, cur_dir); - strcat(temp, file); - - if ( !file_check(temp) ) - { - return FALSE; - } - } - -k70.p00 = 5; -k70.p04 = k70.p08 = k70.p12 = 0; -k70.p16 = &bdvk; -k70.p20 = 0; -k70.p21 = temp; - -result = kol_file_70(&k70); // получаем информацию о файле -if ( 0 != result ) - return FALSE; - -filesize = bdvk.p32[0]; // получаем размер файла - -buf[80]=0; -flags = con_get_flags(); - -for (pos=0;pos 255) - return FALSE; - -if ( !alias_split (alias, buf1, buf2)) - return FALSE; - -strcpy (ALIASES+256*ALIAS_NUM, buf1); -strcpy (ALIASES+256*ALIAS_NUM+64*1024, buf2); -ALIAS_NUM++; - -return TRUE; -} - -/// =========================================================== - -void alias_list() -{ - -unsigned i; - -if ( 0 == ALIAS_NUM) - return; - -for (i = 0; i < ALIAS_NUM; i++) - printf (" %s=%s\n\r",ALIASES+256*i, ALIASES+256*i+64*1024); -} - -/// =========================================================== - -int alias_split (char alias[], char s1[], char s2[]) -{ - -unsigned i, j; - -if (NULL == strchr(alias, '=')) - return FALSE; - -for (i=0, j = 0;; i++) - { - if ('=' == alias[i]) - { - s1[i]='\0'; - break; - } - s1[i]=alias[i]; - } - -j = 0; - -for (;; i++, j++) - { - s2[j]=alias[i]; - if ('\0' == alias[i]) - break; - } - -trim(s1); - -for (i=0;;i++) - { - s2[i] = s2[i+1]; - if ('\0' == s2[i] ) - break; - } - -trim(s2); - -return TRUE; - -} - -/// =========================================================== diff --git a/programs/system/shell/module_command.c b/programs/system/shell/module_command.c deleted file mode 100644 index a8478b4b6e..0000000000 --- a/programs/system/shell/module_command.c +++ /dev/null @@ -1,336 +0,0 @@ - -/// =========================================================== - -void command_clear() -{ -for (;CMD_POS;CMD_POS--) - printf("%c %c", 8, 8); -CMD[0]='\0'; -} - -/// =========================================================== - -void command_history_add(char command[]) -{ - -if ( (0 != strcmp( CMD_HISTORY[0], CMD)) && - (0 != strcmp( CMD_HISTORY[1], CMD)) && - (0 != strcmp( CMD_HISTORY[2], CMD)) && - (0 != strcmp( CMD_HISTORY[3], CMD)) && - (0 != strcmp( CMD_HISTORY[4], CMD)) ) - - { - strcpy(CMD_HISTORY[4], CMD_HISTORY[3]); - strcpy(CMD_HISTORY[3], CMD_HISTORY[2]); - strcpy(CMD_HISTORY[2], CMD_HISTORY[1]); - strcpy(CMD_HISTORY[1], CMD_HISTORY[0]); - - strcpy(CMD_HISTORY[0], CMD); - } - -} - -/// =========================================================== - -void command_get() -{ -unsigned key; -//unsigned pos = 0; -int hist; - -CMD_POS = 0; -CMD_NUM = 0; - -for (;;) - { - key = getch(); - if ( 0 != (key & 0xff) ) - { - key &= 0xff; - switch (key) - { - case 27: // ESC - command_clear(); - break; - - case 13: // ENTER - CMD[CMD_POS] = '\0'; - printf("\n\r"); - - command_history_add(CMD); - return; - - case 8: // BACKSPACE - if (CMD_POS > 0) - { - printf ("%c %c", 8, 8); - CMD_POS--; - } - break; - - case 9: // TAB - break; - - default: - if (CMD_POS < 255) - { - CMD[CMD_POS] = key; - CMD_POS++; - printf("%c", key); - } - break; - }; - } - else // обработка расширенных клавиш - { - key = (key>>8)&0xff; -// printf ("%d\n\r", key); - - switch (key) - { - - case 72: // UP - for (hist = 0; hist < CMD_HISTORY_NUM; hist++) - { - command_clear(); - - if (CMD_NUM < CMD_HISTORY_NUM-1) - CMD_NUM++; - else - CMD_NUM = 0; - - printf( CMD_HISTORY[CMD_NUM] ); - strcpy(CMD, CMD_HISTORY[CMD_NUM]); - CMD_POS = strlen(CMD); - - if (0!=strlen(CMD)) - break; - } - - break; - - case 80: // DOWN - for (hist = 0; hist < CMD_HISTORY_NUM; hist++) - { - command_clear(); - - if (CMD_NUM > 0) - CMD_NUM--; - else - CMD_NUM = CMD_HISTORY_NUM-1; - - printf( CMD_HISTORY[CMD_NUM] ); - strcpy(CMD, CMD_HISTORY[CMD_NUM]); - CMD_POS = strlen(CMD); - - if (0!=strlen(CMD)) - break; - } - break; - - }; - } - - } -} - - -/// =========================================================== - -int command_get_cmd(char cmd[]) -{ -unsigned i; -for (i=0;;i++) - { - cmd[i] = CMD[i]; - if (0 == cmd[i]) - { - i = -2; - break; - } - if ( iswhite(cmd[i]) ) - { - cmd[i] = '\0'; - break; - } - } -return i+1; -} - -/// =========================================================== - -void command_execute() -{ -char cmd[256]; -char args[256]; -unsigned arg; - -trim(CMD); -arg = command_get_cmd(cmd); - -if ( !strlen(cmd) ) - return; - -strcpy(args, CMD+arg); -trim(args); - -if ( !strcmp(cmd, "help") ) - { - if (-1 == arg) - cmd_help(NULL); - else - cmd_help(args); - return; - } - -if ( !strcmp(cmd, "ver") ) - { - cmd_ver(); - return; - } - -if ( !strcmp(cmd, "cd") ) - { - if (-1 == arg) - cmd_cd(NULL); - else - cmd_cd(args); - - if ( '/' != cur_dir[strlen(cur_dir)-1] ) - strcat(cur_dir, "/"); - - return; - } - -if ( !strcmp(cmd, "ls") ) - { - if (-1 == arg) - cmd_ls(cur_dir); - else - cmd_ls(args); - return; - } - -if ( !strcmp(cmd, "ps") ) - { - cmd_ps(); - return; - } - -if ( !strcmp(cmd, "kill") ) - { - if (-1 == arg) - cmd_kill(NULL); - else - cmd_kill(args); - return; - } - -if ( !strcmp(cmd, "pwd") ) - { - cmd_pwd(); - return; - } - -if ( !strcmp(cmd, "mkdir") ) - { - if (-1 == arg) - cmd_mkdir(NULL); - else - cmd_mkdir(args); - return; - } - -if ( !strcmp(cmd, "rmdir") ) - { - if (-1 == arg) - cmd_rmdir(NULL); - else - cmd_rmdir(args); - return; - } - -if ( !strcmp(cmd, "rm") ) - { - if (-1 == arg) - cmd_rm(NULL); - else - cmd_rm(args); - return; - } - -if ( !strcmp(cmd, "more") ) - { - if (-1 == arg) - cmd_more(NULL); - else - cmd_more(args); - return; - } - -if ( !strcmp(cmd, "echo") ) - { - cmd_echo(args); - return; - } - -if ( !strcmp(cmd, "exit") ) - { - cmd_exit(); - return; - } - -if ( !strcmp(cmd, "date") ) - { - cmd_date(); - return; - } - -if ( !strcmp(cmd, "about") ) - { - cmd_about(); - return; - } - -if ( !strcmp(cmd, "free") ) - { - cmd_free(); - return; - } - -if ( !strcmp(cmd, "reboot") ) - { - cmd_reboot(); - return; - } - -if ( !strcmp(cmd, "touch") ) - { - if (-1 == arg) - cmd_touch(NULL); - else - cmd_touch(args); - return; - } - -if ( !strcmp(cmd, "alias") ) - { - if (-1 == arg) - cmd_alias(NULL); - else - cmd_alias(args); - return; - } - -if ( -1 != alias_search(CMD) ) - { - strcpy(CMD, ALIASES+64*1024+256*alias_search(CMD)); - command_execute(); - return; - } - -executable_run(cmd, args); - -} - -/// =========================================================== diff --git a/programs/system/shell/module_executable.c b/programs/system/shell/module_executable.c deleted file mode 100644 index 78a9e80164..0000000000 --- a/programs/system/shell/module_executable.c +++ /dev/null @@ -1,60 +0,0 @@ - -/// =========================================================== - -int executable_run(char cmd[], char args[]) -{ - -char exec[256]; -char error_starting[]={" No such command '%s'.\n\r"}; -int result; - -if ( '/' == cmd[0]) // если путь абсолбтный - { - strcpy(exec, cmd); - - if ( !file_check(exec) ) // проверяем существование файла - { - printf(error_starting, cmd); - return FALSE; - } - } - -else - { - strcpy(exec, cur_dir); // проверяем файл в текущем каталоге - strcat(exec, cmd); - - if ( !file_check(exec) ) // проверяем существование файла - { - strcpy(exec, "/rd/1/"); // проверяем файл на виртуальном диске - strcat(exec, cmd); - if ( !file_check(exec) ) // проверяем существование файла - { - printf(error_starting, cmd); - return FALSE; - } - } - } - - -if ( script_check(exec) ) - { - return script_run(exec, args); - } - -/* запуск программы */ -result = program_run(exec, args); -if (result > 0) - { - printf (" '%s' started. PID = %d\n\r", cmd, result); - return TRUE; - } -else - { - printf(error_starting, cmd); - return FALSE; - } - -} - -/// =========================================================== diff --git a/programs/system/shell/module_program.c b/programs/system/shell/module_program.c deleted file mode 100644 index 6bbbe2685a..0000000000 --- a/programs/system/shell/module_program.c +++ /dev/null @@ -1,16 +0,0 @@ - -int program_run(char cmd[], char param[]) -{ - -kol_struct70 k70; - -k70.p00 = 7; -k70.p04 = 0; -k70.p08 = param; -k70.p12 = 0; -k70.p16 = 0; -k70.p20 = 0; -k70.p21 = cmd; - -return kol_file_70(&k70); -} diff --git a/programs/system/shell/module_script.c b/programs/system/shell/module_script.c deleted file mode 100644 index 4abc0ee726..0000000000 --- a/programs/system/shell/module_script.c +++ /dev/null @@ -1,102 +0,0 @@ - -/// =========================================================== - -int script_check(char file[]) -{ - -kol_struct70 k70; -char buf[4]; - -k70.p00 = 0; -k70.p04 = 0; -k70.p08 = 0; -k70.p12 = 4; // читать 4 байта -k70.p16 = buf; -k70.p20 = 0; -k70.p21 = file; - -kol_file_70(&k70); - -if ( !strcmp(buf, script_sign) ) - return TRUE; -else - return FALSE; -} - -/// =========================================================== - -int script_run(char exec[], char args[]) -{ - -kol_struct70 k70; -kol_struct_BDVK bdvk; -unsigned result, filesize, pos, i; -char *buf; //буфер, куда копируется скрипт - -k70.p00 = 5; -k70.p04 = k70.p08 = k70.p12 = 0; -k70.p16 = &bdvk; -k70.p20 = 0; -k70.p21 = exec; - -result = kol_file_70(&k70); // получаем информацию о файле -if ( 0 != result ) - return FALSE; - -filesize = bdvk.p32[0]; // получаем размер файла - -buf = malloc(filesize+256); -if (NULL == buf) - return FALSE; - -buf[filesize]=0; - -k70.p00 = 0; -k70.p04 = k70.p08 = 0; -k70.p12 = filesize; -k70.p16 = buf; -k70.p20 = 0; -k70.p21 = exec; - -result = kol_file_70(&k70); // считываем файл в буфер -if ( 0 != result ) - { - free(buf); - return FALSE; - } - -pos = 0; - -for (;;) // обработка скрипта - { - - if (pos > filesize) - break; - - for (i=0;;i++) // считывание строки - { - if ((0x0A == buf[pos])||(0x0D == buf[pos])||(0 == buf[pos])) - { - pos++; - CMD[i] = '\0'; - break; - } - CMD[i] = buf[pos]; - pos++; - } - - if ( 0 == strlen(CMD) ) // пустая строка - continue; - - if ('#' == CMD[0]) // комментарий - continue; - - command_execute(); - - } - -free(buf); -return TRUE; -} - -/// =========================================================== diff --git a/programs/system/shell/readme.txt b/programs/system/shell/readme.txt deleted file mode 100644 index 0b53955ea2..0000000000 --- a/programs/system/shell/readme.txt +++ /dev/null @@ -1,27 +0,0 @@ -Shell for KolibriOS - version 0.4 - - author: Oleksandr Bogomaz aka Albom - e-mail: albom85@yandex.ru - site: http://albom06.boom.ru/ - -Available commands: - about Displays information about the program - alias Allows the user view the current aliases - cd Changes directories - date Returns the date and time - echo Echoes the data to the screen - exit Exits program - free Displays total, free and used memory - help Gives help - kill Stops a running process - ls Lists the files in a directory - mkdir Makes directory - more Displays a data file to the screen - ps Lists the current processes running - pwd Displays the name of the working directory - reboot Reboots the computer - rm Removes files - rmdir Removes directories - touch Creates an empty file or updates the time/date stamp on a file - ver Displays version diff --git a/programs/system/shell/shell.c b/programs/system/shell/shell.c index 9a104f82a9..d289e6f832 100644 --- a/programs/system/shell/shell.c +++ b/programs/system/shell/shell.c @@ -104,6 +104,8 @@ for (;i>0;--i) void kol_main() { +NUM_OF_CMD = sizeof(COMMANDS)/sizeof(COMMANDS[0]); + strcpy(title, "SHELL "); strcat(title, SHELL_VERSION); CONSOLE_INIT(title); @@ -113,6 +115,8 @@ dir_truncate(cur_dir); con_set_cursor_height(con_get_font_height()-1); +ALIASES = malloc(128*1024); + if (strlen(PARAM) > 0) strcpy(CMD, PARAM); else diff --git a/programs/system/shell/stdlib.h b/programs/system/shell/stdlib.h deleted file mode 100644 index e984555604..0000000000 --- a/programs/system/shell/stdlib.h +++ /dev/null @@ -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); diff --git a/programs/system/shell/string.h b/programs/system/shell/string.h deleted file mode 100644 index 4bb934aa10..0000000000 --- a/programs/system/shell/string.h +++ /dev/null @@ -1,12 +0,0 @@ - -#define NULL ((void*)0) - -void* memset(void *mem, int c, unsigned size); -void* memcpy(void *dst, const void *src, unsigned size); - -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); diff --git a/programs/system/ss/trunk/@SS.ASM b/programs/system/ss/trunk/@SS.ASM index a1026b705e..5ca5c59e73 100644 --- a/programs/system/ss/trunk/@SS.ASM +++ b/programs/system/ss/trunk/@SS.ASM @@ -36,6 +36,8 @@ bgr_changed: shl eax, 16 mov [top_right_corner], eax + mcall 66, 4, 57, 0 ; hot key for {Space} + mcall 66, 4, 28, 0 ; hot key for {Enter} still: movzx ebx, [time] imul ebx, 60*100 @@ -62,6 +64,14 @@ create_setup: jmp still key: mcall ; eax = 2 + cmp al, 2 ; hot key? + jne still ; no hotkey, evenets handling go on + xor edx, edx + mov dl, ah + mov eax, 72 + mov ebx, 1 + mov ecx, 2 + mcall ; transfer key code to active window after interception jmp still create_ss_thread: